Course contentsShow
← Computer Science
Lesson 1247 of 2,87229. CPU SchedulingFree lesson

Waiting Time

The total time a process spends in the ready queue waiting for CPU access, excluding execution time.

Waiting Time

What You'll Learn

You'll understand waiting time — the total amount of time a process spends sitting in the ready queue before it gets to run on the CPU.

The Core Idea

When multiple processes compete for CPU time, they can't all run simultaneously on a single processor. Instead, they wait their turn in the ready queue. Waiting time measures how long a process spends in this queue across all its waiting periods, before and between its CPU bursts.

Crucially, waiting time excludes the time the process actually spends executing on the CPU — it only counts the time spent waiting for access.

Why It Matters

Waiting time directly affects the user experience and system responsiveness. Long waiting times mean your programs sit idle longer, increasing overall completion time. Different scheduling algorithms produce vastly different waiting times for the same set of processes.

A Simple Analogy

Think of a coffee shop with one barista. Waiting time is how long you stand in line (plus any time you rejoin the line if called away temporarily) — not the time the barista spends making your drink.

Calculating Waiting Time

For a given process:

Waiting Time = Turnaround Time − Execution Time

If a process arrives at time 0, finishes at time 15 (turnaround = 15), and needs 8 units of CPU execution, its waiting time is:

Waiting Time = 15 − 8 = 7 time units

Those 7 units were spent waiting in the ready queue while other processes ran or while the process was blocked.

Key Takeaway:
Waiting time measures only the time a process spends in the ready queue waiting for CPU access — minimizing average waiting time is a primary goal of effective CPU scheduling algorithms.