Learn

CPU scheduling, explained

The core metrics first, then each algorithm: how it works, where it shines, where it struggles, and where you see it in real systems.

Core metrics

Turnaround Time
Turnaround = Completion − Arrival

Total time a process spends in the system, from arrival to completion. It captures the full latency experienced by a job.

Waiting Time
Waiting = Turnaround − Burst

Time a process spends in the ready queue not executing. Minimizing it is the goal of SJF/SRTF.

Response Time
Response = First CPU − Arrival

Time from arrival until the process first gets the CPU. Critical for interactive systems and what Round Robin optimizes.

CPU Utilization
Utilization = Busy / Total × 100%

Fraction of time the CPU is doing useful work rather than idling. Higher is generally better.

Throughput
Throughput = Completed / Total time

Number of processes completed per unit time. A key measure of overall system productivity.

Context Switch
Overhead per preemption

Cost of saving one process's state and restoring another's. Preemptive policies trade responsiveness for this overhead.

The nine algorithms