Intuition What this page does
The parent Processes — PCB, states (new - ready - running - blocked - terminated) gave you the five states and the legal transitions. Here we stress-test that knowledge against every kind of situation a process can land in: normal runs, preemptions, I/O waits, the "degenerate" cases (a process that never runs, one that never blocks, one killed early), and the tricky exam twists. If you can trace all of these, no scenario can surprise you.
Before symbols: a quick reminder of the alphabet we use.
Definition The five states (one-word pictures)
New — being born (PCB just allocated).
Ready — sitting in line for the CPU. Has everything except the CPU.
Running — actually on the CPU right now (one per core).
Blocked — parked, waiting for an outside event (usually I/O).
Terminated — done, PCB about to be freed.
The golden rule from the parent: Blocked never jumps straight to Running — after its event finishes it rejoins the line (→ Ready).
Think of every process story as a choice of "cell" from this table. Each column is a kind of thing that can happen; each row is a case class we must cover so the reader never meets an unshown scenario.
Cell
Case class
What triggers it
The transition it exercises
C1
Plain CPU-only run
never asks for I/O, short enough to finish in one slice
New→Ready→Running→Terminated
C2
Preemption (timeout)
slice ends before the job finishes
Running→Ready (not Blocked!)
C3
I/O wait + wake-up
process calls a slow device
Running→Blocked→Ready →Running
C4
Higher-priority arrival
a more urgent process appears
Running→Ready (preempt by priority)
C5
Degenerate: never runs
killed while still Ready / never dispatched
New→Ready→Terminated
C6
Degenerate: killed mid-run
crash / kill signal while Running
Running→Terminated
C7
Limiting: pure I/O-bound
almost always Blocked, barely uses CPU
Blocked ⇄ Ready loop
C8
Real-world word problem
a download-and-save app
mixes C3 + C1
C9
Exam twist
"Blocked→Running?" style trap
tests the golden rule
C10
Zero-work / instant exit
process that does nothing
New→Ready→Running→Terminated in a blink
The ten worked examples below hit every cell . Each is tagged with its cell number.
Every geometric example on this page uses one picture format. Meet it once so the rest are instant.
Intuition How to read the timeline strip
Time runs left → right along the bottom axis (in milliseconds). Each process gets its own horizontal lane. The colour of a block tells you the state during that stretch: cyan = Running, faded white = Ready (in line), amber = Blocked (waiting on I/O). A tall dashed line marks a scheduling event (dispatch, timeout, I/O call, wake-up). That's the whole language — colour = state, vertical line = decision point.
A process P needs exactly 3 ms of CPU and never touches I/O. The scheduler time-slice is 5 ms , and P is the only process. Trace its full life and give the total wall-clock time from admission to termination.
Forecast: guess the sequence of states and the finish time before reading on.
New → Ready. Why this step? The OS allocates P's PCB and admits it; it now has everything except the CPU.
Ready → Running at t = 0 . Why? Dispatcher picks the only ready process.
Runs 3 ms. Since 3 < 5 (slice), it finishes before any timeout. Why? A timeout only fires if the job outlives its slice.
Running → Terminated at t = 3 . Why? Work done, PCB reclaimed.
Verify: Finish time = 3 ms. No Ready-waiting (alone) and no Blocked (no I/O), so wall-clock = CPU time = 3 ms. Sanity check: 3 ≤ 5 , so the "one slice, done" claim holds. ✓
Process Q needs 7 ms of CPU, alone, slice = 2 ms. How many times is it preempted, and what state does it enter each time the slice ends?
Forecast: many students say "Blocked". Is it?
Run [ 0 , 2 ] , slice ends, job not done (7 > 2 ). Running → Ready. Why Ready, not Blocked? Q can still run — it lost its turn , it is not waiting on any external event.
It's alone, so it's re-dispatched immediately: Run [ 2 , 4 ] → Ready. Run [ 4 , 6 ] → Ready. Run [ 6 , 7 ] finishes. Why does it keep coming back? No other process is in line to steal the CPU.
Count the timeouts: the slice boundary was hit at t = 2 , 4 , 6 . Why? Full slices used before the final partial one.
Verify: Number of preemptions = ⌈ 7/2 ⌉ − 1 = 4 − 1 = 3 . Total CPU used = 2 + 2 + 2 + 1 = 7 ms ✓. Every timeout landed in Ready , never Blocked ✓.
Process R runs 1 ms, then calls read() on a disk (I/O takes 4 ms), then computes 2 ms more. Slice is large (say 10 ms), and R is alone. Trace every state and give the total wall-clock time.
Forecast: will the 4 ms of I/O count as CPU time?
New → Ready → Running at t = 0 . Runs 1 ms. Why? Normal start-up.
At t = 1 it calls read(). Running → Blocked. Why Blocked? Disk is slow; the process cannot proceed until data arrives, so it gives up the CPU voluntarily.
Disk works during [ 1 , 5 ] . The CPU is idle here (nobody else exists). At t = 5 the I/O completes. Blocked → Ready. Why Ready, not Running? The golden rule — it must re-queue.
Alone, so instantly Ready → Running at t = 5 ; computes 2 ms.
Running → Terminated at t = 7 .
Verify: CPU time used = 1 + 2 = 3 ms; I/O wait = 4 ms; wall-clock = 1 + 4 + 2 = 7 ms ✓. Note wall-clock > CPU time because of the Blocked stretch — that is exactly why I/O overlap matters (see CPU Scheduling ).
Priority scheduling (lower number = more urgent, preemptive). L (priority 5) is Running when H (priority 1) arrives at t = 3 . What happens to L and to H?
Forecast: does L go to Blocked or Ready?
At t = 3 the OS receives an interrupt announcing H's arrival. Why an interrupt? The CPU is busy; only a hardware/timer interrupt can hand control to the OS.
Compare priorities: 1 < 5 , so H is more urgent. L: Running → Ready. Why Ready? L is perfectly able to run; it was merely out-ranked, not waiting on an event.
H: Ready → Running. Why? Scheduler dispatches the highest-priority ready process.
When H finishes/blocks, L returns from Ready → Running.
Verify: The preempted process is in Ready , matching the same rule as timeout (C2): preemption ⇒ Ready, never Blocked ✓. This is what a context switch performs — save L's PCB, load H's.
Process Z is admitted and sitting in the ready queue , but the user kills it (or the parent aborts) before it is ever dispatched . What states did Z visit?
Forecast: must a process pass through Running to reach Terminated?
New → Ready. Why? Normal admission.
A kill signal arrives while Z is Ready. Ready → Terminated. Why is this legal? Termination can be requested at any time; the process never needed the CPU to be destroyed — the OS just marks the PCB dead and frees it.
Verify: State sequence = New, Ready, Terminated — Running was skipped ✓. Lesson: not every process runs. The diagram allows termination from more than one state in real systems.
Process C is Running and divides by zero (a fault) at t = 4 . What transition fires, and is any PCB info saved?
Forecast: does a crashing process get its registers saved for a future resume?
The fault raises a trap; the CPU jumps to the OS. Why? Illegal operations generate a synchronous interrupt (a trap ).
The OS decides C cannot continue. Running → Terminated. Why not Ready or Blocked? There is no future run to prepare for — the process is being destroyed.
No register save-for-resume is needed (unlike a context switch). The OS may snapshot state for a core dump / error report , but not to resume C.
Verify: Sequence = Running → Terminated in one step; the "save registers to PCB" work of a normal context switch is absent because there is nothing to resume ✓.
A logging process IOb does a tiny 0.1 ms CPU burst, then waits 10 ms on disk, forever repeating. Over a 30 ms window, roughly what fraction of time is it Running, and what state dominates?
Forecast: which state is it in most of the time?
Each cycle = 0.1 ms Running + 10 ms Blocked (+ negligible Ready). Why this shape? The CPU work is trivial; the disk wait dominates each round.
Cycle length ≈ 10.1 ms, so in 30 ms it completes about 30/10.1 ≈ 2.97 cycles. Why divide? Time window ÷ cycle length = number of cycles.
Running fraction = 0.1/10.1 ≈ 0.0099 , i.e. about 0.99 % . Blocked fraction ≈ 99% .
Verify: Running fraction = 0.1/10.1 = 0.00990 … ≈ 0.99% ✓. The dominant state is Blocked . This is the textbook "I/O-bound" limit — the exact reason the OS can pack many such processes onto one core (see CPU Scheduling ).
A phone app: (a) computes a URL (0.5 ms CPU), (b) downloads a file over the network (blocks 20 ms), (c) checksums the bytes (2 ms CPU), (d) writes to storage (blocks 3 ms), (e) shows "Done" (0.2 ms CPU). Alone on one core. List every state transition and total wall-clock time.
Forecast: how many times does it enter Blocked?
New → Ready → Running , do (a) 0.5 ms. Why start here? Setup + CPU work.
Start download (b): Running → Blocked for 20 ms (network). Why Blocked? Waiting on an external event (packets).
Download done: Blocked → Ready → Running , do (c) checksum 2 ms. Why re-queue first? Golden rule.
Start disk write (d): Running → Blocked 3 ms. Why Blocked again? A second external wait.
Write done: Blocked → Ready → Running , do (e) 0.2 ms, then Running → Terminated .
Verify: Blocked entries = 2 (network + disk) ✓. CPU time = 0.5 + 2 + 0.2 = 2.7 ms; I/O wait = 20 + 3 = 23 ms; wall-clock = 2.7 + 23 = 25.7 ms ✓. Notice CPU is idle 23 ms — precisely the gap another process could fill (motivation for multiprogramming).
Multiple choice: "Process P was Blocked on I/O. The disk finishes. The CPU is currently idle (no other process ready). Does P go directly Blocked → Running?" True or False — and justify.
Forecast: the CPU is idle, so surely it can grab it directly?
Consult the legal transitions from the parent: the only exit from Blocked is → Ready . Why? The wake-up event only changes why it's waiting (event done), not whether it has been scheduled.
So P first becomes Ready . Why even when the CPU is free? The scheduler is the sole authority that moves Ready → Running; the transition still happens, just instantly.
Answer: False. It is Blocked → Ready → Running; steps 2 and 3 may be back-to-back in time, but Ready is never skipped in the state model.
Verify: The claimed edge "Blocked → Running" is not in the transition set { Blocked→Ready, Ready→Running} ; the composed path exists but the direct edge does not ✓. This is the single most-tested trap on this topic.
A script that is literally exit(0) — it does zero useful CPU work. Does it still pass through the states, and how long is each?
Forecast: can a state have (essentially) zero duration?
New: PCB allocated — nonzero setup cost, but tiny. Why still needed? Even a do-nothing process needs an identity (PID) and a PCB.
New → Ready → Running: the dispatcher must still schedule it once. Why? exit(0) is itself an instruction the CPU executes.
Running → Terminated: the single syscall runs and the process leaves.
Verify: Number of distinct states visited = 4 (New, Ready, Running, Terminated); Blocked is skipped (no I/O) ✓. Useful CPU time ≈ 0 , but the state path is complete — a state can have near-zero duration but is not skipped just for being brief.
Recall Which cell did each example hit?
Example 1 hits which case class? ::: C1 — plain CPU-only run.
Example 2? ::: C2 — preemption by timeout (→ Ready).
Example 3? ::: C3 — I/O wait and wake-up.
Example 4? ::: C4 — higher-priority arrival preempts.
Example 5? ::: C5 — killed while still Ready (Running skipped).
Example 6? ::: C6 — killed mid-run (Running → Terminated).
Example 7? ::: C7 — pure I/O-bound limiting case.
Example 8? ::: C8 — real-world download-and-save word problem.
Example 9? ::: C9 — the Blocked→Running exam trap.
Example 10? ::: C10 — zero-work instant-exit process.
Mnemonic The two rules that solve every cell
"Lost my turn → Ready. Waiting for stuff → Blocked." Preemption/timeout/priority all send you to Ready; only an external event sends you to Blocked. And always: "After waiting, wait again (in line)."
Which transition does a time-slice timeout cause? Running → Ready (never Running → Blocked).
When I/O completes, where does a Blocked process go? To Ready — it must re-queue; Blocked never jumps to Running.
Can a process reach Terminated without ever being Running? Yes — e.g. killed while Ready (New → Ready → Terminated).
For a pure I/O-bound process, which state dominates its time? Blocked (Running is a tiny fraction, ~1% in Example 7).
Why is wall-clock time larger than CPU time in Example 3? Because of the Blocked stretch waiting on the disk — I/O wait is not CPU time.
In preemptive priority scheduling, what state does the out-ranked running process enter? Ready (it can still run, it was only out-prioritised).