Q. 69 Consider two processes P1 and P2 accessing the shared variables X and Y protected
by two binary semaphores Sx and Sy respectively, both initialized to 1. P and V
denote the usual semaphore operators, where P decrements the semaphore value,
and V increments the semaphore value.The pseudo-code of P1 and P2 is as follows:
In order to avoid deadlock, the correct operators at L1,L2,L3 and L4 are respectively
(A) P(SY),P(SX);P(SX),P(SY)
(B) P(SX),P(SY);P(SY),P(SX)
(C) P(SX),P(SX);P(SY),P(SY)
(D) P(SX),P(SY);P(SX),P(SY)
Answer: (D)
Explanation: