ToolSphere

CPU Scheduling Calculator

Computer science

Free CPU scheduling calculator for FCFS, SJF, SRTF, Priority and Round Robin: Gantt chart plus completion, turnaround, waiting and response times.

CPU scheduling calculator

Type when each process arrives and how long it runs, then pick an algorithm. The averages and the Gantt chart (a timeline of who runs when) update as you type.

Average waiting time: 8.75. See the timeline and each process below.

Processes

Arrival time: when a process arrives. Burst time: how long it needs the CPU. Separate values with spaces or commas; the n-th value of each list belongs to process Pn.

Avg turnaround
15.25
Avg waiting
8.75
Avg response
8.75

Gantt chart

P1
P2
P3
P4
08122126

Process table

ProcessATBTCTTATWTRT
P1088800
P214121177
P32921191010
P43526231818
Average15.258.758.75

AT arrival · BT burst · CT completion · TAT = CT − AT · WT = TAT − BT · RT = first time on the CPU − AT

Compare all algorithms

Same processes under every algorithm (Round Robin uses a time quantum of 2). Click one to view it.

AlgorithmAvg TATAvg WTAvg RT
15.258.758.75
14.257.757.75
lowest wait136.504.25
14.257.757.75
lowest wait136.504.25
19.2512.752

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use CPU Scheduling Calculator

  1. 1Paste the arrival times and burst times as space- or comma-separated lists (add priorities for priority scheduling).
  2. 2Pick an algorithm; for Round Robin, set the time quantum.
  3. 3Read the Gantt chart and the CT, TAT, WT and RT table, then compare the averages of all six algorithms side by side.

About CPU Scheduling Calculator

Why Scheduling Algorithms Trade Off Fairness Against Throughput

CPU scheduling algorithms decide which waiting process gets the processor next, and different algorithms optimize for genuinely different, sometimes conflicting goals. FCFS (First-Come-First-Served) is simple and fair in arrival order, but a single long process can force every process behind it to wait — the "convoy effect." SJF (Shortest Job First) minimizes average waiting time provably, but risks starving long processes indefinitely if short jobs keep arriving. Priority scheduling respects explicit importance levels, but faces the same starvation risk for low-priority processes without an aging mechanism. Round Robin gives every process a fixed time slice in rotation, guaranteeing fairness and responsiveness at the cost of higher overhead from frequent context switching.

Turnaround time (total time from arrival to completion) and waiting time (time spent ready but not running) are the standard metrics for comparing algorithms on a given workload — and the "best" algorithm genuinely depends on what a system actually needs: a responsive interactive system favors Round Robin's fairness, while a batch-processing system might prefer SJF's throughput optimization.

Visualizing the same process set as a Gantt chart under each algorithm side by side is the fastest way to build real intuition for these tradeoffs, since the abstract fairness-vs-throughput tension becomes concrete once you see the actual timeline differences.

Worked example

Four processes P1 to P4 arrive at times 0, 1, 2 and 3 with burst times 8, 4, 9 and 5 (the "Load example" set):

  • FCFS: P1 runs 0–8, P2 8–12, P3 12–21, P4 21–26. Waiting times are 0, 7, 10 and 18, so the average waiting time is 8.75 and the average turnaround time 15.25. Every later process waits behind the long P1: the convoy effect.
  • SJF (non-preemptive): P1 still runs first because it is alone at time 0, then P2, P4 and P3 in order of burst time. Average waiting time drops to 7.75.
  • SRTF (preemptive SJF): P1 is preempted at time 1 by the shorter P2, giving P1 0–1, P2 1–5, P4 5–10, P1 10–17, P3 17–26. Average waiting time falls to 6.5 and average turnaround to 13.
  • Round Robin, quantum 2: the average waiting time rises to 12.75, but the average response time is just 2, the best of all six. That trade-off is why interactive systems use Round Robin.

Turnaround time is completion time minus arrival time (TAT = CT − AT), and waiting time is turnaround minus burst (WT = TAT − BT).

