Describe the contents of a Process Control Block (PCB).
Process Control Block (PCB): All processes are represented in the operating system by a task control block or a process control block.
This contains many pieces of information connected with an exact process such as:
(1) Process state: The state may be new, ready and halted and running, and waiting and so on.
(2) Program counter: The counter shows the address of the next instruction to be executed for such process.
(3) CPU registers: The registers vary in number and category, depending upon the computer architecture. They contain accumulators, stack pointers, index registers and general- purpose registers, plus some condition-code information. With the program counter, this state information should be saved while and interrupt occurs, to permit the process to be continued properly afterward.
Figure: Process Control Block(PCB)
(4) CPU-scheduling information: This information contains a process priority, pointers to scheduling queues and other scheduling parameters.
(5) Memory-management information: This information may contain such information as the value of the base and limit registers and the page tables, or else the segment tables, depending upon the memory system utilized by the OS.
(6) Accounting information: This information contains the amount of CPU and real time utilized, and time limits, job or process numbers, account numbers and so on.
(7) I/O status information: The information contains the list of I/O devices allocated to such process, a list of open files etc.
The PCB only functions as the repository for any information which may vary from process to process.