You are on page 1of 15

Task 01

Task 1.1)
Graphical User Interface (GUI):
GUI is sort form for Graphical User Interface; generally this is a part of computers operating system which is
characterized by WIMPs and WYSIWYG.
WIMPs are Windows, Icons, Menus, and Pointing devices (such as a mouse or a trackball).
WYSIWYG or What You See is What You Get, refers to the ability to print out exactly what you see on the screen,
this made effective desktop publishing possible.
The GUI is based on the principle that pointing in menus to a command you want to computer to do is easier
than having to remember hundreds of key words like in command line operating systems such as MS DOS or
UNIX. The GUI is based on the idea that pointing to something is the most basic human motion, and the mouse
is easier to use than a keyboard.
(Referance: *1)

The GUI replaced the command line interface because cooperating with a computer using a mouse pointer has
several benefits over typed commands such as: Intuitive, Multitasking, Application Interface, Rich Media, &
Visualizing Concept.
Intuitive: A GUI is natural; a person who never used computer before can perform basic process with a GUI
after few minute training. Users simply click the item they want to work together with. Right-click an item to
open a context menu and see the other things you can do with it. A command line interface is more unclear and
needs memorization the commands.

Gayan Sachith Kumara

Networking with Windows

Multitasking: One of the key advantages is that GUI-based operating systems are designed for do the
multitasking. You can change the size of any window as needed and place windows side-by-side Or Horizontally
or vertically to see and interact with different programs at the same time. Command line operating systems
generally use full-screen applications; although it may be possible to run multiple applications and switch
between them, it is generally not possible to view them simultaneously.

Rich Media: GUI-based operating systems are designed with rich media such as images, videos and music in
mind and these operating systems utilize programming frameworks such as Microsoft DirectX and Adobe Flash
to make rich media applications easier to develop. Though it is possible to play a video or listen to music on a
command line-based operating system but it is more difficult than GUI.

Application Interface: Applications are designed for GUI-based operating systems tend to have similar
interfaces. For example, many Windows applications have bars at the top of the screen with options such as
"File," "Edit," "Tools" and "Help." If you have used these functions in one Windows application, you know how to
use them in another application even if you have never used that application before.

Gayan Sachith Kumara

Networking with Windows

Visualizing Concepts: Cooperating with the items on a computer involves several intellectual concepts that
might be difficult for some to understand. GUI-based operating systems give these concepts visual
representations. New users quickly learn that folders contain files and that you can double-click a folder to open
the folder & to what it holds. A file frequently has a specific icon indicating its type; for example, an audio file
might have an icon depicting a music note.

(Referance: *2)

Command Line Interface (CLI):


A command line interface is a user interface to a computer's operating system or an application in which the
user responds to a visual prompt by typing in a command on a specified line, receives a response back from the
system, and then enters another command, and so forth. The MS-DOS Prompt application in a Windows
operating system is an example of the provision of a command line interface.
(Referance: *3)

Gayan Sachith Kumara

Networking with Windows

CLI vs. GUI

Topic
Simplicity

Control

Multitasking

Speed

Command line (CLI)

GUI

Memorization and familiarity needed to


operate with command line interface; new
users have a difficult time navigating and
operating a command line interface.
Users have more control of the system and
operating system in a command line
interface. As an example, users can copy a
file from one location to another in a onecommand line.
Many command line environments are
capable of multitasking; but they do not
provide the ability to view multiple things
at one time.
Command line users only need to use their
keyboards to navigate a command line
interface and often only need to execute a
few lines to perform a task.

Though new users may have a difficult time


learning to use the mouse and all GUI
features, but it is much easier when compared
to the command line interface.
Although a GUI proposals quite of control of a
file system and operating system, the more
advanced tasks may still need a command line.

Properties

A computer that is only using the command


line takes a lot less of the computers
system resources than a GUI.

Scripting

A command line interface enables a user to


