A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Process States and State Transitions

College Depth 96 in the knowledge graph ☐ I know this ☆ Set as goal
56topics build on this
358prerequisites beneath it
See this on the map →
Process Creation: fork() and exec()Process Termination and Resource Cleanup→→CPU Scheduling FundamentalsContext Switching and CPU Dispatch+2 more
process-lifecycle scheduling state-machine

Core Idea

Processes cycle through states: new (created), ready (waiting for CPU), running (executing), blocked (waiting for I/O or event), and terminated. State transitions are triggered by the scheduler, I/O completion, or system calls. Understanding the process state machine is fundamental to comprehending OS behavior and scheduling.

Explainer

You already know that fork() creates a new process and exec() loads a program into it. But once a process exists, it does not simply "run until done." The operating system manages potentially hundreds of processes on a handful of CPUs, and it does so by assigning each process a state that determines whether it is eligible for CPU time. The five classical states — new, ready, running, blocked, and terminated — form a state machine that governs every process's lifecycle.

When fork() returns successfully, the child process enters the new state. The OS allocates a process control block (PCB), assigns a PID, and sets up memory mappings. Once initialization is complete, the process moves to ready, meaning it has everything it needs to execute and is simply waiting for the scheduler to pick it. The transition from ready to running happens when the scheduler dispatches the process onto a CPU — the process's saved registers are loaded, and it begins (or resumes) executing instructions.

The critical insight is what pulls a process *out* of the running state. Two things can happen. First, the scheduler may preempt the process — its time slice expires, or a higher-priority process becomes ready — and the process returns to the ready state without having done anything wrong. Second, the process may request something that cannot complete immediately, such as reading from disk or waiting for a network packet. At that point the process enters the blocked state. A blocked process is not competing for CPU time at all; it is parked until the event it is waiting for occurs. When the I/O completes or the event fires, the OS moves the process back to ready — not directly to running, because the scheduler still decides who runs next.

Finally, when a process calls exit() or is killed by a signal, it enters the terminated state. As you learned from process termination and cleanup, the process's resources are released, but its PCB may linger as a zombie until the parent collects its exit status. The entire state machine can be drawn as a directed graph with five nodes and a handful of edges, and every transition corresponds to a concrete OS mechanism: the scheduler dispatches (ready → running), the timer interrupt preempts (running → ready), a blocking system call waits (running → blocked), an interrupt signals completion (blocked → ready), and exit or a fatal signal terminates (running → terminated). Internalizing this diagram is the foundation for understanding CPU scheduling, context switching, and everything the OS does to juggle multiple processes on limited hardware.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Kernel Architecture and OS Structure → System Calls and User/Kernel Mode → Processes and the Process Control Block → Process Creation: fork() and exec() → Process Termination and Resource Cleanup → Process States and State Transitions

Longest path: 97 steps · 358 total prerequisite topics

Prerequisites (2)

Leads To (4)