System Design: Traffic-Light Control for a Multi-Road Intersection
Context
Design the software and systems for controlling a signalized, multi-approach intersection. Assume you are building the on-controller logic, the local APIs, and the central management interfaces used to deploy and monitor a network of intersections.
Requirements
-
State explicit goals and assumptions:
-
Examples to address: number of approaches and lanes, protected/permissive turn arrows, pedestrian and bike crossings, emergency vehicles, public transit priority, railroad preemption (if any), and sensor availability/types.
-
Define core components:
-
Controllers, sensors, actuators, communications.
-
Data model and key APIs (configuration, control, telemetry).
-
Specify the control logic:
-
State machine for signal phases and pedestrian intervals.
-
Timing calculations: fixed-time vs. actuated/adaptive.
-
Coordination across approaches and between intersections (peak/off-peak plans, offsets).
-
Safety and reliability:
-
Conflict avoidance, intergreen (yellow/all-red) intervals, concurrency rules.
-
Preemption/priority (emergency, transit), failure detection, and safe fallback modes.
-
Operations:
-
Monitoring/observability, deployment strategy, and scaling to a citywide network.
-
Follow-ups:
-
With more time, what optimizations would you implement?
-
How would you design comprehensive unit tests and simulations, including deterministic time control and edge cases?