Box·Software Engineer·Technical Phone Screen
- You're given a multithreaded code snippet that acquires multiple locks and occasionally deadlocks. Walk through the exact deadlock scenario, then propose concrete code changes to prevent it. Cover approaches like consistent lock ordering, try-lock with backoff, timeouts, and lock granularity changes, and talk through the trade-offs of each.
“This one took longer than I expected.”