Katkat

Identify and fix deadlock in locked code

BoxSoftware Engineer · Onsite

Last 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.