Question 31
A Binary Semaphore can take integer values restricted exclusively to:
Option C is correct. Binary Semaphores take values 0 (locked) or 1 (unlocked), functioning similarly to Mutex locks.
A Binary Semaphore can take integer values restricted exclusively to:
Option C is correct. Binary Semaphores take values 0 (locked) or 1 (unlocked), functioning similarly to Mutex locks.
In standard Dijkstra Semaphore notation, what happens when a process executes the wait() (or P() / down()) operation on a semaphore S with value $S = 1$?
Option A is correct. wait(S) decrements S. If S becomes < 0, the process blocks. Since S was 1, wait(S) sets $S=0$ and proceeds without blocking.
What operation does signal(S) (or V() / up()) perform on a semaphore S?
Option A is correct. signal(S) increments S by 1. If processes were blocked on S, one of them is moved to the ready state.
A semaphore implementation that wastes CPU cycles while repeatedly looping in a while-check loop to acquire a lock is called a:
Option B is correct. Spinlocks use busy waiting where a thread continuously polls a lock in a loop, consuming CPU cycles.
In the Bounded-Buffer (Producer-Consumer) problem using semaphores, what semaphore initialized to N represents the number of empty slots?
Option C is correct. In the Bounded-Buffer problem, the empty counting semaphore is initialized to buffer capacity N, while full is initialized to 0.