Saved Bookmarks
| 1. |
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 semaphone operators, where P decrements the semaphore value, and V increments the semaphore value. The pseudo-code of P1 and P2 is as follows : P1 : While true do { L1 : ................ L2 : ................ X = X + 1; Y = Y - 1; V(SX); V(SY); }P2 : While true do { L3 : ................ L4 : ................ Y = Y + 1; X = Y - 1; V(SY); V(SX); }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» None | |