Code RoomDistributed semaphore
HardPrep Room Coding #3741

Distributed semaphore

System designConcurrencyDistributed systemsSenior–Staff~45 min

Design a distributed semaphore / quota system that caps concurrency of an expensive shared resource — e.g. "at most 100 concurrent connections to a fragile legacy mainframe" — across hundreds of caller pods. Constraints: the global in-flight count must never meaningfully exceed 100, permits must be released even if a holder crashes, and acquire should block-with-timeout rather than reject. Explain how permits are counted, how concurrent acquirers coordinate, and how leaked permits are reclaimed.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify5:00 left
Estimate5:00 planned
Design15:00 planned
Deep dive12:00 planned
Failure8:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.