Process Control Block (PCB) Explained

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

FieldWhy the OS needs it
Program counterExactly which instruction to resume at, next time this process runs
CPU registersThe exact working values the process had when it was last paused
Process stateWhich of the five states (covered in the previous note) it's currently in
Memory infoWhich 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.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.