CPU Scheduling Simulation

Watch how processes enter the ready queue, get dispatched onto the CPU core, and finish under FCFS, SJF, SRTF, and Round Robin.

Interactive simulation

CPU
IDLE
Ready queue
0
Completed
0 / 6
Avg WT
0.0
Avg TAT
0.0
Speed
1x
Ready Queue
CPU Core
IDLE
Done / Terminated
All Processes (click to select, then Terminate)
Animated Gantt Timeline

Legend

  • Waiting to arrive
  • In Ready Queue
  • Running on CPU
  • Completed
  • Selected (click Terminate)
  • Terminated

Event log

    How to use this simulation

    1. Pick FCFS, SJF, SRTF, or Round Robin (and quantum q), then press Dispatch or Resume to watch processes move into the Ready Queue and onto the CPU Core.
    2. Click any active process token to select it, then press Terminate to stop that process.
    3. Use Step to advance one event, Slower (down to 0.25x) and Faster (up to 4x) for animation speed, and Reset to restart.

    1. Ready Queue to CPU Core

    Processes enter the Ready Queue as their arrival time is reached. The scheduler picks the next process according to the active policy—arrival order in FCFS, shortest burst in SJF, shortest remaining time in SRTF, or rotating slices in Round Robin.

    2. Preemption & Time Quantum

    In SRTF, a newly arrived job with less remaining time preempts the current process. In Round Robin, a process runs until it finishes or uses up its quantum q, then returns to the ready queue.

    3. Waiting Time (WT) & Turnaround Time (TAT)

    Each process token displays its remaining burst RT and, once finished, its waiting time WT and turnaround time TAT.

    Scheduling algorithm comparison

    AlgorithmPreemptive?OrderStrengthTrade-off
    FCFSNoArrival orderSimple & predictableConvoy effect
    SJFNoShortest burstLow average waitStarvation of long jobs
    SRTFYesShortest remainingMinimal average waitFrequent preemption
    Round RobinYesFIFO + quantum qFair & responsiveContext switch overhead

    Key takeaways

    • TAT = Completion - Arrival and WT = TAT - Burst.
    • Watch the animated CPU Core and Gantt Timeline to see how preemption and quantum slices change execution order.

    Related topics

    Go-Back-N

    Sliding window ARQ with cumulative ACKs.

    Selective Repeat

    Sliding window ARQ with individual ACKs and buffering.

    Deadlock & Banker's Algorithm

    Resource allocation and safe-state checks.

    Coming soon

    Paging & Virtual Memory

    Address translation and page replacement.

    Coming soon