Process State Transitions
You'll learn: How processes move between different states and what events trigger these transitions.
What Are State Transitions?
A process doesn't stay in one state forever—it moves through different states during its lifetime based on events like starting execution, requesting I/O, or finishing work. Understanding these legal transitions is crucial for grasping how an operating system manages running programs.
The Legal State Transitions
Think of process states like rooms in a building, with specific doors connecting them. Here are all the allowed movements:
1. New → Ready
- Trigger: OS finishes creating the process and admits it to the ready queue.
- The process is born and now waits for CPU time.
2. Ready → Running
- Trigger: Scheduler selects this process for execution (dispatch).
- The process gets its turn on the CPU.
3. Running → Ready
- Trigger: Time slice expires, or a higher-priority process arrives (preemption).
- The process still has work to do but must yield the CPU.
4. Running → Waiting
- Trigger: Process requests I/O or waits for an event (like user input or disk read).
- The process voluntarily gives up the CPU because it can't proceed yet.
5. Waiting → Ready
- Trigger: The awaited event completes (I/O finishes, resource becomes available).
- The process can now compete for CPU time again.
6. Running → Terminated
- Trigger: Process completes execution or is forcibly killed.
- The process ends and the OS reclaims its resources.
What's NOT Allowed?
You cannot go directly from Waiting to Running (must pass through Ready), or from New straight to Running. These rules maintain orderly scheduling.
Key Takeaway: Process state transitions follow strict rules enforced by the OS scheduler, triggered by events like time expiration, I/O requests, or resource availability—ensuring fair and efficient CPU sharing.