Two concurrent processes P and Q execute the following code.

Process P:

While (True){

W:_____

Print(‘0’); print(‘0’);

X:____

}

Process q;

While (True){

Y;

print(‘1’); print(‘1’);

Z:_____

}

Given S and T are binary semaphore variables, and P() and V() as standard “wait” and “signal” functions respectively. What should be the semaphore operations W, X, Y, and Z for the output string: 11001100…? 

1
W = P (T), X = V(S), Y = P(S), Z = V (T), S = T = 1
2
W = P (T), X = V(T), Y = P(S), Z = V(S), S = T = 1
3
W = P (T), X = V (T), Y = P(S), Z = V(S), S = 1, T = 0
4
W = P(T), X = V(S), Y = P(S), Z = V(T), S = 1, T = 0

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation