CS FundamentalsHardGATE CS
Which property distinguishes a mutex from a binary semaphore in most implementations?
- A. A mutex has an owner: only the thread that locked it may unlock it, which enables priority inheritance and error checks
- B. A mutex can count above 1
- C. A binary semaphore cannot be used for mutual exclusion
- D. A mutex is always implemented with busy waiting
Correct answer: A. A mutex has an owner: only the thread that locked it may unlock it, which enables priority inheritance and error checks
A semaphore has no notion of ownership: any thread may signal it, which suits signalling between threads. Ownership lets a mutex detect misuse and boost the owner's priority.
More Operating Systems questions
- A spinlock is held for about 50 ns on average, and a context switch costs about 5 µs. On a multicore machine, which is better for a thread…
- compareandswap(&v, expected, new) atomically sets v = new only if v == expected and returns the old value. A lock-free increment is…
- Which condition makes disabling interrupts an INSUFFICIENT way to implement a critical section?
- Two threads run on different cores. Thread 1: data = 42; ready = 1; Thread 2: while (!ready); print(data); Both variables are plain…
- How many of these statements about the critical-section problem are correct? 1. Progress means only processes not in their remainder…
- In Lamport's bakery algorithm, why does a process pick a number with number[i] = max(number) + 1 while choosing[i] is true, and break ties…