1. Introduction

A computer system executes multiple programs simultaneously. This lets us achieve better throughput and user experience. The notion of running multiple programs is implemented by a process in the operating system.

In this tutorial, we’ll discuss the concept of a process control block (PCB), which contains useful information for a process to function.

2. Process Concept

A process is a program in execution. For instance, we can write a Java application and save it to the disk. This is considered a program and a passive entity. However, when we execute the program, the operating system creates a Java process. A process is an active entity while it’s under execution.


The preceding image represents a process with its components. On the left-hand side, we are displaying the memory – the text section starts from the lower memory offset. The heap and the stack section of the process can grow based on the memory requirement of the process.

3. Process Control Block

The process control block represents a process in the operating system. A PCB is also known as a task control block. It’s a repository of information associated with a specific process.

It contains various pieces of information like:

3.1.  Process State

The process state represents the state of the process in the operating system. A process can be in either of new, ready, running, waiting, or terminated status.

3.2. Program Counter

A process contains several instructions which are executed linearly by the CPU. A program counter (PC) indicates the address of the next instruction to be executed for this process.

3.3. CPU Registers

A register is a tiny bit of memory which can contain state information of a process. Registers can vary in their size and type based on the computer architecture. They include accumulators, index registers, condition-code information, general-purpose registers, and stack pointers, to name a few.

A CPU register stores the state information of a process if interruptions occur in the running process. This allows the process to continue when the scheduler schedules it to run again.

3.4. Additional Statistics

  • CPU-scheduling Information: A scheduler schedules a process for execution. It determines the criteria on which the CPU executes a process. A process contains several parameters such as process priority, scheduling queue information, and various other scheduling parameters
  • Memory-Management information: An executing process requires memory and needs to maintain several memory-related statistics. These include base and limit register information, page and segment tables, and so on
  • Accounting Information: Accounting information measures various bookkeeping data. The amount of CPU time used, time limits, account numbers, job or process numbers, and so on
  • I/O status information: This information includes the list of I/O devices allocated to the process, a list of open files, and so on

4. Role of PCB in Context Switch

A PCB plays a crucial role in the context switch of a process.

Sometimes, several factors such as interrupt signals or operating system calls interrupt a running process, and the process preempts its execution. When this happens, the operating system saves the current execution statistics in the PCB of the process. This ensures that the process execution resumes next time.

Let’s take a look at what happens during a context switch:

ProcessContent Context Switch

Let’s break this down:

  1. Initially, the process P0 is running, and an interruption occurs
  2. In response, the operating system saves the context of P0 and stops it from executing
  3. The operating system then loads the PCB of the other process P1 and starts execution
  4. After a while, P1 also receives an interrupt
  5. In response, the operating system saves the context of the PCB of P1 and stops it from executing
  6. The operating system then loads P0‘s PCB and resumes execution from the previous state

5. Conclusion

In this article, we discussed the process control block of a process.

First, we introduced the concept of a process and the role of PCB in managing a process state in the operating system. Then, we talked about various components of a process control block and their roles.

Finally, we discussed the role of a process control block in the process context switch.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.