script a sequence of commands to perform
a task or execute a program.

Remote access When accessing another computer or

Diverse

Stress

networking device over a network, a user


will only be able to manipulate the device
or its files using a command line interface.
After you've learned how to navigate and
use a command line, it's not going to
change as much as a new GUI. Although
new commands may be introduced, the
original commands always remain the
same.
The command line allows the user to keep
their hands on the keyboard and rarely
have to move from the keyboard to the
mouse. Moving back and forth between a
keyboard and mouse can cause additional
strain and may help contribute to Carpal
Tunnel.

GUI users have windows that enable a user to


view, control, and use multiple things at once
and are much faster to navigate when
compared with a command line.
A GUI may be easier to use because of the
mouse. However, using a mouse and keyboard
to navigate and control your operating system
for many things is going to be much slower
than someone who is working in a command
line.
A GUI requires more system resources
because of each of the elements that need to
be loaded such as icons, fonts, etc. In addition,
video drivers, mouse drivers, and other drivers
that need to be loaded will also take
additional resources.
Although A GUI enables a user to create
shortcuts, tasks, or other similar actions, it
doesn't even come close in comparison to
what is available through a command line.
Although remote graphical access is possible.
Not all computers and especially not all
network equipment will have this ability.
Each GUI has a different design and structure
of how to perform different tasks. Even
different versions of the same GUI, such as
Windows, can have hundreds of different
changes between each version.
Although shortcut keys can be learned to help
reduce the amount of times you have move
from the keyboard to the mouse, you will still
be moving much more between the keyboard
and mouse with a GUI.

(Referance: *4)

Gayan Sachith Kumara

Networking with Windows

Task 1.2)
Windows O/S
Windows is a major graphical interface operating systems developed and sold by Microsoft.
Microsoft introduced an operating environment call Windows on November 20, 1985 as a graphical operating
system shell for MS-DOS in reply to the growing interest in graphical user interfaces (GUI). Windows O/S
came to rule the world's personal computer market with over 90% market share, overtaking Mac OS, which had
been introduced in 1984.
October 2013, the most recent versions of Windows for personal computers, smartphones, server computers
and embedded devices are respectively Windows 8.1, Windows Phone 8, Windows Server 2012 R2 and
Windows Embedded 8.
(Referance: *5)

Windows O/S Client side issues:


Insecurity
Variability
Customizability
Compatibility

Insecurity: Due to the brand and closed source nature of Microsoft, the programs dont experience the hearty
scrutiny and testing Linux systems endure at the hands of the open source community. The limited number of
staff to write and edit the source code for vulnerabilities leaves the systems more prone to attack and due to its
popularity, many more viruses are targeted to hit Microsoft programs these viruses have been known to cause
devastating and costly network losses including the destruction or corruption of confidential corporate files.
Further utilizing the resources of an entire community, Linux Vulnerabilities are quickly and correctly patched. In
some cases, Microsoft vulnerabilities are only patched after seeing a problem and many provide only a quick fix
and are in need of further attention in the future.

Variability: As the design flaws of Windows are consistently misused, the stability of the operating system is
under constant threat. These problems are not exclusive to virus and worm exploitation but also the way in
which Windows interacts with other technology. Windows is infamous for not working well with third party
vendor products causing slow processing time and system crashes. Also, letting the end useful administrative
control to machine can result in the inadvertent corruption of system data.

Customizability: Windows does not give the access to customize the program depending specific needs of the
user. If a specific program does not contain all the functionality, style, compatibility, or security desired,
organization have to purchase additional products to do the job.

Compatibility: wide range of software available for Windows PCs often is not fully compatible with certain
hardware, causing inconvenience, monetary losses, and system lock-up or software crash.

Gayan Sachith Kumara

Networking with Windows

Server side

Windows Server requires more system resources.

Need a powerful machine to run Windows Server.

Windows Server does not have a good reputation in terms of server stability.

