CampusFlow
OSCPU Scheduling

CPU Scheduling Simulator

Simulate FCFS, SJF, SRTF, Round Robin and Priority scheduling with Gantt chart.

—ms

Avg WT

—ms

Avg TAT

—%

CPU Util

Algorithm

FCFSNon-Preemptive

First Come First Served — processes execute in arrival order. Simple but can cause convoy effect.

Best for: Batch systems

Processes

ProcessArrival TimeBurst TimePriority

Algorithm Comparison

AlgorithmPreemptiveStarvationOverheadBest For
FCFSNoNoLowBatch systems
SJFNoYesMediumBatch with known burst
SRTFYesYesHighInteractive systems
RRYesNoMediumTime-sharing OS
PriorityNoYesMediumReal-time systems

Interview Questions

Q: What is the convoy effect in FCFS?

A: When a long process holds the CPU, causing shorter processes to wait — leading to poor average waiting time.

Q: Why is SJF optimal for average waiting time?

A: By always picking the shortest job, it minimizes the total waiting time across all processes.

Q: What is the difference between SJF and SRTF?

A: SJF is non-preemptive (runs to completion), SRTF is preemptive (can be interrupted by a shorter job).

Q: What happens if quantum is too large in Round Robin?

A: It degenerates to FCFS. If too small, context switching overhead becomes significant.

Q: What is aging in priority scheduling?

A: Gradually increasing the priority of waiting processes to prevent starvation.