Concurrency, Synchronization & Deadlock Questions

Correctness of shared-state coordination between concurrent threads and tasks. Covers mutexes (futex-based and spin-then-sleep), semaphores, condition variables, spinlocks, reader-writer locks, and the producer-consumer pattern; atomic operations, compare-and-swap, lock-free and wait-free structures with the ABA problem and safe memory reclamation; memory ordering, barriers and acquire/release semantics; race conditions, data races, critical sections, time-of-check to time-of-use gaps and read-modify-write hazards; deadlock (the Coffman conditions, lock ordering, prevention and detection), livelock and starvation; priority inversion as a locking hazard and the priority-inheritance fix; designing thread-safe structures such as bounded queues, caches, rate limiters, event buses and work-stealing schedulers, with coarse versus fine-grained and per-key locking; alternatives to locking such as thread confinement, message passing, actors and transactional memory; and diagnosing and testing concurrency bugs (heisenbugs, race detectors, stress and replay, reviewing concurrent code). Excludes a specific language's threading API and memory model, concurrency for throughput and pool tuning, distributed locks and consensus, database isolation levels, RTOS ceiling protocols and schedulability, and interrupt masking between ISRs and main code.

HardTechnical
62 practiced

Compare lock-free algorithms against ordinary locking for a high-throughput service. Address contention behaviour, progress guarantees, memory reclamation and the risk of subtle bugs. When is lock-free actually faster?

MediumTechnical
65 practiced

Build a thread-safe rate limiter that allows bursts but caps the long-run rate. Explain your data structures and your synchronization, and how you keep the hot path fast under many concurrent callers.

MediumTechnical
63 practiced

A production service hangs. Thread dumps show many threads blocked on locks. How do you confirm a deadlock versus a livelock or priority inversion, what do you collect, and how do you recover and prevent a repeat?

HardSystem Design
57 practiced

Many requests miss the same cache key at once and all hit the backing store. Design per-key locking so only one does the fetch, and make sure the lock bookkeeping does not leak memory.

HardSystem Design
91 practiced

Design a concurrent append-only log with many producers and one consumer that preserves the global append order. How do producers claim positions, and what is the minimum synchronization needed for correct visibility?

Unlock Full Question Bank

Get access to all 32 Concurrency, Synchronization & Deadlock interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.