Process States & Transitions
BeginnerA process moves through five states — New, Ready, Running, Waiting, and Terminated — driven by OS scheduler decisions and I/O events.
Overview
Process state captures what a process is doing at any moment. When first created it is in the New state while the OS allocates resources. It moves to Ready when it can run but is waiting for the CPU. The scheduler picks it and moves it to Running. If it requests I/O or a semaphore, it transitions to Waiting (blocked) until the resource arrives, at which point it returns to Ready. Finally it reaches Terminated when main() returns or exit() is called. Understanding these transitions is critical for reasoning about scheduling, context switching, and why a process "disappears" from the CPU.
The Five-State Process Model
The state machine governs all OS scheduling. The OS maintains separate queues for ready and waiting processes. Only one process per CPU core can be in the Running state at any time. The Waiting state is also called the Blocked state — the process is not runnable even if the CPU is free.
// State transition diagram (textual):
//
// NEW ──(admitted)──► READY ◄──────────────────────────────┐
// │ │
// (scheduler dispatch) (I/O or event complete)
// │ │
// ▼ │
// RUNNING ──(I/O or event wait)──► WAITING
// │
// (exit / error)
// │
// ▼
// TERMINATED
// Observing Java thread states (maps closely to process states)
Thread t = new Thread(() -> {
try { Thread.sleep(1000); } catch (InterruptedException e) {}
});
System.out.println(t.getState()); // NEW
t.start();
System.out.println(t.getState()); // RUNNABLE (= Ready or Running)
t.join();
System.out.println(t.getState()); // TERMINATEDJava Thread States (Extended Model)
Java adds finer-grained states: BLOCKED (waiting to acquire a monitor lock), WAITING (indefinite wait via Object.wait()), and TIMED_WAITING (wait with timeout). These all correspond to the OS Waiting state but distinguish the reason for blocking.
Object lock = new Object();
Thread t1 = new Thread(() -> {
synchronized (lock) {
try {
lock.wait(); // → WAITING state
} catch (InterruptedException e) {}
}
});
Thread t2 = new Thread(() -> {
synchronized (lock) { // if lock held by t1 → BLOCKED state
lock.notify();
}
});
t1.start();
Thread.sleep(50);
System.out.println(t1.getState()); // WAITING
t2.start();
t2.join(); t1.join();
System.out.println(t1.getState()); // TERMINATEDKey Points to Remember
- 1Five process states: New, Ready, Running, Waiting (Blocked), Terminated.
- 2Only one process per CPU core can be in Running state at a time.
- 3Waiting state means the process is blocked on I/O or a synchronization event — not just waiting for CPU.
- 4Java Thread.State adds BLOCKED, WAITING, and TIMED_WAITING as sub-states of OS Waiting.
- 5A process in the Ready queue is runnable; it just hasn't been scheduled yet.
Interview Questions
Sign in to ask AriaList all process states and explain each transition.
What is the difference between the Ready and Waiting states?
How does Java's Thread.State map to OS process states?
Can a process move directly from Running to Terminated without going through Waiting?
Ask Aria about Process States & Transitions
Your personal AI tutor — ask anything about this concept
Revision Status
Personal Notes
Sign in to save personal notes for this topic.
Discussion
Sign in to join the discussion.