Process Control Block (PCB) Explained
- Process Management
- Memory Management
- Deadlocks
- OS Introduction & Fundamentals
- CPU Scheduling Algorithms
- Threads & Concurrency
- Inter-Process Communication (IPC)
- Process Synchronization
- Virtual Memory & Paging
- File Systems
- Disk Scheduling
- I/O Management
The OS's Own Record Card for Each Process
A Process Control Block (PCB) is a data structure the operating system maintains for every single process, storing everything the OS needs to know to manage, pause, and later resume that process correctly.
What's Actually Stored Inside a PCB
Process Control Block
+-------------------------------------+
| Process ID (PID) |
| Process state (Ready, Running, ...) |
| Program counter (next instruction) |
| CPU register values |
| Memory management info |
| Open file list |
| Scheduling priority |
+-------------------------------------+Why Each Piece of Information Matters
| Field | Why the OS needs it |
|---|---|
| Program counter | Exactly which instruction to resume at, next time this process runs |
| CPU registers | The exact working values the process had when it was last paused |
| Process state | Which of the five states (covered in the previous note) it's currently in |
| Memory info | Which memory this process owns, and its boundaries |
Why the PCB Is Central to Context Switching
Every time the CPU switches from running one process to another (context switching, covered in the next note), the OS saves the outgoing process's current state into its PCB, and loads the incoming process's state from its own PCB - the PCB is exactly what makes it possible to pause a process and later resume it as if nothing had ever interrupted it.
The PCB as a Process's Complete Identity
In a very real sense, a process's PCB is how the operating system "knows" that process - everything the OS could ever need to know or do regarding a specific process is either stored directly in its PCB, or reachable through information the PCB points to.