Only one process runs per core, so when several are ready a scheduling policy decides the order — trading average waiting time, fairness, and responsiveness.
A CPU core runs one process at a time, so when several are ready, the scheduling policy decides who goes next. Each process needs a burst time of CPU work; the order they're run in changes how long each one waits. The policy is always a trade-off between speed, fairness, and responsiveness.
Three classic policies
1FCFS (First-Come, First-Served) — run processes in arrival order. Simple, but one long job makes everyone behind it wait — the convoy effect.
2SJF (Shortest Job First) — always run the ready process with the smallest burst. Provably the lowest average waiting time, but long jobs can be starved.
3Round-Robin — give each process a fixed quantum (time slice) in turn, then rotate. Preemptive, so the system stays responsive for everyone.
Worked example — waiting time
Three processes arrive together at time 0 with bursts P1 = 24, P2 = 3, P3 = 3. Waiting time is how long a process sits ready before it starts running.
Running short jobs first means the long job's 24-unit delay is paid by only itself, not by the two short jobs waiting behind it. Front-loading the quick work drops the average wait from 17 down to 3 on the very same job mix.
Preemptive vs non-preemptive
FCFS and basic SJF are non-preemptive — a running job keeps the CPU until it finishes or blocks. Round-Robin is preemptive: a timer interrupt yanks the CPU back when the quantum expires. A tiny quantum gives great responsiveness but wastes time on context switches.
OperationTimeSpace
FCFS · convoy effect on long jobsO(n) by arrivalO(n)
SJF · min average wait; can starve long jobsO(n log n) by burstO(n)
Round-Robin · responsive; quantum trades latency vs overheadO(1) rotateO(n)
Check yourself
Bursts are P1=24, P2=3, P3=3, all arriving at time 0. What is the average waiting time under Shortest Job First?