Apex › Systems & OS

Timing wheel

How systems that manage millions of timers (the Linux kernel, Kafka, Netty) schedule them in O(1) instead of a heap's O(log n). A circular array of buckets and a hand that advances one tick at a time; a timer for "d ticks from now" drops straight into bucket (current + d) mod N — no sorting. Schedule timers and tick the hand around to watch them fire, with a rounds counter for delays beyond one revolution.

More in Systems & OS