CPU Scheduling Simulator and Calculator: FCFS, SJF, SRTF, Round Robin, Priority

The CPU scheduler decides which ready process runs next. Different policies trade off waiting time, turnaround time and fairness. Choose an algorithm, edit the processes and watch the ready queue and the CPU move.

About this simulator

The CPU scheduler decides which ready process runs next, and the policy it uses changes waiting time, turnaround time and fairness. This simulator runs the real algorithms on your own process table: add processes, set arrival and burst times (and priorities), pick an algorithm and step through each decision while the ready queue, the CPU and the metrics update.

How it works

  1. Each process has an arrival time, a CPU burst and (for Priority) a priority number — a smaller number means higher priority.
  2. At every scheduling decision the algorithm picks one process from the ready queue by its own rule.
  3. Afterwards: turnaround = completion − arrival, waiting = turnaround − burst, response = first run − arrival.

Formulas used

  • TAT=CT−ATTAT = CT - AT
  • WT=TAT−BTWT = TAT - BT
  • RT=first CPU time−ATRT = \text{first CPU time} - AT
  • CPU utilization=busy timetotal time\text{CPU utilization} = \dfrac{\text{busy time}}{\text{total time}}

Worked example

Three processes arrive at time 0 with bursts 24, 3 and 3. FCFS runs them in that order: waiting times 00, 2424 and 2727, average 0+24+273=17\dfrac{0+24+27}{3} = 17. SJF runs 3, 3, 24: waiting times 00, 33 and 66, average 33. Round Robin with quantum 4 gives waiting times 6, 4 and 7, an average of 5.67 — much better than FCFS because the short jobs no longer wait behind the long one (the convoy effect).

Enter these numbers in the simulator above to see every step.

When to use it

  • Checking homework on average waiting time and turnaround time.
  • Learning how preemption changes SJF into SRTF and how the quantum shapes Round Robin.
  • Preparing for operating-systems exams and GATE-style numerical problems.

Frequently asked questions

How do you calculate waiting time and turnaround time?

Turnaround=completion−arrival\text{Turnaround} = \text{completion} - \text{arrival}. Waiting=turnaround−burst\text{Waiting} = \text{turnaround} - \text{burst}. Response=first time on the CPU−arrival\text{Response} = \text{first time on the CPU} - \text{arrival}.

Which scheduling algorithm has the lowest average waiting time?

Shortest Job First (and its preemptive version SRTF) gives the minimum average waiting time, but it needs to know burst times and can starve long processes.

How does the time quantum affect Round Robin?

A very large quantum makes Round Robin behave like FCFS; a very small one causes many context switches. A quantum slightly longer than a typical burst works well.

What is the convoy effect?

Short processes waiting behind one long CPU-bound process under FCFS, which raises the average waiting time.