written 2.7 years ago by |
Solution:
Windows XP Threads:
Windows XP implements the Win32 API. The Win32 API is the primary API for the family of Microsoft operating systems (Windows 95, 98, NT, 2000, and XP).
A Windows XP application runs as a separate process, and each process may contain one or more threads.
Indeed, much of what is mentioned in this section applies to this entire family of operating systems.
Windows XP uses the one-to-one mapping described in win threads. , Windows XP also provides support for a fiber library, which provides the functionality of the many-to-many model.
By using, the thread library, any thread belonging to a process can access the address space of the process.
The general components of a thread include:
A register set representing the status of the processor.
A user stack, employed when the thread is running in user mode, and a kernel stack, employed when the thread is running in kernel mode.
A thread ID uniquely identifying the thread.
A private storage area used by various run-time libraries and dynamic link libraries (DLLs).
The register set, stacks, and private storage area are known as the context of the thread. The primary data structures of a thread include:
ETHREAD—executive thread block:
- The key components of the ETHREAD include a pointer to the process to which the thread belongs and the address of the routine in which the thread starts control.
KTHREAD—kernel thread block:
The KTHREAD includes scheduling and synchronization information for the thread.
In addition, the KTHREAD includes the kernel stack (used when the thread is running in kernel mode) and a pointer to the TEB.
TEB—thread environment block:
The TEB is a user-space data structure that is accessed when the thread is running in user mode.
Among other fields, the TEB contains the thread identifier, a user-mode stack, and an array for thread specific data (which Windows XP terms thread-local storage).
The structure of a Windows XP thread is illustrated in Figure.