The costs of the applications are usually higher than UNIX.

No, many free applications in Windows Server world.

Additional Hardware Resources: One disadvantage to using Windows Server is that it requires more resources
for the machine to operate properly. Usually purchasing software will also involve upgrading the hardware. For
instance, many software products require more internal memory and a faster, more powerful processor. It also
requires several updates and security patches, usually referred to as service packs. Sometimes, after the
installation of these service packs, problems can occur with the operating system, rendering the server unusable
until the problem is resolved.

Support Costs: There are high costs. The administration of Server 2003 involves having trained support staff. The
staff must be well trained to take advantage of the system, which can be costly. There are licensing costs for
using the software that are not only related to the server itself but also to the client workstations.

Gayan Sachith Kumara

Networking with Windows

Task 1.3)
MS-DOS (Microsoft disk operating system):
Originally developed by Microsoft for IBM, MS-DOS was the standard operating system for IBM-compatible
personal computers. The initial versions of DOS were very simple and resembled another operating system
called CP/M. Subsequent versions have become increasingly sophisticated as they incorporated features of
minicomputer operating systems.
Windows 1.0 2.0 (1985-1992):
Introduced in 1985, Microsoft Windows 1.0 was named due to the computing boxes, or "windows" that
represented a fundamental aspect of the operating system. Instead of typing MS-DOS commands, windows 1.0
allowed users to point and click to access the windows.
In 1987 Microsoft released Windows 2.0, which was designed for the designed for the Intel 286 processor. This
version added desktop icons, keyboard shortcuts and improved graphics support.
Windows 3.0 3.1 (19901994)
Microsoft released Windows 3.0 in May, 1900 offering better icons, performance and advanced graphics with 16
colors designed for Intel 386 processors. This version is the first release that provides the standard "look and
feel" of Microsoft Windows for many years to come. Windows 3.0 included Program Manager, File Manager and
Print Manager and games (Hearts, Minesweeper and Solitaire). Microsoft released Windows 3.1 in 1992.
Windows 95 (August 1995)
A major release of the Microsoft Windows operating system released in 1995. Windows 95 represents a
significant advance over its precursor, Windows 3.1. In addition to sporting a new user interface, Windows 95
also includes a number of important internal improvements. Perhaps most important, it supports 32-bit
applications, which means that applications written specifically for this operating system should run much
faster.
Although Windows 95 can run older Windows and DOS applications, it has essentially removed DOS as the
underlying platform. This has meant removal of many of the old DOS limitations, such as 640K of main memory
and 8-character filenames. Other important features in this operating system are the ability to automatically
detect and configure installed hardware (plug and play).
Windows 98 (June 1998)
Windows 98 offers support for a number of new technologies, including FAT32, AGP, MMX, USB, DVD, and ACPI.
Its most visible feature, though, is the Active Desktop, which integrates the Web browser (Internet Explorer)
with the operating system. From the user's point of view, there is no difference between accessing a document
residing locally on the user's hard disk or on a Web server halfway around the world.
Windows ME - Millennium Edition (September 2000)
The Windows Millennium Edition, called "Windows Me" was an update to the Windows 98 core and included
some features of the Windows 2000 operating system. This version also removed the "boot in DOS" option.
Windows NT 31. - 4.0 (1993-1996)
Windows NT (New Technology) is a 32-bit operating system that supports preemptive multitasking. There are
actually two versions of Windows NT: Windows NT Server, designed to act as a server in networks, and Windows
NT Workstation for stand-alone or client workstations.
Gayan Sachith Kumara

Networking with Windows

Windows 2000 (February 2000)


