What CPU scheduling decides
A computer usually has more processes ready to run than it has processors. CPU scheduling is the rule that decides which ready process gets the CPU next, and for how long. The five algorithms on this page all answer that question differently: by arrival order, by job length, by remaining work, by importance, or by taking turns. The simulator above runs any of them on the same processes, so you can switch and watch the timeline change.
Every schedule here is shown as a timeline, which textbooks call a Gantt chart: time runs left to right, the top lane shows who has the CPU, and each process has its own lane with its runs and its waiting stretches.
How schedules are measured
Three numbers per process describe how a schedule treated it. Turnaround time is how long the process spent in the system, from arrival to finish. Waiting time is the part of that it spent ready but not running. Response time is how long it waited before it ran for the first time. Averages over all processes let you compare algorithms; CPU utilization and throughput describe the schedule as a whole.
- Turnaround time
= finished - arrival - Waiting time
= turnaround - burst - Response time
= first run - arrival - CPU utilization
= total burst / last finish, and throughput= processes / last finish
Which one should I use?
There is no single best algorithm; each one wins on a different measure. Use this table as a starting point, then try your own processes in the compare view.
| Algorithm | Preemptive | Can starve | Best for | Main weakness |
|---|---|---|---|---|
| FCFS | No | No | Simple batches where arrival order is fair | Short jobs wait behind long ones |
| SJF | No | Yes, long jobs | Low average waiting time when job lengths are known | Needs burst lengths in advance |
| SRTF | Yes | Yes, long jobs | The lowest average waiting time, if switching is cheap | Many switches, needs remaining times |
| Priority | Either | Yes, low priority, unless aging is used | Work where some processes matter more | Importance can leave long waits |
| Round Robin | Yes | No | Interactive use and fair response times | Higher average turnaround; depends on the quantum |
A few rules of thumb follow from the table. If you care about average waiting time and know how long jobs take, the shortest-first family (SJF, SRTF) is hard to beat. If you care about every process getting a turn quickly, Round Robin is the usual answer. If processes differ in importance, Priority expresses that directly, and FCFS remains the baseline the others are measured against.
What Trace assumes
The simulator follows the classic textbook model: one CPU, time in whole units, each process needing one CPU burst with no input or output in between, and switching between processes taking no time. Real schedulers deal with all of these, but exam questions usually do not, and the simple model makes every decision visible. The tie-break rules are stated on each algorithm's page and, where textbooks differ, you can switch them.
The five algorithms
Spotted a mistake?
If something on this page looks wrong, please tell me what and why.
Email: abdul at abmans dot com