Learning path

Full curriculum

Full curriculum

Unit content

Blocking, sleeping and wakeups

A task that cannot make useful progress should not keep consuming processor time. Operating systems therefore let execution become blocked while waiting for an event.

Sleeping

A sleep request asks the operating system not to make the task runnable until a time condition has been satisfied.

The kernel records the wait, removes the task from the runnable set and schedules other work. A timer event later makes the sleeping task runnable again.

Waiting for events

The same pattern applies to many operations: waiting for input, a lock, child-process termination or completion of device I/O.

running → blocked/waiting → runnable → running

Blocking is different from repeatedly checking a condition in a busy loop. The blocked task consumes no CPU time merely for waiting.

Wakeup does not mean immediate execution

When the awaited event occurs, the task becomes eligible to run. The scheduler still decides when it actually receives a processor.

This distinction between blocked, runnable and running states explains how an operating system can efficiently coordinate many tasks whose work depends on events occurring at different times.