edited by
1,618 views
1 votes
1 votes

Consider two processes P1 and P2 accessing shared variable ‘x’ and ‘y’ protected by two binary semaphores Sx and Sy respectively both initialized to 1. ‘wait’ and ‘signal’ denote the usual semaphore operators, where wait decreaments the semaphore value, and signal increments the semaphore value.

S1: P = Wait (Sx), Q = Wait (Sy), R = Signal (Sx) and S = Signal (Sx) may lead to starvation.
S2: P = Wait (Sy ), Q = Wait (Sy), R = Signal (Sx) and S = Signal (Sx) may lead to race condition.

Which of the following is true?

How S1 lead to starvation? There is no While loop after performing the last signal operation, the process is not going to do these operations again. Also both these process executing two simple statement which will take constant time.

edited by

1 Answer

0 votes
0 votes
S1 not providing wound and wait

S2  provide deadlock because p1 will be  blocked there are two wait (Sy)  Sy value becomes 0 after p2 also get blocked if start from P1

But if start from P2 only it perform it's operation

Related questions

1.6k
views
3 answers
2 votes
Sambhrant Maurya asked Jan 3, 2019
1,608 views
P1 terminates but P2 does notP2 terminates but P1 does notBoth P1 and P2 terminateNeither P1 nor P2 terminate
824
views
0 answers
1 votes
MiNiPanda asked Jan 1, 2019
824 views
Consider the following 2 functions P and Q which share 2 common variables A and B:P() Q() { { A=A+5; A=B+6; B=A-3; B=A-2; } }If P and Q execute ... can take ____ (do not count B=3)Why have they taken intermediate values of B like 4..? :/
586
views
1 answers
0 votes
Gokulnath asked Dec 21, 2018
586 views
The definition of progress is: When no process is in the critical section and another process wants to enter the critical section, then it should be ... process is unable to enter the critical section.How does this achieve progress then?
1.3k
views
1 answers
0 votes
Parth Shah asked Oct 31, 2018
1,260 views
What is the main reason for RACE condition while synchronzing the process?A)The two processes trying to update the variable at same time.B) More than one ... at same time.C)Mutual Exclusion condition not satisfies.D)All of the above