Often abbreviated as "W2K," Windows 2000 is an operating system for business desktop and laptop systems to
run software applications connect to Internet and intranet sites, and access files, printers, and network
resources. Microsoft released four versions of Windows 2000: Professional (for business desktop and laptop
systems), Server (both a Web server and an office server), Advanced Server (for line-of-business applications)
and Datacenter Server (for high-traffic computer networks).
Windows XP (October 2001)
Windows XP was first introduced in 2001. Along with a redesigned look and feel to the user interface, the new
operating system is built on the Windows 2000 kernel, giving the user a more stable and reliable environment
than previous versions of Windows. Windows XP comes in two versions, Home and Professional. Microsoft
focused on mobility for both editions, including plug and play features for connecting to wireless networks. The
operating system also utilizes the 802.11x wireless security standard. Windows XP is one of Microsoft's bestselling products.
Windows Vista (November 2006)
Windows Vista offered advancement in reliability, security, ease of deployment, performance and manageability
over Windows XP. New in this version was capabilities to detect hardware problems before they occur, security
features to protect against the latest generation of threats, faster start-up time and low power consumption of
the new sleep state. In many cases, Windows Vista is noticeably more responsive than Windows XP on identical
hardware. Windows Vista simplifies and centralizes desktop configuration management, reducing the cost of
keeping systems updated.
Windows 7 (October, 2009)
Windows 7 made its official debut to the public on October 22, 2009 as the latest in the 25-year-old line of
Microsoft Windows operating systems and as the successor to Windows Vista (which itself had followed
Windows XP). Windows 7 was released in conjunction with Windows Server 2008 R2, Windows 7's server
counterpart. Enhancements and new features in Windows 7 include multi-touch support, Internet Explorer 8,
improved performance and start-up time, Aero Snap, Aero Shake, support for virtual hard disks, a new and
improved Windows Media Center, and improved security.
Windows 8 (Codename, Expected Release 2012)
Windows 8 is a completely redesigned operating system that's been developed from the ground up with
touchscreen use in mind as well as near-instant-on capabilities that enable a Windows 8 PC to load and start up
in a matter of seconds rather than in minutes. Windows 8 will replace the more traditional Microsoft Windows
OS look and feel with a new "Metro" design system interface that first debuted in the Windows Phone 7 mobile
operating system. The Metro user interface primarily consists of a "Start screen" made up of "Live Tiles," which
are links to applications and features that are dynamic and update in real time. Windows 8 supports both x86
PCs and ARM processors. Online media sites indicate that this version will be available in 2012, with October and
fall being the most often quoted time frame

Gayan Sachith Kumara

Networking with Windows

Task 1.4)
Multitasking is the ability of a computer to run more than one program, or task, at the same time. Multitasking
contrasts with single-tasking, where one process must entirely finish before another can begin. MS-DOS is
primarily a single-tasking environment, while Windows 3.1 and Windows NT are both multi-tasking
environments.
On a single-processor multitasking system, multiple processes don't actually run at the same time since there's
only one processor. Instead, the processor switches among the processes that are active at any given time.
Because computers are so fast compared with people, however, it appears to the user as though the computer
is executing all of the tasks at once. Multitasking also allows the computer to make good use of the time it would
otherwise spend waiting for I/O devices and user input--that time can be used for some other task that doesn't
need I/O at the moment.
Multitasking on a multiple-processor system still involves the processors switching between tasks because there
are almost always more tasks to run than there are processors. Note, however, that there can be as many tasks
running simultaneously as there are processors in the system. For the moment, we'll discuss multitasking on a
single-processor system.
Review: Preemptive and Non-Preemptive Multitasking
Within the category of multitasking, there are two major sub-categories: preemptive and non-preemptive (or
cooperative). In non-preemptive multitasking, use of the processor is never taken from a task; rather, a task
must voluntarily yield control of the processor before any other task can run. Windows 3.1 uses non-preemptive
multitasking for Windows applications.
Programs running under a non-preemptive operating system must be specially written to cooperate in
multitasking by yielding control of the processor at frequent intervals. Programs that do not yield sufficiently
often because non-preemptive systems to stay "locked" in that program until it does yield. An example of failed
non-preemptive multitasking is the inability to do anything else while printing a document in Microsoft Word for
Windows 2.0a. This happens because Word does not give up control of the processor often enough while
printing your document. The worst case of a program not yielding is when a program crashes. Sometimes,
programs which crash in Windows 3.1 will crash the whole system simply because no other tasks can run until
the crashed program yields.
Preemptive multitasking differs from non-preemptive multitasking in that the operating system can take control
of the processor without the task's cooperation. (A task can also give it up voluntarily, as in non-preemptive
multitasking.) The process of a task having control taken from it is called preemption. Windows NT uses
preemptive multitasking for all processes except 16-bit Windows 3.1 programs. As a result, a Window NT
application cannot take over the processor in the same way that a Windows 3.1 application can.
A preemptive operating system takes control of the processor from a task in two ways:

