operating-systems

Definition

Process Control Block

The Process Control Block (PCB) is a data structure representing the execution context of a specific process. It serves as the repository for any information that may vary between processes and is used by the operating system to manage the process lifecycle.

The OS uses the PCB to “remember” the exact state of a process when it is interrupted (e.g., by a timeout or I/O request), allowing the process to be resumed later as if no interruption had occurred. This mechanism is central to creating the “illusion of parallelism.”

Components

The PCB typically contains:

  • Process Identification: Unique identifiers such as PID, Parent PID, and User ID.
  • Processor State: The context required to resume execution, including the program counter, general-purpose registers, stack pointer, and the Program Status Word.
  • Process Control Information:
    • Scheduling state: The current state in the process state model (ready, running, blocked).
    • Priority: Used by the scheduler to decide the next process to execute.
    • I/O status: Information about open file descriptors, assigned I/O devices, and pending I/O requests.
  • Memory Management: Pointers to page tables or segment tables defining the process’s address space.

Location

The PCB resides in kernel space and is a component of the process image. The set of all PCBs is indexed by the Process Table.