Course contentsShow
← Computer Science
Lesson 1219 of 2,87228. Operating Systems FundamentalsFree lesson

Process States: Running and Waiting

Learn what happens when a process executes on CPU or blocks for I/O.

Process States: Running and Waiting

What you'll learn: You'll understand what happens when a process actively executes on the CPU versus when it pauses to wait for something like I/O.

The Core Idea

A process doesn't just sit in the "Ready" state forever. Once the OS scheduler picks it and gives it CPU time, it transitions to the Running state—it's actively executing instructions on the processor. But here's the catch: not every instruction completes instantly. When a process needs to wait for something slow (like reading from disk, waiting for network data, or user input), it can't hog the CPU. Instead, it moves to the Waiting (or Blocked) state.

Running State

When a process is Running, it has control of the CPU and is executing its instructions. Only one process per CPU core can be Running at any given moment. Think of it like having the microphone at a meeting—you're the one talking right now.

Waiting State

When a process requests I/O or waits for an event (like a file read or network packet), the OS moves it to the Waiting state. The process cannot continue until that event completes. It's removed from the CPU so other processes can run. Imagine pausing mid-sentence to wait for someone to bring you a document—you step aside so others can speak.

Once the I/O completes, the process moves back to Ready (not directly to Running), where it waits for the scheduler to give it CPU time again.

Why This Matters

This state model prevents processes from wasting precious CPU cycles while waiting for slow operations. The OS can multiplex the CPU among many processes, keeping the system responsive and efficient.

Key Takeaway: A process is Running when executing on the CPU and transitions to Waiting when it needs I/O or external events; it returns to Ready once the wait completes.