When a task's time quantum (or time slice) runs out. Any given task is only given control for a set
amount of time before the operating system interrupts it and schedules another task to run.

When a task that has higher priority becomes ready to run. The currently running task loses control of
the processor when a task with higher priority is ready to run regardless of whether it has time left in its
quantum or not.

Gayan Sachith Kumara

Networking with Windows

Switching Among Tasks


At any given time, a processor (CPU) is executing in a specific context. This context is made up of the contents of
its registers and the memory (including stack, data, and code) that it is addressing. When the processor needs to
switch to a different task, it must save its current context (so it can later restore the context and continue
execution where it left off) and switch to the context of the new task. This process is called context switching .
When Windows NT switches tasks, it saves all of the registers of the task it's leaving and re-loads the registers of
the task to which it's switching. This process also enables the proper address space for the task to which
Windows NT is switching.
Processes and Threads
Preemptive multitasking differs from non-preemptive multitasking in that the operating system can take control
of the processor without the task's cooperation. (A task can also give it up voluntarily, as in non-preemptive
multitasking.) The process of a task having control taken from it is called preemption. Windows NT uses
preemptive multitasking for all processes except 16-bit Windows 3.1 programs. As a result, a Window NT
application cannot take over the processor in the same way that a Windows 3.1 application can.
A preemptive operating system takes control of the processor from a task in two ways:

When a task's time quantum (or time slice) runs out. Any given task is only given control for a set
amount of time before the operating system interrupts it and schedules another task to run.

When a task that has higher priority becomes ready to run. The currently running task loses control of
the processor when a task with higher priority is ready to run regardless of whether it has time left in its
quantum or not.

Switching Among Tasks


At any given time, a processor (CPU) is executing in a specific context. This context is made up of the contents of
its registers and the memory (including stack, data, and code) that it is addressing. When the processor needs to
switch to a different task, it must save its current context (so it can later restore the context and continue
execution where it left off) and switch to the context of the new task. This process is called context switching .
When Windows NT switches tasks, it saves all of the registers of the task it's leaving and re-loads the registers of
the task to which it's switching. This process also enables the proper address space for the task to which
Windows NT is switching.
Processes and Threads
In addition to being a preemptive multitasking operating system, Windows NT is also multithreaded, meaning
that more than one thread of execution (or thread) can execute in a single task at once.
A process comprises:
A private memory addresses space in which the process's code and data are stored.
An access token against which Windows NT makes security checks.
System resources such as files and windows (represented as object handles).
At least one threads to execute the code.

Gayan Sachith Kumara

Networking with Windows

10

A thread comprises:

A processor state including the current instruction pointer.

A stack for use when running in user mode.

A stack for use when running in kernel mode.

Since processes (not threads) own the access token, system resource handles, and address space, threads do
NOT have their own address spaces nor do they have their own access token or system resource handles.
Therefore, all of the threads in a process SHARE the same memory, access token, and system resources
(including quota limits) on a "per-process" rather than a "per-thread" basis. In a multithreaded program, the
programmer is responsible for making sure that the different threads don't interfere with each other by using
these shared resources in a way that conflicts with another thread's use of the same resource. (As you might
suspect, this can get a little tricky.)

