Understanding Process Control Block in Operating Systems
For Complete YouTube Video: Click Here
We will try Understanding Process Control Block in Operating Systems in this class.
We have already discussed the concept process state diagram in our previous class.
Understanding Process Control Block in Operating Systems
The Process Control Block is a data structure to store the information of a process.
To understand this concept, we will consider the image shown below.
In the above image, we have three processes, P1, P2, and P3 are getting executed.
Assume that P1 is in the Running State and P2 and P3 are in the ready state.
As the time quantum for the P1 process completes, another process will come into a running state.
For example, assume that while executing the 10 instructions, P1 completed its time quantum and will get switched to the ready state.
Before switching the process, the operating system must remember to execute the next instruction.
So the operating system must store specific process attributes. Those attributes are stored in the process control block.
The attributes maintained in the process control block are.
- Process Number
- Process State
- Program Counter
- Priority
- Registers
- List of Open files
- List of Open Devices
Process Number: Every process in the execution is given a unique number for identification. That number is called the process number or process ID.
Process State: The state in which the process [New, Ready, Running, Terminate, Wait, Suspend Ready, Suspend Wait] is will also get maintained in the Process Control Block.
Program Counter: Next instruction to be executed should be maintained.
Priority: Each process will have a particular importance based on which the process will get executed. The process’s priority number will get maintained in the process control block.
Registers: While the process executes, the values of the variables in the instructions are stored in the general-purpose registers of the CPU. The details of the general-purpose registers are also maintained in the Process Control Block.
List of Open Files: A process will open other files in the execution process. The list of files the process opens is stored in the process control block.
List of Open Devices: Similar to the list of open files, the details of the list of devices opened by the process are also stored in the process control block.