What is the purpose of a process control block (PCB)?


Every process is represented in the operating system by a process control block also called a task control block.

A process control block (PSB) contains many pieces of information and it contains the attributes of a process.

Attributes of a process

The attributes of a process includes the following:

Process id

Every process is given some number. It may be either 16bit or 32 bit.

Program counter

It contains the next instruction that has to be executed.

Priority

Whenever a process is created, it is assigned with some priority. Processes which are having higher priority are executed first compared to processes which are having lower priority.

General purpose registers

Whenever you pre-empt and take the next process for execution, we should even make sure that the current state of the general purpose registers should be stored at some point so that when we come back again, the entire state of the general purpose registers are restored.

List of open files

We should know what the processes which open the files are. For a given file, what are the processes that opened it? For a given process what files it opened?

Because, whatever modifications we do on a file system it should be consistent. It reflects on the processes. We need to warn the other process which opened this file.

List of open devices −

These include printers and scanners.

Protection

The other processes should not get into your workspace and you should not get into other processes’ workspace.

PCBs are maintained in a linked list manner. By that we know how many processes are executing in a system and we can know the current status of the processes.

PCB gets updated while the process is executing. If a process is executing then that has to be read by the OS.

Process control block

Given below is the structure of the process control block (PCB) −

    Process state
Process number
Process counter
Register
Memory limits
List of open files
----------

Updated on: 30-Nov-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements