No Login Data Private Local Save

CPU Scheduler Simulator - Online FCFS, SJF, Round‑Robin

6
0
0
0

CPU Scheduler Simulator

Visualize and compare FCFS, SJF (Non-Preemptive), and Round Robin scheduling algorithms

Process Input Table
Process ID Arrival Time Burst Time Action

Edit values directly in the table. Arrival Time ≥ 0, Burst Time > 0.

Click Simulate to visualize CPU scheduling

Choose an algorithm, configure processes, and run the simulation.

Frequently Asked Questions

FCFS is the simplest CPU scheduling algorithm. Processes are executed in the order they arrive in the ready queue. The process that arrives first gets the CPU first. While easy to implement, it can lead to the convoy effect, where short processes get stuck behind long processes, increasing average waiting time. It is non-preemptive by nature.

SJF selects the process with the smallest CPU burst time from the pool of available (arrived) processes. This simulator implements the non-preemptive version, meaning once a process starts executing, it runs to completion without interruption. SJF is provably optimal for minimizing average waiting time, but it requires knowing burst times in advance and may cause starvation for longer processes.

Round Robin assigns each process a fixed time quantum (time slice). Processes execute in a circular order—each gets up to the time quantum, then the CPU moves to the next process in the ready queue. If a process doesn't finish within its quantum, it's placed back at the end of the queue. This ensures fair CPU distribution and good response times, making it ideal for time-sharing systems. Performance heavily depends on choosing an appropriate time quantum.

Waiting Time = Total time a process spends waiting in the ready queue (Turnaround Time − Burst Time).
Turnaround Time = Total time from process arrival to completion (Completion Time − Arrival Time).
Response Time = Time from arrival until the process first gets the CPU (first scheduled time − arrival time).
Lower values for all these metrics indicate better scheduling performance.

In non-preemptive scheduling (like FCFS and this simulator's SJF), once a process gets the CPU, it holds it until completion or until it voluntarily yields. In preemptive scheduling (like Round Robin or SRTF), the OS can forcibly remove a running process from the CPU to give another process a turn. Preemptive scheduling provides better responsiveness but has higher context-switching overhead.

The time quantum should be large enough to minimize context-switching overhead (typically 10–100 ms in real systems), but small enough to provide good response times. A good rule of thumb: set the quantum so that 80% of CPU bursts are shorter than the quantum. If the quantum is too large, RR behaves like FCFS. If too small, excessive context switching degrades performance. Experiment with different values in this simulator to see the impact!

The convoy effect occurs in FCFS when a long CPU-bound process holds the CPU while many short processes queue up behind it. This dramatically increases average waiting time. Imagine a long truck (long process) leading a convoy of sports cars (short processes) on a single-lane road—everyone moves at the truck's speed. SJF and Round Robin help mitigate this issue.

Yes! When multiple processes arrive at the same time, tie-breaking rules apply. In FCFS, the process listed first (lower Process ID index) executes first. In SJF, among processes with the same arrival time, the one with the shortest burst time is chosen; if burst times are also equal, the lower Process ID wins. In Round Robin, they enter the ready queue in the order they appear in the input table.