Rust · clap only · no fabricated numbers
Chronos is a CPU scheduler in Rust. It simulates FIFO, SJF, round-robin, priority, and MLFQ over a set of processes and reports the actual completion, turnaround, waiting, and response times. Here is the real algorithm, running in your browser.
| PID | Arrival | Burst | Completion | Turnaround | Waiting | Response |
|---|
Chronos runs CPU scheduling algorithms for real: choose an algorithm, describe some processes, and watch the Gantt chart and metrics update instantly.
arrival time and a burst length, plus a priority for the priority scheduler. Use + Add process or Reset sample.The same five algorithms the Rust binary runs, ported line for line into the demo above.
Sorted by arrival time, ties by id. Runs each process to completion in that order, no interruption.
Non-preemptive. Among processes that have arrived, always picks the smallest remaining burst next.
Every ready process gets a fixed quantum, cycling through the queue until each one finishes.
Non-preemptive. Picks the lowest priority value among arrived processes, lower value runs first.
Three levels, quantum 4 then 8 then FCFS. A process that burns its whole quantum gets demoted a level.
Completion, turnaround, waiting, and response are computed from the real timeline, then averaged.
The binary prints the Gantt chart as a labeled block sequence with time marks underneath, then the per-process metrics and the averages. This is real output captured from the CLI.
Chronos is built to be trusted as a reference, not just to draw a chart. The design choices below are the reason.
Completion, turnaround, waiting, and response are computed from the actual simulated timeline of every scheduler, then averaged. Nothing is hand-fudged.
Every scheduler is a pure function of its input. The same processes always produce the same Gantt chart and metrics, which is what makes the tests meaningful.
Processes that all arrive at the same instant, idle gaps between arrivals, and a single-process workload are all handled without crashing.
The suite asserts exact metrics for every algorithm, including a traced round-robin run and an MLFQ run that demotes a long job across all three levels.
One subcommand, five algorithms, described entirely on the command line.
# round robin, quantum 2, three processes cargo run -- run --algo rr --quantum 2 --procs "0:5,1:3,2:8" # or pick any of the five algorithms cargo run -- run --algo fifo --procs "0:5,1:3,2:8" cargo run -- run --algo sjf --procs "0:8,1:3,2:4" cargo run -- run --algo priority --procs "0:5:2,1:3:1,2:8:0" cargo run -- run --algo mlfq --quantum 4 --procs "0:20,1:2"
The run subcommand takes --algo (fifo, sjf, rr, priority, mlfq), an optional --quantum, and --procs as a comma-separated list of arrival:burst or arrival:burst:priority entries. Built with clap and nothing else.
The schedulers ship as a Rust library crate (chronos, src/lib.rs), so the scheduling functions and metric computation are callable directly from your own code.
Run cargo test to drive every scheduler against exact, hand-computed metrics, including traced round-robin and multi-level MLFQ demotion cases.