{{ summaryTitle }}
{{ summaryValue }}

{{ summaryLine }}

Utilization{{ resultsReady ? formatPercent(schedule.utilization) : '—' }} Makespan{{ resultsReady ? `${schedule.makespan} ticks` : '—' }} Switches{{ resultsReady ? schedule.context_switches : '—' }}
{{ summaryAnnouncement }}
{{ stageAnnouncement }}
CPU scheduling workload
Ties use arrival time, then source-row order. Lower priority numbers run first.
One row per process: ID, arrival, burst, priority. Use 1–8 rows.
Samples replace the process rows.
ticks
Whole ticks from 1 to 20.
ticks
Zero is neutral. Use up to 10 ticks to study scheduling overhead.
{{ playbackLabel }}
Shorter delays advance the live rail faster.
{{ traceExportStatus }}
StepKindProcessStartEndReady queueDecisionCopy
{{ row.step }}{{ row.kind }}{{ row.process }}{{ row.start }}{{ row.end }}{{ row.ready_queue }}{{ row.decision }}
{{ chartExportStatus }}

The chart renderer is unavailable. The same timing values remain in the ledger.

{{ ledgerExportStatus }}
ProcessArrivalBurstFirst startCompletionTurnaroundWaitingResponsePriorityCopy
{{ row.id }}{{ row.arrival }}{{ row.burst }}{{ row.first_start }}{{ row.completion }}{{ row.turnaround }}{{ row.waiting }}{{ row.response }}{{ row.priority }}
Notes
{{ section.title }}

{{ section.body }}

Introduction:

When several runnable processes share one CPU, only one can make progress at a time. A scheduler decides who runs next, how long that process keeps the CPU, and what happens when new work arrives. The same workload can therefore feel responsive under one policy and sluggish under another even though every process eventually receives the same amount of service.

The central trade-off is between simple ordering, short completion times, fast first responses, fairness, and dispatch overhead. First-Come, First-Served preserves arrival order but can leave short jobs behind a long one. Shortest Job First favors a short ready job, while Shortest Remaining Time First can interrupt current work when an even shorter job arrives. Priority scheduling follows an assigned rank. Round Robin instead gives each ready process a bounded turn and rotates unfinished work through a queue.

CPU scheduling questions and the timing measures that answer them
QuestionTiming measureCommon misreading
How long until the process first runs?Response timeA fast first response does not guarantee an early finish.
How much time passes from arrival to completion?Turnaround timeTurnaround includes both useful CPU service and time spent waiting.
How long is the process ready but not running?Waiting timeWaiting is not the same as idle CPU time.
How much elapsed time performs process work?CPU utilizationA high percentage alone says nothing about fairness or responsiveness.

Policy comparisons only make sense when the workload assumptions stay fixed. Arrival times, CPU bursts, priority numbers, time quantum, and context-switch cost can all change the outcome. Tie handling matters too: two mathematically valid implementations may produce different schedules if they break equal arrivals or equal bursts differently.

A bounded teaching schedule is not a full operating system. Real schedulers also respond to I/O blocking, multiple cores, interrupts, changing priorities, affinity, and incomplete knowledge of future CPU bursts. The simplified model is best used to study dispatch rules and timing consequences, not to predict the performance of a particular machine.

How to Use This Tool:

Keep one workload fixed while changing the scheduling policy. That makes differences in the trace and timing ledger attributable to the policy rather than to different inputs.

  1. Choose a Scheduling policy. For Round Robin, also set a whole-number Time quantum from 1 to 20 ticks.
  2. Enter one to eight Processes, one per line, as ID, arrival, burst, priority. IDs must be unique; arrival may be 0, burst must be at least 1, and a lower priority number runs first.
  3. Open Advanced when context-switch overhead matters. A cost of 0 adds no time; a positive cost adds elapsed non-service ticks when the CPU changes directly from one process to another.
  4. Start the dispatch playback, then pause or step through the ready-queue decisions. The playback cadence changes only animation speed, not the computed schedule.
  5. Compare Average waiting time, utilization, makespan, the per-process timing ledger, and the dispatch trace. Reload the same rows under another policy before drawing a conclusion.

Interpreting Results:

Start with the per-process rows, not the average alone. A low mean waiting time can hide one process that waits much longer than the rest, while a short response time may belong to a process that finishes late. The dispatch trace explains where each delay came from by separating run, idle, and context-switch spans.

  • Makespan is the elapsed time from tick 0 through the final completion, including idle and context-switch time.
  • Utilization counts service ticks as a percentage of makespan. Added switch cost lowers it because overhead consumes elapsed time without completing a burst.
  • Throughput is completed processes per tick for this finite workload. It is not a long-run capacity guarantee.
  • Policy notes describe the observed workload only. Keep arrival, burst, priority, quantum, and switch cost unchanged when comparing policies.

Technical Details:

The schedule advances in whole ticks on one CPU. Ready processes have arrived and still have burst time remaining. Non-preemptive policies retain the selected process until completion; SRTF reconsiders the ready set after every service tick; Round Robin returns unfinished work to the back of its first-in, first-out queue after a quantum expires.

Rule Core:

Exact dispatch rules used by the CPU scheduling simulation
PolicySelection rulePreemption and ties
FCFSChoose the earliest-arriving ready process.Run to completion; equal arrivals follow source-row order.
SJFChoose the ready process with the smallest original burst.Run to completion; ties use arrival, then row order.
SRTFAt each tick, choose the smallest remaining burst.A shorter arrival may preempt; ties use arrival, then row order.
PriorityChoose the ready process with the lowest numeric priority.Run to completion; ties use arrival, then row order.
Round RobinTake the head of the ready queue for at most one quantum.Unfinished work returns behind arrivals observed during its turn.

If no process is ready, the CPU jumps to the next arrival and records an idle span. Context-switch cost is inserted only for a direct change from one running process to another. An idle gap clears that direct-switch relationship.

Formula Core:

For process i, let A be arrival, B burst, S first start, and C completion, all in ticks.

Ti=Ci-Aiturnaround Wi=Ti-Biwaiting Ri=Si-Airesponse U=service ticksmakespan×100%Q=completed processesmakespan

Averages are arithmetic means across all process rows. The display rounds average timings and percentages, while the schedule retains the full computed values. For example, arrival 2, first start 5, burst 4, and completion 9 give response 3 ticks, turnaround 7 ticks, and waiting 3 ticks.

Model boundaries:

Process rows are limited to arrivals from 0 to 100 ticks, bursts from 1 to 100 ticks, priorities from 0 to 99, and a total simulated schedule no longer than 5,000 ticks. CPU bursts are known in advance. I/O blocking, multicore execution, priority aging, affinity, and operating-system-specific queues are deliberately omitted.

Worked Examples:

A short job arrives behind a long one

Suppose P1 arrives at tick 0 with a 7-tick burst and P2 arrives at tick 2 with a 1-tick burst. FCFS keeps P1 until tick 7, so P2 first runs at tick 7 and waits 5 ticks. SRTF preempts P1 at tick 2, completes P2 at tick 3, then resumes P1. The example shows why the same total service can produce very different response and waiting times.

References: