Identify and fix deadlock in locked code
BoxSoftware Engineer · OnsiteLast updated
Identify and fix deadlock in locked code evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
You are given a multithreaded code snippet that acquires multiple locks and sometimes deadlocks. Identify the precise deadlock scenario and propose code changes to prevent it. Discuss techniques such as consistent lock ordering, using try-lock with backoff, timeouts, or changing lock granularity, and analyze trade-offs.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.