Job scheduler · Cluster simulator · Python
A small job scheduler and cluster simulator. Submit a workload, run it under a scheduling policy, and read back the schedule plus the metrics a real cluster cares about — makespan, throughput, wait, turnaround, utilisation. There's also a real multiprocessing executor, so it's more than a sim.
Try it
minihpc — model, policies, discrete-event simulator, CLI, tests). This widget is a faithful in-browser port of the same logic so you can see the schedule build; the table below it shows the numbers from the actual Python run on the default workload.| metric | value |
|---|
Real run
From python demo.py — a fixed 8-job workload on 1 worker × 4 cores / 8 memory. The tight capacity is what makes the policies diverge.
| policy | makespan | throughput | avg wait | avg turn | util % |
|---|---|---|---|---|---|
| FIFO | 21 | 0.381 | 9.12 | 12.50 | 83.3 |
| SJF | 19 | 0.421 | 1.88 | 5.25 | 92.1 |
| Priority | 20 | 0.400 | 2.38 | 5.75 | 87.5 |
| Round-Robin | 18 | 0.444 | 8.62 | 12.00 | 97.2 |
| Backfill | 19 | 0.421 | 1.88 | 5.25 | 92.1 |
The model
id, arrival, runtime, cores, memory, priority — and an optional callable payload for the real executor.
A node with fixed cores/memory; runs several jobs at once if they fit. reserve/release make over-allocation impossible.
A pool of workers with aggregate capacity book-keeping — what the metrics layer reads from.
FIFO, SJF, Priority, Round-Robin and EASY-style Backfill — each just an ordering rule over the ready queue.
Tick clock that releases, admits, schedules first-fit, and jumps to the next event — no empty ticks.
Dispatches job payloads across a process pool in the policy's order, capped at cluster cores. More than a sim.
The loop
Free the cores and memory of every job whose finish tick has arrived.
Move newly arrived jobs into the ready queue.
Ask the policy to order the ready queue; place each job first-fit. Strict policies stop at a blocked head; backfill looks past it.
Jump the clock to the next arrival or completion and repeat.
# the whole engine, from Python from minihpc import demo_workload, compare cmp = compare(demo_workload(), n_workers=1, cores=4, memory=8) print(cmp.table()) # makespan / throughput / wait / turnaround / util