1. Home
  2. Engineering
  3. Computer
  4. Operating Systems
  5. CPU Scheduling Calculator (FCFS, SJF, SRTF, Round Robin)

CPU Scheduling Calculator (FCFS, SJF, SRTF, Round Robin)

Gantt chart plus completion, turnaround, waiting and response time for every process, and the averages.

Operating SystemsEngineeringIntermediateStep-by-step solution

Practice questions

Textbook-style questions. Press Solve in the tool to load the values and see the full solution. Underlined words are explained below.

  1. Four processes arrive at 0, 1, 2 and 3 ms with burst times 5, 3, 8 and 6 ms. Find the average waiting time using FCFS.

  2. Processes P1 to P5 arrive at 0, 2, 4, 6, 8 with burst times 3, 6, 4, 5, 2. Draw the SJF (non-preemptive) Gantt chart and find the average TAT and WT.

  3. Using SRTF, find the average waiting time for arrival times 0, 1, 2, 3 and burst times 8, 4, 9, 5.

  4. Three processes arrive at time 0 with burst times 24, 3 and 3. Find the average waiting time with Round Robin, quantum = 4.

Worked example

Here's the first practice question solved in full, so you can see exactly what you'll get. Try it on paper before you read the steps.

Question: Four processes arrive at 0, 1, 2 and 3 ms with burst times 5, 3, 8 and 6 ms. Find the average waiting time using FCFS.

Plan: how this problem is solved
  1. Write the given values
  2. How the algorithm picks the next process
  3. Draw the Gantt chart
  4. Find CT from the chart, then TAT = CT − AT and WT = TAT − BT
  5. Average turnaround and waiting time
Answer
Average waiting time5.75
Average turnaround time11.25
Average response time5.75
All processes finish att = 22
Step-by-step solution
  1. Write the given values
    FCFS (first come, first served)
    AT=0 1 2 3
    BT=5 3 8 6
  2. How the algorithm picks the next process

    The CPU runs processes in the order they arrive. Once a process starts, it runs to the end.

  3. Draw the Gantt chart
    P10
    P25
    P38
    P41622
    Read it from left to right. The number under each edge is the time.
  4. Find CT from the chart, then TAT = CT − AT and WT = TAT − BT
    ProcessATBTCTTATWTRT
    P10555 − 0 = 55 − 5 = 00
    P21388 − 1 = 77 − 3 = 44
    P3281616 − 2 = 1414 − 8 = 66
    P4362222 − 3 = 1919 − 6 = 1313
    CT is where the process finishes in the chart. RT (response time) = first time it gets the CPU − AT.
  5. Average turnaround and waiting time
    Avg TAT=5 + 7 + 14 + 194
    =11.25
    Avg WT=0 + 4 + 6 + 134
    =5.75
Key idea: Waiting time is the time a process sits ready but not running. SJF gives the lowest average waiting time when all jobs are known, but long jobs can starve. Round Robin is fair and gives quick response, at the cost of more switching.

Terms used on this page

New to a word in the question or the solution? Here it is in simple language.

Process (P1, P2 …)
A program that's running. Many processes take turns on one CPU, and the scheduler decides the order.
Arrival time (AT)
The moment a process becomes ready to run.
Burst time (BT)
How much CPU time a process needs to finish its work.
Completion time (CT)
The moment a process finishes. You read it off the right edge of its last block in the Gantt chart.
Turnaround time (TAT)
Total time from arrival to finish: TAT = CT − AT.
Waiting time (WT)
Time a process spent ready but not running: WT = TAT − BT.
Response time (RT)
Time from arrival until the process gets the CPU for the first time.
Gantt chart
A time bar that shows which process used the CPU and when. Times are written under the edges of each block.
Preemptive and non-preemptive
Non-preemptive: once a process starts, it runs to the end. Preemptive: the CPU can be taken away in the middle, for example when a shorter job arrives.
FCFS, SJF, SRTF and Round Robin
FCFS runs jobs in order of arrival. SJF picks the shortest job. SRTF is SJF that can interrupt. Round Robin gives each job a fixed time slice in turn.
Time quantum
The fixed time slice each process gets in Round Robin before it goes to the back of the queue.

Symbols in this solver

What each box asks for, and its unit.

SymbolWhat it meansSI unit
ATArrival times (AT)text
BTBurst times (BT)text
qTime quantum (Round Robin only)(no unit)

Formula & concept

Gantt chart, completion, turnaround, waiting and response time of every process, and the averages, for FCFS, SJF, SRTF and Round Robin.

TAT = CT − AT,   WT = TAT − BT,   RT = first start − AT

Key idea: Waiting time is the time a process sits ready but not running. SJF gives the lowest average waiting time when all jobs are known, but long jobs can starve. Round Robin is fair and gives quick response, at the cost of more switching.

How to use this calculator

  1. Type the known values from your question and pick the unit for each one.
  2. Press Solve step by step.
  3. Read the plan first. It lists the steps the solution will follow. Want to try it yourself? Tick Practice mode and the answer stays hidden until you ask for it.
  4. Check the answer, then go through each numbered step. Where there's a second method, it's shown after the main one.
  5. Stuck on a word? The terms section explains it in simple language.

Frequently asked questions

How does the CPU Scheduling work?
You enter the values you know, pick their units and press Solve. The tool changes everything to SI units, applies the formula TAT = CT − AT, WT = TAT − BT, RT = first start − AT and shows you each step: given data, formula, substitution and the final answer.
What is the key idea behind it?
Waiting time is the time a process sits ready but not running. SJF gives the lowest average waiting time when all jobs are known, but long jobs can starve. Round Robin is fair and gives quick response, at the cost of more switching.
What if my answer doesn't match my book?
First check that you've picked the right units. Then see which constants your book uses and how many figures it rounds to. You can change the number of figures under Settings in the solver. A small difference in the last digit is usually just rounding.
Can I see how to solve it without seeing the answer?
Yes. Tick Practice mode under the solver. You'll get the plan of steps only, so you can work it out on paper. One click then shows the full solution.
Is the CPU Scheduling free to use?
Yes, it's free with no sign-up. All calculations happen inside your browser and nothing you type is stored.
Which grades is it useful for?
It's made for Engineering (University · B.Tech · B.E. · Diploma · GATE · FE). The working follows the method used in textbooks and exams.