Two concurrent processes P and Q execute the following code. Process P:…

Coal India · Computer Science · 2017

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. A.

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

  2. B.

    W = P(T), X = V(S), Y = P(S), Z = V(T), S = T = 1

  3. C.

    W = P(T), X = V(T), Y = P(S), Z = V(S), S = T = 1

  4. D.

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

Attempted by 271 students.

Show answer

Correct answer: A

The worked solution is available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…