Diagram of a Process Control Block (PCB)
- a data structure used in the OS code to represent one process
- the set of PCB’s is called the process table
- if an array is used to represent the process table, the index of the array may give the process id
- if a linked list is used to represent the process table, as shown below, the first field of each process control block may give the link to the next process control block
Pointer |
Process State |
Process Number (also called Process Id) |
CPU-Scheduling Info |
Program Counter |
Processor Status |
Registers |
Memory Management Info |
Open Files or Other I/O Status Information |
Accounting Info |
Pointer |
Process State |
Process Number (also called Process Id) |
CPU-Scheduling Info |
Program Counter |
Processor Status |
Registers |
Memory Management Info |
Open Files or Other I/O Status Information |
Accounting Info |
This example PCB contains:
- pointer: pointer to the next PCB
- process state: new, ready waiting, etc., which is used by the CPU scheduler
- process number: a unique identifier for the process
- CPU-scheduling info: process priority and pointers to scheduling queues or other scheduling parameters (depends on type of scheduling used)
- program counter (PC): indicates the address of the next instruction to be executed for this process (corresponds to a specialized register in the CPU)
- processor status (PS): indicates the status of the CPU after the most recent instruction was executed (corresponds to a specialized register in the CPU)
- registers: vary in number and type depending on machine architecture, but are likely to include general purpose registers (good for integers and addresses) and floating point registers.
- memory management info: information about memory assigned to the process, such as the values of the base and limit registers and pointers to the segment or page tables.
- open files or other I/O status info: stores pointers to files and devices that the process is currently using
- accounting info; CPU time and real (clock time) used by the process