Nexus Learn

CPU scheduling calculator

Enter your processes and pick an algorithm. You get the Gantt chart plus completion, turnaround, waiting and response time for every process. Supports FCFS, SJF, SRTF and Round Robin.

ProcessArrival timeBurst time

Gantt chart

Results

How the algorithms work

FCFS runs processes in the order they arrive. It is simple, but one long job at the front makes everything behind it wait (the convoy effect).

SJF always picks the ready process with the shortest burst time. It gives the lowest average waiting time, but long jobs can wait a very long time.

SRTF is the preemptive version of SJF. If a new process arrives with a shorter remaining time than the one running, the CPU switches to it.

Round Robin gives each process a fixed time quantum in turn. It is fair and good for interactive systems. A very small quantum wastes time on switching, and a very large one behaves like FCFS.

The formulas

  • Turnaround time = completion time − arrival time
  • Waiting time = turnaround time − burst time
  • Response time = time of first CPU use − arrival time

In Round Robin, when a process arrives at the same moment another one's quantum ends, the new arrival is placed in the queue first. Some textbooks use a different tie rule, so check what your course uses.

Frequently asked questions

Which algorithm gives the lowest average waiting time?

SJF (and SRTF when preemption is allowed) is optimal for average waiting time.

What does idle time in the chart mean?

It means no process has arrived yet, so the CPU has nothing to run.

More: operating systems MCQs · Linux commands cheat sheet