Scheduler 04: Leader Election

From Scratch · Distributed Scheduler. Follows Scheduler 03: Heap and Timing Wheel, which made “what fires next” cheap, and hands off to Scheduler 05: Dispatch Queue.
Before you start. This series builds a small copy of a job scheduler: a program whose whole purpose is to fire other programs at the right moment, the way a phone alarm goes off at 7am with nobody watching the clock by hand. So far, that scheduler runs on one machine, a single computer, and it can already hold thousands of pending jobs while always knowing which one fires next without checking every one of them. This lesson is about what happens the moment you stop trusting that one machine to stay up, and run three of it instead.