Gate CS-2004 Question Paper With Solutions

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:

Gate CS-2004 Question Paper With Solutions

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:

Gate CS-2004 Question Paper With Solutions

Learn More:   Gate EE-2015-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here