Bird
Raised Fist0

In a distributed system where multiple processes on different machines need mutual exclusion over a shared resource, which synchronization primitive is most appropriate and why?

medium🧠 Conceptual Q6 of Q15
Operating Systems - Semaphore vs Mutex - When to Use Which
In a distributed system where multiple processes on different machines need mutual exclusion over a shared resource, which synchronization primitive is most appropriate and why?
ALocal mutex on each machine
BDistributed mutex implemented via consensus algorithms
CCounting semaphore on one machine
DBinary semaphore without network coordination
Step-by-Step Solution
Solution:
  1. Step 1: Identify distributed mutual exclusion need

    Processes on different machines require coordination.
  2. Step 2: Choose synchronization primitive

    Distributed mutex using consensus (e.g., Paxos, Raft) ensures mutual exclusion across machines.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Distributed mutex handles cross-machine exclusion [OK]
Quick Trick: Distributed mutex uses consensus for cross-machine locking [OK]
Common Mistakes:
MISTAKES
  • Using local mutex which doesn't coordinate across machines
  • Counting semaphore on one machine doesn't cover all
  • Binary semaphore without network coordination fails
Trap Explanation:
PITFALL
  • Local primitives don't provide distributed mutual exclusion
Interviewer Note:
CONTEXT
  • Tests understanding of synchronization in distributed systems
Master "Semaphore vs Mutex - When to Use Which" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes