What is a Process Control Block (PCB)?
Interview preparation resource from Gate Smashers.
A Process Control Block (PCB) is a kernel-maintained data structure that represents a process and stores the information the operating system needs to manage it. It typically includes the process’s identity, state, scheduling information, memory-management information, resource references, and saved execution context needed when the process is stopped and later resumed.

Purpose
The operating system creates and maintains a PCB for each process. It uses this record to track the process throughout its lifetime, including creation, scheduling, blocking for an event or I/O, and termination.
The exact PCB layout is operating-system-specific. In systems that schedule threads independently, some execution-context and scheduling information may be kept in a separate thread control block rather than solely in the process PCB.
Typical information in a PCB
A PCB commonly contains references to information required for process management. Some data may be stored directly in the PCB, while other data is held in related kernel structures.
- Identity and state: A process identifier and the current state, such as ready, running, waiting, or terminated.
- Execution context: Saved CPU register values, including the program counter or instruction pointer, so execution can continue at the correct instruction.
- Scheduling information: Priority, scheduling policy or class, and runtime information used by the scheduler.
- Memory-management information: References to structures that describe the process address space, such as page tables or memory maps.
- Resource and I/O information: References to open files, devices, pending I/O, and other resources owned or used by the process.
- Accounting and relationships: Resource-usage data, credentials or limits, and links to related processes where supported by the operating system.
Role in scheduling and context switching
When the operating system switches the CPU from one runnable execution context to another, it saves the outgoing context and restores the incoming context. The PCB, or associated thread-level structures, provides the kernel with the information needed for this operation.
The scheduler consults process- or thread-related state and scheduling fields to select a runnable task. The kernel then restores the selected task's saved context and marks it as running.
- Save: Save the outgoing execution context and update its state and accounting information.
- Select: Choose a runnable task according to the system's scheduling policy.
- Restore: Restore the selected task's execution context and resume it.
Kernel storage
PCBs are kernel data structures and are protected from direct modification by ordinary user programs. Operating systems organize them using process tables and scheduling or wait queues, with the exact organization depending on the implementation.
Their size, fields, and relationships with other kernel structures vary by operating system and hardware architecture.
