Page 355 - DCAP103_Principle of operating system
P. 355

Principles of Operating Systems



                   Notes
                                     Figure 12.2: The Relationship Between Jobs, Processes and Threads. Several Fibers
                                                  can also be Multiplexed on One Thread (not shown)




























                                 Although  we  will  not  discuss  it  in  much  detail,  Windows  2000  is  capable  of  running  on
                                 a  symmetric  multiprocessor  system.  This  requirement  means  that  the  operating  system
                                 code  must  be  fully  reentrant,  that  is,  every  procedure  must  be  written  in  such  a  way  that
                                 two  or  more  CPUs  may  be  changing  its  variables  at  once,  without  causing  problems.  In
                                 many  cases,  this  means  that  code  sections  have  to  be  protected  by  spin  locks  or  mutexes
                                 to  keep  additional  CPUs  at  bay  until  the  first  one  is  done  (i.e.,  serialize  access  to  critical
                                 regions).  The  number  of  CPUs  the  system  can  handle  is  governed  by  the  licensing
                                 restrictions. There is no technical reason why Windows Professional cannot run on a
                                 32-node multiprocessor, it is the same binary as Datacenter Server, after all.

                                 The upper limit of 32 CPUs is a hard limit because word-length bitmaps are used to keep track
                                 of CPU usage in various ways. For example, one word-length bitmap keeps track of which of the
                                 (up to) 32 CPUs are currently idle, and another bitmap is used per process to list the CPUs this
                                 process is permitted to run on. The 64-bit version of Windows 2000 should be able to effortlessly
                                 support up to 64 CPUs; beyond that requires actually changing the code substantially (to use
                                 multiple words for the bitmaps).
                                 12.1.2 Job, Process, Thread and Fiber Management API Calls

                                 New processes are created using the Win32 API function CreateProcess. This function has
                                 10 parameters, each of which has many options. This design is clearly much more complicated
                                 than the UNIX scheme, in which fork has no parameters, and exec has just three: pointers to the
                                 name of the file to execute: the (parsed) command line parameter array, and the environment
                                 strings. Roughly speaking, the 10 parameters to CreateProcess are as follows:
                                    1.  A pointer to the name of the executable file.
                                    2.  The command line itself (unparsed).

                                    3.  A pointer to a security descriptor for the process.
                                    4.  A pointer to a security descriptor for the initial thread.
                                    5.  A bit telling whether the new process inherits the creator’s handles.

                                    6.  Miscellaneous flags (e.g., error mode, priority, debugging, consoles).




        348                               LOVELY PROFESSIONAL UNIVERSITY
   350   351   352   353   354   355   356   357   358   359   360