Process States and Transitions

RoadmapsCore CS

Scenario

Imagine a busy restaurant kitchen. An order comes in, waits to be prepped, is actively cooked, might be paused while waiting for a missing ingredient, and finally is served. Processes in an operating system follow an identical lifecycle.

Mental model

A process's lifecycle is like a patient's journey through a hospital.

A patient is admitted (New), waits in the waiting room (Ready), sees the doctor (Running), might wait for lab results (Blocked/Waiting), and finally is discharged (Terminated).

Explanation

When you double-click an application, the operating system doesn't just hand it the CPU and walk away. Instead, the OS manages the process through a strict lifecycle of discrete states, ensuring fair access to system resources. This lifecycle dictates exactly what a process is allowed to do at any given moment.

The most fundamental distinction in this lifecycle is whether a process is actually executing instructions on the CPU or waiting for its turn. But 'waiting' isn't a single state. A process can be waiting because it's ready to execute but the CPU is busy with another program, or it can be waiting because it's fundamentally stuck until some external event (like an I/O operation or network response) finishes. This distinction is the core of process scheduling.

Every process starts in the **New** state, where the OS allocates its memory and creates its Process Control Block (PCB). Once initialization is complete, it is moved to the **Ready** state. At this point, the process is fully prepared to execute; it's simply waiting in a queue for the OS scheduler to assign it a CPU core.

When the scheduler picks the process, it transitions from Ready to **Running**. This is the only state where the process's actual instructions are being executed by the CPU hardware. However, a process rarely runs to completion uninterrupted. If its time-slice expires, the OS forcefully moves it back to the **Ready** state to let another process run.

If the running process needs to read from disk or wait for user input, it transitions to the **Blocked** (or Waiting) state. It cannot execute instructions while blocked, even if the CPU is completely idle. Once the disk read or user input completes, the hardware sends an interrupt to the OS, which moves the process from Blocked back to Ready. Finally, when the process finishes its last instruction or is killed, it enters the **Terminated** state, allowing the OS to reclaim its resources.

Key points

Common mistakes

Glossary

process
The technical term for a software program that is currently loaded into memory and actively running on your computer.
lifecycle
The strict series of stages (like New, Ready, Running, and Terminated) that every running program must cycle through from the moment it opens until it closes.
system resources
The finite hardware components of a computer, like the CPU time, RAM memory, and disk storage, that programs must share.

Recall questions

Questions & answers

A process has just completed its I/O operation. Which state does it enter next?

Ready state.

Approach: Remember the process lifecycle diagram: I/O completion triggers an interrupt that moves the process from Blocked/Waiting into the Ready queue, not directly to Running.

If a CPU has multiple cores, can a single process be in the Running state on multiple cores simultaneously?

No, a single process (assuming a single-threaded context) can only execute on one core at a time. Threads within a process can run on multiple cores.

Approach: Clarify the distinction between a process (an execution environment) and a thread (an execution unit). A standard single-threaded process executes one instruction stream at a time.

Continue learning

Previous: Process vs program & the PCB

Next: Context Switching

Return to Core CS Roadmap