← Quiz: Semaphores and Classic Problems: all 9 questions
Quiz: Semaphores and Classic Problems · Question 5 of 9
Why must signal() check "value ≤ 0" rather than "value < 0" before waking a process?
Why must signal() check "value ≤ 0" rather than "value < 0" before waking a process?
- A.It is a matter of style only
- B.After adding 1, a value of 0 means one process was still waiting before the signal
- C.Values can never be negative
- D.So that it wakes every process
Answer & explanation
Correct answer: After adding 1, a value of 0 means one process was still waiting before the signal
A value of −1 before the signal (one waiter) becomes 0 after it, and that waiter must be woken.
Can you get the rest right without peeking?
Take the timed Quiz: Semaphores and Classic Problems quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →