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
68 practiced
A cryptographic key rotation job updates in-memory keys while request threads verify tokens. What synchronization pattern would you use to guarantee readers see a consistent key version without pausing all traffic?
HardTechnical
55 practiced
A static analyzer flags a potential data race in a secure telemetry collector, but the team believes the code is safe because the write is atomic. How would you evaluate whether the code is actually safe, and what additional issues besides atomicity would you check?
MediumTechnical
59 practiced
Implement a thread-safe sliding-window rate limiter in C++ for login attempts. It must support many concurrent callers, keep the hot path fast, and return allow or deny for each request. Explain your data structures and synchronization strategy, including how you would expire old entries.
HardTechnical
57 practiced
Given a security appliance that must process packets in parallel across cores, identify where memory barriers or acquire/release semantics would be required if one thread publishes a new rule table and another thread consumes it. What bugs can appear if the barriers are wrong or missing?
HardSystem Design
100 practiced
In a multi-tenant SIEM pipeline, several threads update shared correlation state, per-tenant quotas, and alert deduplication tables. Design a synchronization strategy that prevents deadlocks and reduces contention while still preserving tenant isolation and predictable latency.

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.