closed by
376 views
0 votes
0 votes
closed as a duplicate of: GATE IT 2004 | Question: 65
The Semaphore variable full, empty and mutex are initialized to 0, n and 1 respectively. Process P1 repeatedly adds one item at a time to a buffer of size n, and process P2 repeatedly removes one item at a time from the same buffer using the programs given below. In the programs, K, L, M & N are unspecified statements.

P1: while(1)

{       K;      

P(Mutex);      

Add item to buffer;      

V(mutex);      

L;       }

P2:

while(1)      {      M;    

          P(mutex);    

 Remove item from the buffer;    

 V(mutex);      

N;       }

These statements K, L, M & N are respectively:

(a) P(full), V(empty), P(full), V(empty)

(b) P(full), V(empty), P(empty), V(full)

(c) P(empty), V(full), P(empty), V(full)

(d) P(empty), V(full), P(full), V(empty)
closed by

Related questions

0 votes
0 votes
1 answer
3
Mrityudoot asked Jan 27
178 views
Can a counting semaphore acquire a negative value?S = 2;15 P operations done, should the semaphore be 0 or -13
1 votes
1 votes
1 answer
4