You are on page 1of 5

Process Control Block (PCB)

Introduction to PCB
A process control block (PCB) is a data structure used by computer operating systems to
store all the information about a process. It is also known as a process descriptor. When a
process is created (initialized or installed), the operating system creates a corresponding
process control block.Each process is represented in the operating system by a process
control block (PCB) also called a task control block.This specifies the process state that is
new, ready, running, waiting or terminated.

Process control block (PCB) is a data structure which is associated with any process and
provides all the complete information about that process. The process control block is "the
manifestation of a process in an operating system". Process control block is important in a
multiprogramming environment as it captures the information pertaining to the number of
processes running simultaneously.Process control block is used to define the process
state of any process.In other words, process control block refers to the states of the
processes.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 this
information is required and must be saved when the process is switched from one state to
another. When the process makes a transition 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.
Structure Of PCB
In multitasking operating systems, the PCB stores data needed for correct and efficient
process management.Status tables exist for each relevant entity, like describing memory,
I/O devices, files and processes.Memory tables, for example, contain information about
the allocation of main and secondary (virtual) memory for each process, authorization
attributes for accessing memory areas shared among different processes, etc. I/O tables
may have entries stating the availability of a device or its assignment to a process, the
status of I/O operations, the location of memory buffers used for them, etc.

Though the details of these structures are system-dependent, common elements fall in
three main categories:
● Process identification
● Process state
● Process control

Process identification data include a unique identifier for the process (almost invariably
an integer) and, in a multiuser-multitasking system, data such as the identifier of the
parent process, user identifier, user group identifier, etc. The process id is particularly
relevant since it is often used to cross-reference the tables defined above, e.g. showing
which process is using which I/O devices, or memory areas.

Process state data defines the status of a process when it is suspended, allowing the OS
to restart it later. This always includes the content of general-purpose CPU registers, the
CPU process status word, stack and frame pointers, etc. During the context switch, the
running process is stopped and another process runs. The kernel must stop the execution
of the running process, copy out the values in hardware registers to its PCB, and update
the hardware registers with the values from the PCB of the new process.

Process control information is used by the OS to manage the process itself.The following
are the various information that is contained by the process control block:

● Naming the process


● State of the process
● Resources allocated to the process
● Memory allocated to the process
● Scheduling information
● Input / output devices associated with process
Role Of PCB
The role of the PCBs is central in process management: they are accessed and/or
modified by most utilities, particularly those involved with scheduling and resource
management.The role or work of process control block (PCB) in process management is
that it can access or modified by most OS utilities including those are involved with
memory, scheduling, and input / output resource access.It can be said that the set of the
process control blocks give the information of the current state of the operating system.
Data structuring for processes is often done in terms of process control blocks. For
example, pointers to other process control blocks inside any process control block allows
the creation of those queues of processes in various scheduling states.Such as:
● At any instance, a process will have various information associated with it like
identifier, state, priority, program counters, memory pointers, accounting information
etc. Such information is stored in a data structure called Process Control block
(PCB).
● It is an important tool that helps the OS support multiple processes and provide for
multiprocessing.
● It contains sufficient information such that if an interrupt occurs, the process can
begin from the point where it left later as if nothing had happened.
● The blocks are read and/or modified by every module in the OS including
Scheduling
Resource allocation
Interrupt processing
Performance monitoring and analysis
● It can be said that the process control block defines the state of the OS.
● However, there comes the issue of Security; a bug in a single routine says the
interrupt handler could damage the PCB which in turn can make it difficult for the
OS to manage the affected process.
● Changes made to the Process control block (like semantics or design changes) can
affect various modules.

Location of PCB
The PCB must be kept in an area of memory protected from normal process access. In
some operating systems the PCB is placed at the beginning of the kernel stack(The kernel
stack is part of the kernel space. Hence, it is not directly accessible from a user process.
Whenever a user process uses a syscall, the CPU mode switches to kernel mode. During
the syscall, the kernel stack of the running process is used.The size of the kernel stack is
configured during compilation and remains fixed.) of the process.The process control
block is kept in a memory area that is protected from normal user access. This is done
because it contains important process information. Some of the operating systems place
the PCB at the beginning of the kernel stack for the process as it is a safe location.PCB is
mostly stored as a per-process kernel stack which is in the kernel space and kernel has
access to this which is kept protected from any users.
Contents Of PCB

● Process State–new, ready, running, waiting, dead.indication of the process states


as ready, blocked or waiting etc.As we know that the process state of any process
can be New, running, waiting, executing, blocked, suspended, terminated. For more
details regarding process states you can refer to process management of an
Operating System.

● Process Number (PID)–unique identification number for each process (also known
as Process ID) identification of the process distinctly as process id.

● Program Counter (PC)–A pointer to the address of the next instruction to be


executed for this process.it is a register containing the address of next instruction to
be executed for this process.Program counter is used to point to the address of the
next instruction to be executed in any process. This is also managed by the
process control block.

● CPU Registers–Register set where process needs to be stored for execution for
running state.a group of registers through accumulator index register, GPR reflects
the path of execution of this process.his information is comprising the various
registers, such as index and stack that are associated with the process. This
information is also managed by the process control block.
● CPU Scheduling Information–information scheduling CPU time. The details about
priority of process.Scheduling information is used to set the priority of different
processes. This is very useful information which is set by the process control block.
In the computer system there were many processes running simultaneously and
each process had its priority. The priority of the primary feature of RAM is higher
than other secondary features. Scheduling information is very useful in managing
any computer system.

● Memory Management Information–page table, memory limits, segment table.the


details such as the allocated CPU time, process numbers etc.This section of the
process control block comprises page and segment tables. It also stores the data
contained in base and limit registers.

● Accounting Information–amount of CPU used for process execution, time limits,


execution ID etc.This section of the process control block stores the details related
to central processing unit (CPU) utilization and execution time of a process.

● I/O Status Information–list of I/O devices allocated to the process.details of


allocated devices for this process , a list of opened files etc.This section of process
control block stores the details pertaining to resource utilization and file opened
during the process execution.

You might also like