Process Table and Process Control Block (PCB)

While creating a process the operating system performs several operations. To identify these process, it must identify each process, hence it assigns a process identification number (PID) to each process. As the operating system supports multi-programming, it needs to keep track of the all the processes. For this task, the process control block (PCB) is used to track the process’s execution status. Each block of memory contains information about the process state, program counter, stack pointer, status of opened files, scheduling algorithms, etc. All these information is required and must be saved when the process is switched from one state to another. When the process made transitions from one state to another, the operating system must update information in the process’s PCB.

A process control block (PCB) contains information about the process, i.e. registers, quantum, priority, etc. The process table is an array of PCB’s, that means logically contains a PCB for all of the current processes in the system.

 

 

 

§  Pointer – It is a stack pointer which is required to be saved when the process is switched from one state to another to retain the current position of the process.

§  Process state – It stores the respective state of the process.

§  Process number – Every process is assigned with a unique id is known as processed which stores the process identifier.

§  Program counter – It stores the counter which contains the address of the next instruction that is to be executed for the process.

§  Register – These are the CPU registers which includes: accumulator, base, registers and general purpose registers.

§  Memory limits – This field contains the information about memory management system used by operating system. This may include the page tables, segment tables etc.

§  Open files list – This information includes the list of files opened for a process.

 

Miscellaneous accounting and status data

 

This field includes the information about the amount of CPU used, time constraints, jobs or process number, etc.
The process control block stores the register content also known as execution content of the processor when it was blocked from running. This execution content architecture enables operating system to restore a process’s execution context when the process returns to the running state. When the process made transitions from one state to another, the operating system update its information in the process’s PCB. Operating system maintains pointers to each process’s PCB in a process table so that it can access the PCB quickly.

 

 

 

Process Scheduler

There are three types of process scheduler.

1. Long Term or job scheduler It bring the new process to the ‘Ready State’. It controls Degree of Multi-programming, i.e., number of process present in ready state at any point of time.

 

2. Short term or CPU scheduler

.

It is responsible for selecting one process from ready state for scheduling it on the running state. Note: Short term scheduler only selects the process to schedule it doesn’t load the process on running.


Dispatcher is responsible for loading the selected process by Short Term scheduler on the CPU (Ready to Running State) Context switching is done by dispatcher only. A dispatcher does following:


1) Switching context.


2) Switching to user mode


3) Jumping to the proper location in the newly loaded program.

 

3. Medium term scheduler It is responsible for suspending and resuming the process. It mainly does swapping (moving processes from main memory to disk and vice versa).

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above