Task Scheduler, tick by tick

At every CPU tick, run the available task with the most copies left (a max-heap). After it runs, it goes into a cooldown queue until n ticks have passed, then rejoins the heap. If nothing is available, the CPU idles.

Try:
CALL
1 / 1

CPU timeline

One box per interval. Hatched = idle.

Code

The highlighted line runs next. Ties are broken alphabetically in all three languages, so every version produces the same schedule.

Scheduler state

heap tasks ready to run, most copies left first (shown in priority order)

cooldown queue first in, first out; each task waits n ticks before it can run again

← front (next to be released)back (just ran) →

Task counts

faded = already run

Dry-run trace

Every step as a row. Click a row to jump there.

#ActiontimeDetailheapcooldown

Keyboard: ← → step, Space play or pause. Up to 24 tasks, letters A–Z, n from 0 to 8.