Elevator LLD: The Sweep That Schedules Your Building (and Your Disks)
A low-level design walkthrough of an elevator system: why first-come-first-served zigzags, the LOOK sweep algorithm, hall calls vs car calls, direction as state — fully implemented and tested.
"Design an elevator." Phase 3 opens with the most famous intermediate LLD there is — famous because it looks like an object-modeling exercise and is secretly a scheduling problem. Anyone can write class Elevator { int floor; }. The interview begins when four people on four floors press buttons at once and your design has to decide whose turn it is — and the obvious answer, first-come-first-served, produces an elevator that visibly loses its mind. The real answer is an algorithm so good it escaped the building: your hard disk's scheduler runs the same sweep. Let's design the whole machine — bot…
What’s inside
Read this one free
Sign in and your first premium article is on us — read Elevator LLD: The Sweep That Schedules Your Building (and Your Disks) free.