Section 1.2. Processes, Process Context, and Threads

   

1.2 Processes, Process Context, and Threads

A process is an in-memory image of an executing program. A process is assigned a memory region that it owns for the duration of its existence. It may share code (dynamic link libraries) or data (shared memory regions ) with another process. A process is described by a process object maintained by the Object Manager. Data maintained within the process object includes virtual memory address space details, process priority, file handles, and memory allocation details, to name just a few.

In Windows NT, multiple processes can exist at the same time; however, only one of them is executing at a given moment on any CPU. Note that the drivers in general and the storage drivers in particular do not create a process of their own. The operating system creates some processes for its own purposes and other processes in response to user commands ”for example, when the user launches an application such as Microsoft Word or Microsoft Excel. When a driver is called while a particular process is executing, the driver is said to be running in the context of that process.

Process context may be defined as all the state information needed to track a process. This information includes the virtual memory used by the process, the CPU register values, and the various file and object handles, as well as various security tokens associated with the process. Process context is extremely important because a lot of data structures and resources, such as file handles and memory pointers, are relative to a particular process. For example, a file handle created in one process is invalid in another.

A thread is a subunit of a process; a process may have one or more threads. A thread shares the global data structures and address space of the process, but a thread also has its own private data. Switching between processes is an expensive task that involves saving the processor state to a process-specific data structure while also changing memory and CPU control registers. Switching between threads is very efficient because less data has to be saved.

Each thread has an associated thread object maintained by the object manager. Information contained within the object includes processor affinity (in a multi-CPU system, the CPU on which a thread prefers to run), thread state (e.g., whether the thread is running, is ready to run, or is blocked on an I/O,), and other thread features.

A thread may be a user mode thread or a kernel mode thread. Kernel mode threads can be created only by kernel mode entities, such as device drivers, and they always execute in kernel mode. A user mode thread usually executes in user mode, except when executing in kernel mode as a result of requesting an NT service, as mentioned in Section 1.1.


   
Top


Inside Windows Storage
Inside Windows Storage: Server Storage Technologies for Windows 2000, Windows Server 2003 and Beyond
ISBN: 032112698X
EAN: 2147483647
Year: 2003
Pages: 111
Authors: Dilip C. Naik

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net