Bird
Raised Fist0

What issue arises if a binary semaphore used as a mutex is initialized with a value greater than 1?

medium🐞➡️ Bug-Guided Q7 of Q15
Operating Systems - Semaphore vs Mutex - When to Use Which
What issue arises if a binary semaphore used as a mutex is initialized with a value greater than 1?
AIt behaves exactly like a mutex with no issues
BIt causes the semaphore to deadlock immediately
CIt allows multiple threads to enter the critical section simultaneously, breaking mutual exclusion
DIt prevents any thread from entering the critical section
Step-by-Step Solution
Solution:
  1. Step 1: Understand binary semaphore initialization

    Binary semaphore initialized >1 allows multiple acquires without blocking.
  2. Step 2: Effect on mutual exclusion

    Multiple threads can enter critical section simultaneously, violating mutual exclusion.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Binary semaphore >1 breaks mutual exclusion [OK]
Quick Trick: Binary semaphore must be initialized to 1 for mutex behavior [OK]
Common Mistakes:
MISTAKES
  • Assuming semaphore >1 still enforces exclusion
  • Thinking it causes deadlock
  • Believing it blocks all threads
Trap Explanation:
PITFALL
  • Higher initial count allows multiple concurrent entries, unlike mutex
Interviewer Note:
CONTEXT
  • Tests understanding of semaphore initialization and mutual exclusion
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