PCB is a data structure used by operating system to store all the information about a process.
It is also known as process descriptor.
When a process is created, the operating system creates a corresponding process control block.
Information in a process control block is updated during the transition of process states.
When the process terminates, its PCB is released to the pool of free cells from which new PCBs are drawn.
Each process has a single PCB.
The PCB of a process contains the following information about the process.
§ Process Id
§ Process State
§ Process Priority
§ Pointer to Parent Process
§ Pointer to child Process
§ Program Counter
§ CPU Registers
§ Memory Management Information
§ I/O status Information
§ File Management Information
§ Accounting Information
§ Each process is allocated a unique number for the purpose of identification.
§ It specifies the current state of a process.
§ A process can be in new, running, ready, waiting or terminated state.
§ Each process has a priority implemented in terms of numbers.
§ The higher priority has precedence over lower priority processes.
Pointer to parent process:
§ A new process can be created from an existing process.
§ The existing process is called the parent process.
§ This field stores the address of PCB of parent process.
Pointer to child process:
§ This field indicates the address of PCB of a child process created from an existing process.
§ The counter indicates the address of next instruction to be executed.
§ The number and type of registers vary with the architecture of computer.
§ The registers usually hold the data to be processed, the results of calculations.
§ These registers can be index registers, accumulator, general purpose registers and various status flags.
§ Whenever the processor switches from one process to other the content of these registers is saved so that a process can be resumed correctly later on.
Memory Management Information:
§ A PCB also stores information such as amount of memory units allocated to a process, the addresses of the memory areas or chunks allocated, value of page tables, segment tables etc.
I/O staus Information:
§ Information such as the I/O devices allocated to the process, pending I/O tasks etc.
File Management Information:
§ Information such as the number of open files, list of open files and the access rights of the files open such as read only, write etc.
§ This information includes the amount of CPU and real time used time limits etc.