Windows allows applications to contain multiple threads that can run independently. Each thread is allocated its own memory and resources by the Windows Kernel. The key components of a thread include a thread ID, register set, program counter, user and kernel stacks, and private storage. The primary data structures used to manage threads are the ETHREAD, KTHREAD, and TEB. The KTHREAD contains scheduling information and a pointer to the TEB, while the ETHREAD and KTHREAD exist in kernel space. The TEB contains thread-specific information like the ID and user stack.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
17 views
Operating Systems Examples Windows Threads
Windows allows applications to contain multiple threads that can run independently. Each thread is allocated its own memory and resources by the Windows Kernel. The key components of a thread include a thread ID, register set, program counter, user and kernel stacks, and private storage. The primary data structures used to manage threads are the ETHREAD, KTHREAD, and TEB. The KTHREAD contains scheduling information and a pointer to the TEB, while the ETHREAD and KTHREAD exist in kernel space. The TEB contains thread-specific information like the ID and user stack.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7
Operating Systems
Examples: Windows Threads
Introduction to Windows Threads o A Windows application runs as a separate process, and each process may contain one or more threads. The Windows APIs’ are used for creating threads. Additionally, Windows uses the one-to-one mapping , where each user-level thread maps to an associated kernel thread. o Windows threads are created by the Windows Kernel and are associated with a process. Each thread is allocated its own memory and resources, which allows it to execute independently from other threads. The threads are also managed by the Windows Kernel, allowing for efficient use of system resources. The general components of a thread o A thread ID uniquely identifying the thread o A register set representing the status of the processor o A program counter o 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 o A private storage area used by various run-time libraries and dynamic link libraries (DLLs) Threads Cont.. 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
• KTHREAD—kernel thread block • TEB—thread environment block Data Structures of Thread Data Structures of Thread • 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. • The ETHREAD and the KTHREAD exist entirely in kernel space; this means that only the kernel can access them. • 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-local storage. Thank You!!