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 CleanupCPU 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 ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockProcess Creation: fork() and exec()Process Termination and Resource CleanupProcess States and State Transitions

Longest path: 97 steps · 358 total prerequisite topics

Prerequisites (2)

Leads To (4)