Design an intersection traffic-light system

Quick Overview

This question evaluates system design competency across real-time control and safety-critical logic, API and data modeling, sensor/actuator integration, and operational scalability for traffic-signal controllers.

Design an intersection traffic-light system

Company: Amazon

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design a traffic-light control system for a multi-road intersection. State explicit goals and assumptions (e.g., number of lanes, pedestrian/bike crossings, turn arrows, emergency vehicles, public transit priority, sensor availability). Define core components (controllers, sensors, actuators), data model, and APIs. Specify the state machine for signal phases, timing calculations (fixed-time vs. adaptive), coordination across approaches, and handling of peak/off-peak patterns. Explain strategies for safety (conflict avoidance, all-red intervals), concurrency, preemption/priority, failure detection and safe fallback modes, monitoring/observability, deployment, and scaling to a citywide network. Follow-ups: If given more time, what optimizations would you implement? How would you design comprehensive unit tests and simulations, including deterministic time control and edge cases?

Overview: This question evaluates system design competency across real-time control and safety-critical logic, API and data modeling, sensor/actuator integration, and operational scalability for traffic-signal controllers.

|Home/System Design/Amazon
Amazon logo
Amazon
Sep 6, 2025
hardSoftware EngineerTechnical ScreenSystem Design
24
0

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

  1. 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.
  2. Define core components:
    • Controllers, sensors, actuators, communications.
    • Data model and key APIs (configuration, control, telemetry).
  3. 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).
  4. Safety and reliability:
    • Conflict avoidance, intergreen (yellow/all-red) intervals, concurrency rules.
    • Preemption/priority (emergency, transit), failure detection, and safe fallback modes.
  5. Operations:
    • Monitoring/observability, deployment strategy, and scaling to a citywide network.
  6. 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?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...