Question 108Asked in CIL MT Systems, 26 Mar 2017 (12:30 PM)

Two concurrent processes P and Q execute the following code.

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. AW=P(T), X=V(S), Y=P(S), Z=V(T), S=1, T=0
  2. BW=P(T), X=V(S), Y=P(S), Z=V(T), S=T=1
  3. CW=P(T), X=V(T), Y=P(S), Z=V(S), S=T=1
  4. DW=P(T), X=V(T), Y=P(S), Z=V(S), S=1, T=0
Show answerHide answer

Correct answer: (A) W=P(T), X=V(S), Y=P(S), Z=V(T), S=1, T=0

From CIL MT Systems PYQ, 26 Mar 2017 (12:30 PM)

This is question 108 of CIL MT Systems PYQ, 26 Mar 2017 (12:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.