InterviewSolution
Saved Bookmarks
| 1. |
A shared variable x, initialized to one, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing x to memory. Semaphore S is initialized to two. Which of the following set(s) has/have possible value of x after all processes complete execution?Note – This question is multiple select questions (MSQ).(A) {-2, -1, 0, 1, 2}(B) {-3, -2, -1, 0, 1, 2}(C) {-3, -2, -1, 0, 1, 2, 3}(D) {-4, -3, -2, -1, 0, 1, 2} |
| Answer» | |