The producer and Consumer processes share the following Variables:
The producer and Consumer processes share the following Variables:
int n,
Semaphore M = 1
Semaphore E = n
Semaphore F = 0
The consumer process must execute ______ and ______ before removing an item from buffer.
Show answerHide answer
Correct answer: (D) Wait (F), Wait (M)
Explanation
A consumer first does wait(F) to make sure a full slot exists, then wait(M) for mutual exclusion on the buffer, and only then removes the item.