Chapter 5 · Simulation

CPU Scheduling

← Chapter 5
Speed 2/s
Scenario
Quantum 2

Not arrived

Ready queue

CPU

Done

Time 0/0 ✓ Done 0/0 Avg W – Avg TAT – Avg R –

CPU Scheduling

As processes move through the Not arrived, ready queue, CPU and Done areas, the Gantt chart grows by one time unit per step. When a process finishes, the table on the right shows its waiting (W), turnaround (TAT) and response (R) times, with the averages below.

Usage

  • Pick an algorithm and a scenario, or edit the process table directly (name, arrival, CPU burst, priority; + adds a process up to 8, × removes one).
  • ▶ plays; the step buttons move one time unit back or forward, or jump to the start or end. Speed sets the number of time units per second.
  • The time quantum is the time round robin gives each process per turn (1–10).
  • Compare runs all six algorithms on the same processes and tries RR quanta from 1 to 6; clicking an algorithm there switches to it.

Algorithms

FCFS
Runs processes to completion in arrival order.
SJF
Shortest CPU burst among arrived processes; no preemption.
SRTF
Shortest remaining time; a new arrival can preempt the running process.
Priority
Smallest number first; no preemption.
P-Priority
Preemptive priority: a higher-priority arrival preempts the running process.
RR
One quantum per turn, then to the back of the queue.
Ties
Earlier arrival first, then table order. RR: new arrivals enter the queue before the preempted process.

Metrics

TAT
Turnaround time = completion − arrival
W
Waiting time = turnaround − CPU burst
R
Response time = first run − arrival

Legend

arrival waiting running ✓ done preempted

Keys

←→ stepSpace playHomeEndEsc close