InterviewStack.io LogoInterviewStack.io

Synchronization Primitives and Inter Task Communication Questions

Master synchronization mechanisms: semaphores (binary, counting), mutexes, condition variables, and message queues. Understand when to use each primitive and their trade-offs. Discuss potential issues: priority inversion, deadlock, race conditions, and how to prevent them. Explain interrupt-safe synchronization. Discuss critical sections and atomic operations.

EasyTechnical
66 practiced
Describe what a mutex (mutual exclusion) lock is, how it differs from a semaphore in terms of ownership and semantics, common API primitives (lock/unlock, try_lock), and SRE scenarios where mutexes are preferred (e.g., protecting shared in-memory state). Include a brief note on reentrancy and why it matters.
HardSystem Design
59 practiced
Design a concurrency-safe in-memory cache used by a web service that uses per-key locking to prevent a thundering herd on cache misses. Provide approaches such as lock striping, per-key lock objects with weak references to avoid memory leaks, lock pooling, and describe a garbage-collection strategy for unused locks.
MediumTechnical
68 practiced
Tail-latency spikes are correlated with mutex contention in a Linux service. Describe how you would profile and identify the hottest locks and critical sections across containers using tools like perf, eBPF, and flamegraphs, and propose mitigation strategies such as sharding, batching, lock elision, or move-to-thread-local.
MediumTechnical
63 practiced
Design an alert that detects elevated lock contention causing increased request latency for a web service. Specify which metrics you would collect (for example: mutex wait time histograms, syscall latency, queue sizes), how you would set thresholds, and include immediate runbook steps the on-call engineer should follow.
HardTechnical
64 practiced
Propose an adaptive backoff algorithm for high contention locks in a cloud environment that accounts for variable VM performance and noisy neighbors. Explain how you choose spin length versus blocking, how to apply exponential backoff with jitter, and which metrics you would collect to tune parameters automatically.

Unlock Full Question Bank

Get access to hundreds of Synchronization Primitives and Inter Task Communication interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.