Home/Learn/Operating Systems/Process States & Transitions

Process States & Transitions

Beginner
Processes & Threads

A 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.

Java — Thread.State mirrors process states
// 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());  // TERMINATED

Java 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.

Java — WAITING vs BLOCKED states
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());  // TERMINATED

Key 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 Aria
1

List all process states and explain each transition.

EasyFlipkart
2

What is the difference between the Ready and Waiting states?

EasyAmazon
3

How does Java's Thread.State map to OS process states?

MediumAtlassian
4

Can a process move directly from Running to Terminated without going through Waiting?

MediumGoogle

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.

Loading discussion…