Gayan Sachith Kumara

Networking with Windows

11

Task 1.5)
Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system. The
term also refers to the ability of a system to support more than one processor and/or the ability to allocate tasks
between them. There are many differences on this basic theme, and the definition of multiprocessing can vary
with setting, mostly as a function of how CPUs are defined (multiple cores on one die, multiple dies in one
package, multiple packages in one system unit, etc.).

Multiprocessing sometimes refers to the performance of multiple concurrent software processes in a system as
opposed to a single process at any one instant. However, the terms multitasking or multiprogramming are more
appropriate to describe this concept, which is implemented mostly in software, whereas multiprocessing is more
appropriate to describe the use of multiple hardware CPUs. A system can be both multiprocessing and
multiprogramming, only one of the two, or neither of the two of them

Processor symmetry
Instruction and data streams

Processor symmetry: In a multiprocessing system, all CPUs may be equal, or some may be reserved for special
purposes. A combination of hardware and operating system software design considerations determine the
symmetry (or lack thereof) in a given system. For example, hardware or software considerations may require
that only one particular CPU respond to all hardware interrupts, whereas all other work in the system may be
distributed equally among CPUs; or execution of kernel-mode code may be restricted to only one particular CPU,
whereas user-mode code may be executed in any combination of processors. Multiprocessing systems are often
easier to design if such restrictions are imposed, but they tend to be less efficient than systems in which all CPUs
are utilized.
Systems that treat all CPUs equally are called symmetric multiprocessing (SMP) systems. In systems where all
CPUs are not equal, system resources may be divided in a number of ways, including asymmetric
multiprocessing (ASMP), non-uniform memory access (NUMA) multiprocessing, and clustered multiprocessing.

Instruction and data streams: In multiprocessing, the processors can be used to execute a single sequence of
instructions in multiple contexts (single-instruction, multiple-data or SIMD, often used in vector processing),
multiple sequences of instructions in a single context (multiple-instruction, single-data or MISD, used for
redundancy in fail-safe systems and sometimes applied to describe pipelined processors or hyper-threading), or
multiple sequences of instructions in multiple contexts (multiple-instruction, multiple-data or MIMD).

Processor coupling: Tightly-coupled multiprocessor systems contain multiple CPUs that are connected at the
bus level. These CPUs may have access to a central shared memory (SMP or UMA), or may participate in a
memory hierarchy with both local and shared memory (NUMA).
The IBM p690 Regatta is an example of a high end SMP system. Intel Xeon processors dominated the
multiprocessor market for business PCs and were the only major x86 options until the release of AMD's Opteron
range of processors in 2004. Both ranges of processors had their own onboard cache but provided access to
shared memory; the Xeon processors via a common pipe and the Opteron processors via independent pathways
to the system RAM.
Chip multiprocessors, also known as multi-core computing, involves more than one processor placed on a single
chip and can be thought of the most extreme form of tightly-coupled multiprocessing. Mainframe systems with
multiple processors are often tightly-coupled.
Loosely-coupled multiprocessor systems are based on multiple standalone single or dual processor commodity
computers interconnected via a high speed communication system (Gigabit Ethernet is common).
Gayan Sachith Kumara

Networking with Windows

12

A Linux Beowulf cluster is an example of a loosely-coupled system. Tightly-coupled systems perform better and
are physically smaller than loosely-coupled systems, but have historically required greater initial investments
and may depreciate rapidly; nodes in a loosely-coupled system are usually inexpensive commodity computers
and can be recycled as independent machines upon retirement from the cluster. Power consumption is also a
consideration. Tightly-coupled systems tend to be much more energy efficient than clusters. This is because
considerable economy can be realized by designing components to work together from the beginning in tightlycoupled systems, whereas loosely-coupled systems use components that were not necessarily intended
specifically for use in such systems.