Round Robin step by step: tracking the ready queue

Round Robin questions are marked on the ready queue, so here is a short one solved the exam way. Four processes arrive at 0, 1, 2 and 3 with bursts 5, 3, 1 and 2, and the time quantum is 2. Enter 0 1 2 3 and 5 3 1 2, pick Round Robin and the calculator draws the same Gantt chart.

Time Runs Ready queue afterwards
0–2 P1 (3 left) P2, P3, P1
2–4 P2 (1 left) P3, P1, P4, P2
4–5 P3 finishes P1, P4, P2
5–7 P1 (1 left) P4, P2, P1
7–9 P4 finishes P2, P1
9–10 P2 finishes P1
10–11 P1 finishes —

Two rules decide every step. A process that has used its full quantum goes to the back of the queue. A process that arrives during a slice, or exactly when it ends, joins the queue before the preempted one: at time 2, P3 arrives just as P1's slice ends, so the queue is P2, P3, P1 and not P2, P1, P3. A process with less than a quantum left (P3 here) runs only for what it needs, and the next slice starts at once.

Completion times are 11, 10, 5 and 9, giving turnaround times 11, 9, 3 and 6 (average 7.25) and waiting times 6, 6, 2 and 4 (average 4.5). FCFS on the same processes averages 6.75 and 4, which is lower, but its average response time is 4 against Round Robin's 1.75. That is the whole trade-off: Round Robin answers everyone sooner and finishes the long job later.

Where this fits

CPU scheduling is one of the core operating-systems topics. The others in this toolkit are page replacement (FIFO, LRU and Optimal), disk scheduling (FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK) and deadlock avoidance with the banker's algorithm. For Round Robin solved slice by slice with screenshots, read the Round Robin scheduling example.

Guides and tutorials

Frequently asked questions

What is the "convoy effect" in FCFS scheduling?

A single long-running process at the front of the queue forces every shorter process behind it to wait for the entire duration, dragging down average waiting time even though those later processes are individually quick.

Can Shortest Job First actually starve a process indefinitely?

Yes, in principle — if new shorter jobs keep arriving, a longer job can be repeatedly pushed back and never get scheduled, which is exactly why SJF is optimal for average waiting time but risky for fairness guarantees.

Why does Round Robin have more overhead than FCFS?

Round Robin forces a context switch every time a process's time slice expires, even if it hasn't finished — this fairness guarantee costs real CPU time spent switching contexts that FCFS's run-to-completion approach doesn't incur.

How do you calculate turnaround time, waiting time and response time?

Turnaround time is completion time minus arrival time (TAT = CT − AT). Waiting time is turnaround time minus burst time (WT = TAT − BT). Response time is the first time a process gets the CPU minus its arrival time. The calculator shows all three for every process, plus the averages.

In Round Robin, what happens when a process arrives exactly as a time slice ends?

This calculator follows the usual textbook convention: the newly arrived process joins the ready queue before the preempted process goes back to the end of it.

How do I solve a Round Robin scheduling problem?

Keep a ready queue. Run the process at the front for one time quantum or until it finishes, whichever is shorter. Add every process that arrived during that slice to the back of the queue, then put the preempted process behind them. Repeat until the queue is empty, then read completion times off the Gantt chart and compute TAT = CT − AT and WT = TAT − BT.

How do I choose the time quantum for Round Robin?

Exam questions give it. In real systems it is a trade-off: a very large quantum turns Round Robin into FCFS, and a very small one wastes CPU time on context switches. A common rule of thumb is that about 80% of CPU bursts should finish within one quantum. Try several values here and compare the averages.

Is Round Robin preemptive?

Yes. A process is preempted when its quantum expires, even if it has not finished, and goes to the back of the ready queue. FCFS and non-preemptive SJF and Priority run each process to completion instead.

How are ties broken?

Ties break by arrival time, then by the order you entered the processes. For priority scheduling, a lower number means a higher priority.

Have a suggestion for CPU Scheduling Calculator?Share your feedback ↗