- Home
- Engineering
- Computer
- Operating Systems
- 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.
Practice questions
Textbook-style questions. Press Solve in the tool to load the values and see the full solution. Underlined words are explained below.
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.
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.
Using SRTF, find the average waiting time for arrival times 0, 1, 2, 3 and burst times 8, 4, 9, 5.
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.
- Write the given values
- How the algorithm picks the next process
- Draw the Gantt chart
- Find CT from the chart, then TAT = CT − AT and WT = TAT − BT
- Average turnaround and waiting time
- Write the given values
FCFS (first come, first served) AT = 0 1 2 3 BT = 5 3 8 6 - 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.
- Draw the Gantt chartP10P25P38P41622Read it from left to right. The number under each edge is the time.
- Find CT from the chart, then TAT = CT − AT and WT = TAT − BT
Process AT BT CT TAT WT RT P1 0 5 5 5 − 0 = 5 5 − 5 = 0 0 P2 1 3 8 8 − 1 = 7 7 − 3 = 4 4 P3 2 8 16 16 − 2 = 14 14 − 8 = 6 6 P4 3 6 22 22 − 3 = 19 19 − 6 = 13 13 CT is where the process finishes in the chart. RT (response time) = first time it gets the CPU − AT. - Average turnaround and waiting time
Avg TAT = 5 + 7 + 14 + 194 = 11.25 Avg WT = 0 + 4 + 6 + 134 = 5.75
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.
| Symbol | What it means | SI unit |
|---|---|---|
| AT | Arrival times (AT) | text |
| BT | Burst times (BT) | text |
| q | Time 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.
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
- Type the known values from your question and pick the unit for each one.
- Press Solve step by step.
- 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.
- Check the answer, then go through each numbered step. Where there's a second method, it's shown after the main one.
- Stuck on a word? The terms section explains it in simple language.