A process control block (PCB) is the kernel data structure that represents one process in operating systems: it records the process identity, its state, the saved CPU registers, memory mappings, open resources and scheduling data. Also called a task control block, it is the single place where the kernel keeps everything needed to stop a process and later resume it exactly where it left off.
Within processes & scheduling, the PCB is the object that schedulers, interrupt handlers and system calls actually manipulate. A process exists, from the kernel’s point of view, only as long as its PCB exists, and every scheduling decision is ultimately a choice between PCBs waiting in queues.
What a process control block contains
A process control block groups several categories of information that the kernel must consult or update during the life of a process. The exact field list differs between kernels, but textbook descriptions and real implementations converge on the same core groups.
| Field group | Example contents | Used by |
|---|---|---|
| Identification | Process ID, parent process ID, user and group IDs | Signals, permissions, process tree |
| Process state | Running, ready, blocked, stopped, zombie | Scheduler and wait logic |
| CPU context | Program counter, stack pointer, general registers, flags | Context switch code |
| Scheduling data | Priority, nice value, time slice, accumulated CPU time | Scheduler |
| Memory management | Page table base, address space descriptor, limits | Memory manager, MMU setup |
| Resource accounting | Open file table, signal handlers, working directory | System calls, I/O subsystem |
| Queue links | Pointers to run queue, wait queue and sibling entries | Kernel list management |
Two groups matter most for correctness. The saved CPU context lets the kernel reload registers so execution continues at the right instruction, and the memory management pointer ensures the process sees its own virtual address space after a switch. If either were stored incorrectly, the resumed process would run with corrupted state.
How the PCB enables a context switch
A context switch is the operation in which the kernel saves the CPU state of the current process into its PCB and loads the state of another process from that process’s PCB. The PCB therefore acts as the persistent snapshot of a paused execution.
- A timer interrupt, system call or blocking I/O request transfers control to the kernel.
- The kernel stores the program counter, stack pointer and registers in the current PCB.
- The process state in the PCB changes, for example from running to ready or blocked.
- The scheduler selects the next PCB from the run queue according to its policy.
- The kernel switches the address space and restores the saved registers of the chosen process.
- Execution returns to user mode at the instruction recorded in the restored context.
The cost of this sequence is pure overhead: no useful application work happens while registers are saved and restored. On modern hardware a switch typically takes from about one to several microseconds, but the indirect cost is often larger, because caches and the translation lookaside buffer lose locality when a different address space becomes active.
Process control blocks in real kernels
No production kernel uses a structure formally named PCB; each has its own implementation of the concept. The structures are much larger than textbook diagrams suggest, because they also carry security, tracing and namespace information.
| Kernel | Structure | Notable design point |
|---|---|---|
| Linux | task_struct | One structure per task; threads and processes share the same type |
| Windows NT | EPROCESS and ETHREAD | Process and thread data are split into separate objects |
| FreeBSD | struct proc and struct thread | Per-process and per-thread state are separated |
| XNU (macOS) | Mach task and BSD proc | Mach and BSD layers each keep their own view |
In Linux, task_struct occupies several kilobytes and is allocated from a dedicated slab cache. Because Linux represents every thread as a task, threads of one process are distinct entries that share memory and file tables by reference rather than by copying them.
PCB compared with related structures
The process control block is often confused with neighboring kernel objects. The distinction is about granularity and ownership: some state belongs to the whole process, some to each thread and some to the CPU itself.
| Structure | Describes | Relationship to the PCB |
|---|---|---|
| Thread control block | One thread: registers, stack, thread state | Several per PCB in multithreaded processes |
| Page table | Virtual to physical address mappings | Referenced from the PCB memory fields |
| File descriptor table | Open files, sockets and pipes | Pointed to by the PCB, may be shared |
| Run queue | Processes ready to execute on a CPU | Contains links to PCBs or thread entries |
| Kernel stack | Call frames while in kernel mode | Allocated per thread, located through the PCB |
In a multithreaded design, the thread control block holds the CPU context, while the PCB keeps the shared address space and resources. The scheduler then dispatches threads, and the process state shown to users is derived from the states of its threads.
The PCB across the process lifecycle
The PCB is created when a process is created and destroyed only after its parent has collected the exit status. Each lifecycle event leaves a visible trace in its fields.
| Event | Change to the PCB | Consequence |
|---|---|---|
| Creation by fork | New PCB copied from the parent, new process ID | Child process inherits resources |
| Dispatch | State set to running, context loaded | Process uses the CPU |
| Blocking I/O | State set to blocked, moved to wait queue | CPU is given to another process |
| Preemption | Context saved, state set to ready | Process returns to the run queue |
| Exit | State set to zombie, resources released | Parent must read the exit status |
| Reaping | PCB freed | Process ID can be reused |
The zombie state shows why the PCB can outlive the program: a minimal PCB stays in memory to hold the exit code until the parent calls a wait function. If the parent dies first, the child becomes an orphan process and is adopted by init or a subreaper, which reaps it later.
Limitations and common misconceptions
Because the PCB is central, several misconceptions and engineering limits surround it. Understanding them helps when diagnosing performance problems or reading kernel documentation.
- The PCB does not contain the program code. It only points to the address space where code and data reside.
- Process tables are finite. Limits such as the maximum number of process IDs mean a fork bomb can exhaust PCB slots before memory runs out.
- PCB access must be synchronized. On multiprocessor systems, kernels protect fields with locks or read-copy-update to avoid races.
- Large PCBs cost cache space. Frequently used fields are grouped together so a context switch touches fewer cache lines.
- The PCB is a security boundary. Credentials stored in it decide access rights, so corrupting it is a classic privilege escalation target.
In simple terms
A process control block is like a bookmark plus a file folder for every running program. When the computer pauses one program to let another run, it writes down exactly where the first program stopped and what it was using.
Later, the computer opens that folder, restores everything and the program continues as if nothing happened. Without this record, multitasking would be impossible, because the system could not remember the half-finished work of each program.
A practical example
A systems administrator investigates a Linux build server where compilation jobs feel slow. Running a process listing shows dozens of compiler processes in the runnable state and a context switch rate of roughly 40,000 switches per second across eight cores.
Each switch saves registers into one task_struct and restores another, and the frequent changes of address space flush useful cache contents. The administrator reduces the parallel job count from 32 to 10, so fewer PCBs compete in the run queues.
The context switch rate falls by more than half and total build time drops from 22 minutes to about 17 minutes, showing that less scheduler churn produced more useful CPU time.