Process Control Block (PCB)

A Process Control Block (PCB) is the data structure the OS kernel maintains for every process, holding everything needed to pause it and later resume it correctly. It typically stores the process ID, process state, program counter, CPU register values, scheduling information such as priority, memory management information, accounting data and the files and devices it has open.

4 min read

Every process the OS manages needs the kernel to remember a lot about it: exactly where it left off, what memory it owns, what files it has open. All of that bookkeeping lives in one data structure per process, called the Process Control Block, or PCB.

What a PCB actually contains

A PCB typically holds:

  • Process ID (PID): a unique identifier for this process.
  • Process state: new, ready, running, waiting, or terminated (see the separate Processes article for the full lifecycle).
  • Program counter: the address of the next instruction this process should execute when it's scheduled to run again.
  • CPU registers: the exact values of every CPU register this process was using, so execution can resume exactly where it left off.
  • CPU scheduling information: the process's priority, and pointers to whatever scheduling queue it's currently sitting in.
  • Memory management information: what memory this process owns, including page tables or segment tables (covered in the Memory Management topics).
  • Accounting information: how much CPU time and other resources this process has used.
  • I/O status information: which files and devices this process currently has open.

Why the PCB matters for context switching

When the OS switches the CPU from running Process A to running Process B, it has to save A's exact CPU register values (program counter included) into A's PCB before doing anything else, otherwise A's progress would be lost the instant the CPU moved on to something else. Then it loads B's previously-saved register values from B's own PCB back into the actual CPU, and only then does B's code actually resume executing, picking up exactly where it left off. The PCB is precisely what makes it possible to pause a process anywhere and resume it later with zero loss of correctness, because it's a complete, accurate snapshot of everything needed to reconstruct that process's exact execution state.

A concrete example

Suppose Process A is running and gets interrupted mid-instruction so the scheduler can give Process B a turn. The OS immediately copies A's current program counter and register values into A's PCB, updates A's state field from "running" to "ready", then finds B's PCB, loads B's saved register values and program counter back into the real CPU, updates B's state field to "running", and finally lets the CPU actually resume executing B's code. Later, when A gets scheduled again, the exact same process runs in reverse: A's saved values come back out of its PCB and into the CPU, and A continues exactly where it was interrupted, with no awareness that any time passed or any other process ran in between.

Where this matters in real systems

Every real operating system kernel maintains something functionally equivalent to a PCB for every process it manages, in Linux specifically, this structure is called task_struct, and it's genuinely enormous in practice, holding far more bookkeeping than the simplified list above (namespaces, security credentials, cgroup membership, and much more), but the core purpose is identical: a complete per-process record the kernel needs to correctly pause and resume that process.

What interviewers actually ask about the PCB

  • "What is a Process Control Block?" The data structure the OS kernel maintains per process, holding its state, register values, memory information, and resource ownership, everything needed to pause and correctly resume it.
  • "Why is the PCB essential for context switching?" Because switching the CPU from one process to another requires saving the current process's exact register state into its PCB and loading the next process's previously-saved state back into the CPU, with no PCB there'd be no way to correctly resume a paused process.
  • "What information does a PCB typically hold?" Process ID, state, program counter, CPU registers, scheduling info, memory info, accounting info, and I/O status, at minimum.
  • "What is Linux's real equivalent of a PCB called?" task_struct, a large kernel data structure holding a process's complete state, superset of the simplified textbook PCB fields.

Key takeaways

  • The PCB is the per-process data structure the kernel uses to track everything about that process.
  • It holds state, program counter, CPU register values, scheduling info, memory info, and resource ownership.
  • Context switching depends entirely on the PCB: saving the outgoing process's exact state into it, and restoring the incoming process's state from its own PCB.
  • Linux's real-world equivalent is called task_struct.
All 205 OS interview questions

Browse all Operating Systems topics

Log in to save which topics you've read across every subject.

Frequently asked questions

What is a Process Control Block?

The data structure the OS kernel maintains per process, holding its state, register values, memory information, and resource ownership, everything needed to pause and correctly resume it.

Why is the PCB essential for context switching?

Because switching the CPU from one process to another requires saving the current process's exact register state into its PCB and loading the next process's previously-saved state back into the CPU, with no PCB there'd be no way to correctly resume a paused process.

What information does a PCB typically hold?

Process ID, state, program counter, CPU registers, scheduling info, memory info, accounting info, and I/O status, at minimum.

What is Linux's real equivalent of a PCB called?

`task_struct`, a large kernel data structure holding a process's complete state, superset of the simplified textbook PCB fields.