• edited by
1,714 views
3 3 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?

1 Answer

0 0 votes
S1 looks correct...bounded waiting may not be satisfied in a solution with semaphore but since we have progress so it's true

but S2 is false
Position:
Show:

Related questions

2 2 votes
1 1 answer
803
803 views
charul asked Jan 24, 2018
803 views
does this satisfy progress , if no then why?
3 3 votes
1 1 answer
1.4k
1.4k views
shaz asked Jan 16, 2019
1,394 views
Consider the below code for synchronizing the classical readers and writers. int rc = 0; int c = 0; Semaphore mutex =1; Semaphore db =1; void Reader(void) { L1: down (mut...
1 1 vote
0 0 answers
1.1k
1.1k views
snaily16 asked Jan 12, 2019
1,077 views
Fails to Guarantee mutual exclusion Guarantee mutual exclusion and prevents deadlockFails to prevent deadlockFails to guarantee mutual exclusion and fails to prevent dead...
2 2 votes
3 3 answers
2.8k
2.8k views
Sambhrant Maurya asked Jan 3, 2019
2,813 views
P1 terminates but P2 does notP2 terminates but P1 does notBoth P1 and P2 terminateNeither P1 nor P2 terminate