Design an elevator system 00:00:00 Make a prediction You will separate dispatch decisions from car safety and compare two candidate assignments with a concrete floor trace. A car on floor four is travelling up to ten. A rider on three presses up. Is that car automatically the fastest pickup merely because it is one floor away? No. Direction and existing stops matter. A second car coming up from below can reach the rider sooner. The dispatch policy selects a car; the selected car still controls movement and doors. 00:00:34 One morning at the lighthouse lift Outside a lift, the passenger leaves an up tag on floor three. Inside a car, the passenger presses a destination. Giving the dispatcher the first tag does not authorize it to open a moving car's doors. Hall calls, assigned stops and car events are different messages. Give each one an owner and preserve the safety rule across every dispatch choice. An elevator system in a low-level design round is the control software of one or more cars. It turns presses into promises (this car will come), promises into an order of stops, and the order into single steps of a motor and a door. Everybody has waited for a lift and been angry at it. That makes it a good exercise: each person has requirements without reading a document. 00:01:23 Separate assignment from safe motion A rider on floor three presses up. The hall call contains a floor and a direction, while the destination button inside the car is a different request. The dispatcher chooses a suitable car based on its current direction and planned stops. The car accepts the stop and owns its movement and door state. On arrival, the car stops before opening its doors. An assignment policy can change without allowing the dispatcher to bypass this safety transition. Pick a car for the request, then simulate an obstructed door before movement begins. Dispatch ownership tells you which car should serve the stop; it cannot override the car's own movement permission. Releasing a hall call also must not falsely certify that movement is safe. 00:02:13 A nearby car may be a poor choice A car on floor four is going up with passengers for floor ten. A second car below floor three is already travelling up. Choosing the numerically closest car might delay pickup. Trace both routes using the policy, and ask whether waiting time or throughput matters more. A request at floor three wants to go down. The car one floor away is travelling up with passengers through ten. A farther car approaching in the right direction may arrive sooner. Compare route estimates under the same dispatch policy instead of using distance alone. A nearest-car rule ignoring direction can repeatedly make unhelpful assignments under traffic. Evaluate the agreed objective with sample routes. A small building may only need a simple direction-aware policy; make the dispatcher replaceable before adding a sophisticated optimizer. A disk scheduler can group requests in the order of physical locations while observing waiting-time constraints. Database engines can sometimes coordinate scans to reuse pages already being read. These are analogies for scheduling. Neither supplies lift safety rules; the dispatch objective and the movement controller still have distinct responsibilities in our exercise. 00:03:30 Try an interview follow-up How would you handle emergency protocols like a fire alarm in your elevator system? For this interview model, ask which emergency mode the prompt requires. Suppose the building controller requests recall. It overrides ordinary hall and cabin stops and directs the car to the designated recall floor, or an alternate selected by the controller. Ordinary service resumes only after an authorized reset. Real lift safety behaviour is determined by the equipment and its applicable code. Car two is marked out of service while it owns three unserved hall requests. How should the design avoid forgetting those riders? Track hall requests independently from a car's stop list. Withdraw assignments and return eligible requests to dispatch. A completed cabin trip and a still-waiting passenger represent different facts, so do not blindly copy every stop into another car. 00:04:32 What to take with you A bank remembers which car promised which call. A dispatcher chooses, a car drives. The car holds cabin floors and hall calls apart, goes on while there is a stop ahead, then turns, and opens for the other direction only where it turns. One tick does one thing: open, wait or move. The wait comes before the move, and that line is the interlock. Estimates run on a copy of the car. Modes come before stops, threads talk through one inbox.