Operating System Support: Each processor in a multiprocessor is capable of executing work independently of
the others. Separate, independent threads may be dispatched, one per processor, and run in parallel. Only one
copy of the Windows 2000 operating system is running, controlling what runs on all the processors. From a
performance monitoring perspective, you will see multiple instances of the processor object reported in both
Task manager and System Monitor.
The specific type of multiprocessor support offered beginning in Windows NT 4.0 is known as symmetric
multiprocessing, often abbreviated as SMP. Symmetric in this context, means that every thread is eligible to
execute on any processor. Prior to NT 4.0, Windows NT supported only asymmetric multiprocessing. In an NT
3.5x machine, interrupts could only be processed on CPU 0. CPUs 1, 2, 3, could only run user and kernel code,
never interrupt service routines (ISRs) and Deferred Procedure Calls (DPCs). This asymmetry ultimately limits the
scalability of NT 3.5x multiprocessor systems, because the CPU 0 engine is readily overloaded under some
workloads while the remaining microprocessors are idling. In an SMP, in theory, all the microprocessors should
run out of capacity at the same time. One of the key development projects associated with the NT 4.0 release
was changes to the kernel to support SMPs. In addition, the development team fine-tuned the OS code to run
much better in a multiprocessing environment. (Later in this chapter, we discuss some of the coding techniques
that are appropriate in a multiprocessing environment.) Windows 2000 also incorporates further improvements
inside the operating system to boost performance on large n-way multiprocessor configurations.

Thread scheduling: Since multiple programs are loaded in Windows 2000 memory anyway, it seems like it
should be a relatively simple matter for Windows 2000 to run two (or three or four or eight) programs at a time.
Unfortunately, shared-memory and coordination issues associated with the need to maintain cache coherence
make things considerably more complicated. Even though the separate processors operate largely
independently of each other, there are some occasions where the hardware must communicate and coordinate.
There are also times when it is necessary to prevent multiple independent processors from running in parallel.
Indeed, shared memory multiprocessors require some mechanism to ensure that threads execute serially as
they access and update global shared-memory data structures. A brief look at how the Windows 2000 Scheduler
works in a multiprocessor configuration will illustrate the data integrity concerns. It will also serve both to
highlight the cache coherence problem and put the performance implications of multiprocessing into
perspective.
The Windows 2000 OS kernel is multithreaded, which means it is capable of working in parallel if the hardware is
available. During installation, the presence of a multiprocessor is detected and a multiprocessing version of
ntoskrnl.exe, the OS kernel, is loaded. During OS initialization, about 20 additional kernel threads are allocated
for each additional processor that is detected. Windows 2000 internal data structures provide native support for
up to 32 processing engines. Meanwhile, Windows 2000 maintains a single copy of the Scheduler's dispatching
queue for ISRs, DPCs, and kernel and normal program threads that is shared across all processors. There is only
one Dispatcher Ready Queue, even on a multiprocessor.

Gayan Sachith Kumara

Networking with Windows

13

Processor affinity: Logically, the structure of the Ready Queue and the relative priority of threads waiting to
execute is identical whether Windows 2000 is executing on an single processor or on multiple processors. The
main difference is that multiple threads can run concurrently on a multiprocessor, a little detail that leads to
many complications. In the regular course of events, the Windows 2000 Scheduler selects the highest priority
waiting thread to run on each available processor. In addition, certain execution threads may have an affinity to
execute on specific processors. Windows 2000 supports both hard affinity, where a given thread is eligible to
run only on specific processors, and soft affinity, where Windows 2000 favors scheduling specific threads on
specific processors, usually for performance reasons.
Hard affinity is specified at the process and thread level using a processor affinity mask. The Win32 API calls to
accomplish this are straightforward. First, a thread issues a Get Process Affinity Mask call referencing a process
handle, which returns a 32-bit System Affinity Mask. Each bit in the System Affinity Mask represents a
configured processor. Then, the program calls Set Process Affinity Mask with a corresponding 32-bit affinity
mask that indicates the processors that threads from the process can be dispatched on. Figure 5-4 illustrates the
use of this function in Task man, which allows you to set a process's affinity mask dynamically, subject to the
usual security restrictions that allow Task man to operate only on foreground-eligible processes by default.
There is a corresponding Set Thread Affinity Mask call to override the process settings for specific threads. Once
hard affinity is set, threads are eligible to be dispatched only on specific processors. This chapter concludes with
a section discussing when setting a processor affinity mask for certain applications can be very desirable for
performance reasons. Along the way, it is necessary to tackle several related multiprocessing topics to consider
this important configuration and tuning strategy.
Figure 5-4. Setting a process's processor affinity mask using Task man

