GATE Computer Science (CS) 2014 Shift 2 Solved Paper
© examsiri.com
Question : 41 of 65
Marks:
+1,
-0
Consider the procedure below for the Producer-Consumer problem which uses semaphores:
Which one of the following is TRUE?
|
semaphore n = 0; semaphore s = 1; void producer() { while(true) { produce(); semWait(s); addToBuffer(); semSignal(s); semSignal(n); } } |
void consumer() { while(true) { semWait(s); semWait(n); removeFromBuffer(); semSignal(s); consume(); } } |
Which one of the following is TRUE?
Go to Question: