codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🖥️

Operating Systems

25 chapters

1Intro to OS & Kernel Architecture2Process Concept & Lifecycle3System Calls & Interrupts4Process Management & PCB5Inter-Process Communication (IPC)6CPU Scheduling (FCFS, SJF, RR)7Threads (User vs Kernel Level)8Process Synchronization9Critical Section Problem10Producer-Consumer Problem11Dining Philosophers Problem12Deadlock Conditions & Prevention13Banker's Algorithm (Avoidance)14Memory Management & Paging15Memory Allocation (First Fit, Best Fit)16Paging and Segmentation17Translation Lookaside Buffer (TLB)18Virtual Memory & Demand Paging19Page Replacement Algorithms20Thrashing21File Systems & Directory Structure22File Allocation Methods23Disk Scheduling Algorithms24I/O Systems & DMA25OS Protection & Security
SubjectsOperating Systems

Process Management & PCB

Updated 2026-04-30
2 min read

Process Management & PCB

A program is a passive entity (an executable file residing on disk), whereas a Process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources. A program becomes a process when an executable file is loaded into memory.

1. Process Memory Layout

When a process is loaded into memory, it is divided into several sections:

  • Text Section: The compiled program code.
  • Data Section: Stores global and static variables.
  • Heap: Memory that is dynamically allocated during run time.
  • Stack: Temporary data storage used for function parameters, return addresses, and local variables.

2. Process States

As a process executes, it changes state. The state of a process is defined by its current activity:

  1. New: The process is being created.
  2. Ready: The process is waiting to be assigned to a processor. It is in the ready queue.
  3. Running: Instructions are being executed on the CPU.
  4. Waiting (Blocked): The process is waiting for some event to occur (e.g., waiting for I/O completion or a lock).
  5. Terminated: The process has finished execution.

3. Process Control Block (PCB)

Each process is represented in the operating system by a Process Control Block (PCB), also called a task control block. It contains crucial information about the specific process:

  • Process State: The current state (New, Ready, Running, etc.).
  • Program Counter: Indicates the address of the next instruction to be executed for this process.
  • CPU Registers: Includes accumulators, index registers, stack pointers, and general-purpose registers.
  • CPU-Scheduling Information: Includes a process priority, pointers to scheduling queues, and other scheduling parameters.
  • Memory-Management Information: Includes the value of the base and limit registers and the page tables.
  • Accounting Information: Includes the amount of CPU and real time used, time limits, account numbers, job or process numbers.
  • I/O Status Information: Includes a list of I/O devices allocated to the process and a list of open files.

4. Context Switch

When an interrupt or system call occurs, the OS needs to save the current context of the running process on the CPU so that it can restore that context when its processing is done. This process of saving the state of the old process and loading the saved state for a new process is known as a Context Switch. Context switch time is pure overhead, because the system does no useful work while switching.



PreviousSystem Calls & InterruptsNextInter-Process Communication (IPC)

Recommended Gear

System Calls & InterruptsInter-Process Communication (IPC)