InterviewStack.io LogoInterviewStack.io

Concurrency and Synchronization Questions

Covers the principles and practical techniques for safely coordinating concurrent execution and access to shared resources. Topics include models of concurrency such as threads, processes, interrupt handlers, and tasks in a real time operating system; differences between preemptive and cooperative scheduling; shared data hazards including race conditions and read modify write hazards; critical sections and approaches to protect them including disabling interrupts in embedded contexts and scoped locks. Synchronization primitives and patterns are included: mutexes, binary semaphores, counting semaphores, condition variables, message queues, atomic operations and lock free primitives such as compare and swap. Memory ordering concerns and memory barrier usage on multi core systems are covered, along with priority inversion and priority inheritance. Also addressed are deadlock, livelock, and starvation concepts and avoidance strategies, granularity and performance trade offs of locking, and practical synchronization patterns. Preparation should include identifying and fixing races in code, designing correct concurrent interfaces, and debugging and testing techniques such as stress testing, instrumentation, deterministic replay, race detectors, static analysis, and code review strategies.

MediumTechnical
85 practiced
During a release, an intermittent race causes data corruption in production. You're the on-call SRE: describe immediate mitigation steps to reduce customer impact, how you'd determine whether to rollback or patch, and practical steps to reconcile corrupted data if necessary.
HardSystem Design
88 practiced
Design a locking strategy for a high-throughput distributed cache that must support 100k ops/sec and provide per-key strong consistency for writes. Discuss per-key locks versus shard-leader approaches, lease durations, failure modes, and how to minimize tail latency under heavy contention.
MediumTechnical
57 practiced
Design instrumentation to detect increasing lock contention in production over time for a core service. What metrics would you collect (examples: lock hold time histogram, wait time percentiles, number of blocked threads), how would you visualize them, and what automated alerts or thresholds would you configure to notify SREs before customer impact?
EasyTechnical
65 practiced
You're reviewing a pull request that adds a new shared cache protected by a global lock. List five specific concurrency-related items you would look for in the code review to prevent bugs and performance regressions, and recommend two test cases or stress tests the author should add before merging.
HardSystem Design
53 practiced
Compare coordination approaches for configuration changes: consensus (Raft/Paxos), leaderless replication (CRDTs), and lease-based locking. For an SRE managing global configuration with strong SLOs, discuss availability, consistency, latency, operational complexity, and failure recovery trade-offs for each approach and give recommended use cases.

Unlock Full Question Bank

Get access to hundreds of Concurrency and Synchronization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.