Chapter 1: Large Contiguous Process Control Block Structure

Kernel Level Threads and Process Control Blocks

Definition of Kernel Level Threads

  • A kernel level thread is a thread managed by the operating system's kernel rather than by a user-space library.

  • Multiple kernel level threads can exist within a single process, allowing for more efficient execution and resource management.

Process Control Block (PCB) Overview

  • The Process Control Block is a data structure maintained by the operating system for each process.

  • It contains crucial information needed for process management and includes both shared and thread-specific data.

Shared Information
  • Certain information within the PCB is relevant for the entire process, which includes:

    • Virtual address mappings: This information is crucial for memory management across all threads in the process.

    • Other global attributes related to process execution.

Thread-Specific Information
  • Each kernel level thread has specific information that pertains only to that thread. Examples include:

    • Signals: Each thread may require different handling for signals (interrupts sent to the process).

    • System call arguments: Arguments for system calls can vary by thread, depending on the thread's current execution context.

Context Switching Among Kernel Level Threads

  • During context switching, the system rapidly saves and restores the state of a thread.

  • It is critical to preserve the shared information (e.g., virtual address mappings) while also ensuring the specific information for the executing kernel level thread is correctly managed.

Impact of Threading Library

  • The threading library used (e.g., POSIX Threads) directly impacts how information in the Process Control Block is structured and accessed.

Division of Process Control Block Information
  • The information contained in the original PCB is divided into two distinct categories:

    • Hard Process State: This state includes information relevant to all user level threads executing within the same process, essentially the global state of the process.

    • Lightweight Process State: This consists of data pertinent only to a specific subset of user level threads that are associated with a given kernel level thread.

Structural Changes to PCB
  • The process of dividing the PCB results in moving from a singular contiguous PCB structure to several separate data structures for better management of shared and thread-specific data.

  • This separation aims to optimize performance and facilitate smoother context switches among kernel level threads.