Process Control Block (PCB)

There are different attributes of a process. These attributes are stored in the Program Control Block (PCB). An integer, Process ID (PID) is used to represents the PCB. This is also known as the context of the process. OS manages and uses these attributes from the PCB of each process.

PCB is a data structure. Every process has its own PCB. PCB keeps all the information of a process. This information is required by that process during its execution.

The architecture of a process control Block is totally dependent on OS. It may hold different information in different operating systems. Have a look at the PCB diagram

Process Attributes in PCB

1. Process ID

When a new process is created, then a unique ID is assigned to it. It is used for its unique identification in the system.

2. Process State

The Process, from its creation to its termination, passes through various states, i.e., new, ready, running and waiting, etc. Explanation will be in upcoming lectures.

3. Process Permission

PCB also holds information like allowing or disallowing the system resources. Allow and disallow are the system resources.

4. Pointer

A pointer to the parent process.

5. Priority

Each process has its own priority. Some processes have higher priority, but some have lower priority, i.e., Interrupts have higher priority.  Execution of higher priority processes is first as compared to lower priority processes.

6. Program Counter (PC)

PC is a CPU register. CPU uses it when it resumes the execution of a process. Because the PC stores the address of the last instruction of the process from where the process was suspended.

7. CPU Registers

CPU registers store the values of different states of the running process. Every process contains its own registers. A register can hold an instruction, a storage address, or any kind of data. The most common registers are,

i. instruction register (IR)
ii. memory buffer register (MBR)
iii. memory data register (MDR)
iv. memory address register (MAR)

8. CPU Scheduling Information

PCB also holds the information on CPU scheduling algorithms. Some scheduling algorithms are FCFS, Priority, etc. We will discuss all these scheduling algorithms in later posts.

9. Memory Management Information

It holds information about memory, like memory limits, page tables, etc.

10. Accounting information

It includes the amount of time that a CPU uses for process execution, such as time limits.

11. I/O status information

It contains a list of I/O devices in a system. These devices are assigned to the running process.

Note: The PCB of a process is alive until the process termination.