A process control block or PCB is a data structure (a table) that holds information about a process. Every process or program that runs needs a PCB. When a user requests to run a particular program, the operating system constructs a process control block for that program. It is also known as Task Control Block (TCB). It contains many pieces of information associated with a specific process i.e. it simply serves as the respiratory for any information that may vary from process to process. The process control block typically contains:
- An ID number that identifies the process
- Pointers to the locations in the program and its data where processing last occurred
- Register contents
- States of various flags and switches
- Pointers to the upper and lower bounds of the memory required for the process
- A list of files opened by the process
- The priority of the process
- The status of all I/O devices needed by the process
Fig: Process Control Block
The information stored in the Process Control Block in given below:
- Process State: The state may be new, ready, running, and waiting, halted, and so on.
- Program Counter: the counter indicates the address of the next instruction to be executed for this process.
- CPU register: The registers vary in number and type, depending on the computer They include accumulator, index registers, stack pointers, and general-purpose registers. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward.
- CPU Scheduling information: This information includes a process priority, pointers to scheduling queues, and other scheduling parameters.
- Memory management information: this information includes the value of the base and limit registers, the page table, or the segment tables, depending on the memory system used by the OS.
- Accounting information: This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers and so on.
- I/O status information: This information includes the list of I/O devices allocated to the process, a list of open files and so on.