Question 36
What is a Busy-Waiting Semaphore also known as?
A semaphore or mutex lock that requires busy waiting (where a process loops continuously while checking if the lock is available) is called a Spinlock.
What is a Busy-Waiting Semaphore also known as?
A semaphore or mutex lock that requires busy waiting (where a process loops continuously while checking if the lock is available) is called a Spinlock.
What are the two atomic operations associated with a Counting Semaphore S?
Semaphores are accessed only through two standard atomic operations: wait() (traditionally called P from Dutch 'proberen') and signal() (traditionally called V from Dutch 'verhogen').
A binary semaphore S is initialized to 1. A process executes wait(S) followed by signal(S). What is the value of S after these two operations?
Initial $S = 1$. After wait(S), S becomes 0. After signal(S), S becomes 1. Therefore, the final value of S is 1.
A counting semaphore S is initialized to 10. Then 6 wait(S) operations and 2 signal(S) operations are performed on S. What is the resulting value of S?
Initial $S = 10$.
6 wait(S) operations decrease S by 6: 10 - 6 = 4.
2 signal(S) operations increase S by 2: 4 + 2 = 6.
Final value of $S = 6$.
A counting semaphore S is initialized to 7. A sequence of 12 wait(S) and 5 signal(S) operations are executed. What is the value of S?
Initial $S = 7$. Twelve wait(S) operations decrease S by 12 and five signal(S) operations increase S by 5. Net change = -12 + 5 = -7, so the final value is 7 - 7 = 0.