Process Control Block (PCB)
PCB
- The data structure that contains the process elements
- Created and managed by the Operating System
- Allows support for multiple processes
It is the key tool that enables OS to support multiple processes and to provide for multiprocessing.
When a process is interrupted, the current values of the program counter and the processor registers (context data) are saved in the appropriate fields of the corresponding process control block, and the state of the process is changed to some other value, such as blocked or ready.
Varies between OSs ⇒ very small for embedded OS
Do you allow the user to manipulate the elements of the process control block?
Usually no, it contains sensitive information. But the user can read or write, for example set the priority of the process.
Role of PCB
It is the most important data structure in an OS. Contains all the information about a process that is needed by the OS. Difficulty of design lies in protection:
- A bug in a single routine, such as an interrupt handler, could damage process control blocks, which could destroy the system’s ability to manage the affected processes.
- A design change in the structure or semantics of the process control block could affect a number of modules in the OS.