CPU scheduling simulator
Practise all six algorithms on your own data.
Module 2
Session 2.5
Lesson 4 of 5
CPU scheduling simulator
Every algorithm in the syllabus, on any data you choose — with an animated Gantt chart and full metrics.
How to use
Choose an algorithm, type arrival times, burst times and priorities as space-separated lists, then press Run. Use Step to build the Gantt chart one block at a time — the table fills in as each process completes.
SchedulerEdit the inputs, press Run, then Step or Play.
Practice problems
Solve on paper first, then check with the simulator.
| # | Data (AT / BT / Priority) | Algorithm | Answer (avg WT) |
|---|---|---|---|
| 1 | P1 0/5, P2 1/3, P3 2/8, P4 3/6 | FCFS | (0 + 4 + 6 + 13)/4 = 5.75 |
| 2 | same | SJF | P1 0–5, P2 5–8, P4 8–14, P3 14–22 → (0 + 4 + 12 + 5)/4 = 5.25 |
| 3 | same | SRTF | P1 0–1, P2 1–4, P1 4–8, P4 8–14, P3 14–22 → (3 + 0 + 12 + 5)/4 = 5.00 |
| 4 | same | RR, q = 2 | P1 0–2, P2 2–4, P3 4–6, P1 6–8, P4 8–10, P2 10–11, P3 11–13, P1 13–14, P4 14–16, P3 16–18, P4 18–20, P3 20–22 → WT P1 9, P2 7, P3 12, P4 11 → 9.75 |
Quick check
For the practice data, which algorithm gives the smallest average waiting time?
SRTF (5.00) — preemptive SJF is optimal when arrivals are spread out.
Which algorithm gives the best response time for P3 in the practice data?
Under RR, P3 first runs at t = 4 (response 2) versus t = 8 or 14 otherwise.