100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
C

Process States and the PCB

Understand the five standard process states and the fields stored in a Process Control Block.

Process ManagementBeginner9 min readJul 8, 2026
Analogies

Introduction

As a process executes, it moves through a series of well-defined states managed by the operating system's scheduler. Understanding these states — and the Process Control Block (PCB) that records them — is essential to understanding how an OS multiplexes a small number of CPUs across many concurrently running processes.

🏏

Cricket analogy: A batter's innings moves through clear phases -- padding up, waiting near the rope, out in the middle, sometimes off for an injury break, eventually walking back to the pavilion -- and the scorebook (like the PCB) records exactly where each player stands at every moment.

Explanation

The five standard process states are: New (the process is being created), Ready (the process is loaded into main memory and waiting to be assigned to a CPU), Running (instructions are actively being executed on a CPU), Waiting/Blocked (the process is waiting for some event, such as I/O completion or a signal, and cannot proceed), and Terminated (the process has finished execution and is waiting to be removed from the system, often called a zombie state on POSIX systems until the parent reaps it). A process moves from Ready to Running when the scheduler dispatches it; from Running back to Ready if its time slice expires (preemption); from Running to Waiting when it issues a blocking system call such as read(); and from Waiting back to Ready once the awaited event occurs. The PCB is the kernel structure that persists this state transition information. Typical PCB fields include: process state, program counter, CPU register values, CPU scheduling information (priority, pointers to scheduling queues), memory management information (base/limit registers, page tables), accounting information (CPU used, time limits, process ID), and I/O status information (list of open files, allocated devices).

🏏

Cricket analogy: New is a batter still padding up in the dressing room, Ready is standing at the boundary edge waiting to be called, Running is actually facing the bowler, Waiting is off for a physio check mid-over, and Terminated is walked back to the pavilion after being dismissed; the scorecard (PCB) tracks strike rate, overs faced, and dismissal type for each.

Example

c
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>

/* Illustrates state transitions: New -> Ready -> Running -> Waiting -> Ready -> Terminated */
int main(void) {
    pid_t pid = fork();          /* New: child process is created */

    if (pid == 0) {
        /* Child becomes Ready, then Running when scheduled */
        printf("Child (PID %d) running, about to block on sleep()\n", getpid());
        sleep(1);                /* Running -> Waiting: blocked until timer fires */
        printf("Child (PID %d) resumed, now Ready then Running again\n", getpid());
        _exit(0);                 /* Running -> Terminated */
    } else {
        int status;
        waitpid(pid, &status, 0); /* Parent blocks (Waiting) until child terminates */
        printf("Parent observed child terminate, PID %d reaped\n", pid);
    }
    return 0;
}

Analysis

In this example the child process passes through New (at fork()), Ready (queued for the CPU), Running (executing printf), Waiting (blocked inside sleep()), Ready again (once the timer expires and it re-enters the ready queue), Running again, and finally Terminated when it calls _exit(). The parent itself moves to Waiting while blocked in waitpid(), demonstrating that the Waiting state applies to any blocking system call, not just I/O. Each of these transitions is recorded and driven by updates to the process's PCB inside the kernel; user code never manipulates the PCB directly.

🏏

Cricket analogy: The debutant moves from New (named to the squad) to Ready (padded up at the rope) to Running (facing the first ball) to Waiting (rain delay mid-innings) to Ready again (play resumes) to Running again and finally Terminated (dismissed); meanwhile the non-striker moves to Waiting while backing up at the other end, showing Waiting applies beyond just rain delays, and every transition is logged in the scorebook, never altered by the players themselves.

Key Takeaways

  • The five standard process states are New, Ready, Running, Waiting (Blocked), and Terminated.
  • A process moves Running -> Ready on preemption, and Running -> Waiting on a blocking call like I/O.
  • Only a process in the Ready state can be dispatched to Running by the scheduler.
  • The PCB stores process state, program counter, registers, scheduling info, memory info, accounting info, and I/O status.
  • A terminated-but-not-yet-reaped POSIX process is called a zombie; its PCB entry lingers until the parent calls wait().

Practice what you learned

Was this page helpful?

Topics covered

#OperatingSystemsStudyNotes#OperatingSystems#ProcessStatesAndThePCB#Process#States#PCB#Explanation#StudyNotes#SkillVeris#ExamPrep