Suppose that following an interrupt, an application program thread becomes ready to run, and multiple
processors are idle. First, Windows 2000 must select the processor on which to run the ready thread. This
decision is based on performance. If the thread was previously dispatched within the last Scheduler quantum
(you remember the Scheduler time-slice quantum, don't you?), Windows 2000 attempts to schedule the thread
on that processor, which works as long as the current thread has a higher priority than the thread that is already
running there or the ideal processor happens to be idle. This is known as soft affinity. By scheduling the thread
back on the same processor where it just ran, Windows 2000 hopes that a good deal of the thread's code and
data from the previous execution interval are still present in that processor's cache. The difference in instruction
execution rate between a cache "cold start," when a thread is forced to fault its way through its frequently
accessed code and data, and a "warm start," when the cache is preloaded, can be substantial. However,
Windows 2000 is willing to schedule the waiting thread on a different processor if the desired processor is busy
with a higher-priority task.

Gayan Sachith Kumara

Networking with Windows

14

Serialization and locking: The Scheduler code in Windows 2000 can run in multiple threads concurrently.
Therefore, Windows 2000 must ensure that two processors do not try and run the same ready thread at the
same time. This is just one example of a more general integrity issue in a multiprocessor. Because sharedmemory data structures can be accessed by multiple threads concurrently, a serialization or locking mechanism
is necessary to ensure that independent processors do not, for example, select the same thread off the Ready
Queue at the same time. To prevent this, the shared-memory locations associated with the Windows 2000
Scheduler's dispatching queue are locked so that threads are only added or removed from the Ready Queue one
at a time. We look at this serialization mechanism more closely in a moment. Serialization services are one of
the key functions performed by the Windows 2000 operating system. (The current fashion in OS design is that
about the only function performed in the low-level operating system microkernel is serialization. That is how
fundamental serialization and locking are!) Windows 2000 must ensure that kernel threads running on multiple
processors serialize before accessing its shared internal data structures. Windows 2000 also provides
serialization services to application programs with similar requirements.

Shared-memory multiprocessor programming model: One reason shared-memory multiprocessors are so


popular is that, with minor exceptions, programs that run on uniprocessors can run unmodified on sharedmemory multiprocessors. In additionally, almost any multithreaded application will likely benefit from having a
choice of processors to run on--any thread can run on any available processor in an SMP. However, extreme
care must be exercised to prevent multiple threads in your application from accessing and changing shared data
structures in parallel. To help developers, the Windows 2000 operating system provides a complete set of
platform-independent serialization services, courtesy of the HAL, for use by both application programs and
kernel mode drivers. These thread synchronization services are used to ensure that Windows 2000 applications
are "thread-safe," i.e., capable of executing correctly on a multiprocessor. This set of thread synchronization
services allows programmers to implement complex, multithreaded applications without having to understand
the underlying hardware mechanisms on a multiprocessor, which are platform-specific. Understanding the
performance ramifications of shared-memory multiprocessors does require some knowledge of the hardware

Gayan Sachith Kumara

Networking with Windows

15

You might also like