1,949 views
1 1 vote

Can Mutual exclusion can be enforced with a general semaphore initial value is greater than 1 ?

I think yes. Consider a semaphore $S = 2$, and following code segment for both processes.

P(S);
P(S);
<Critical Section>
V(S);
V(S);

1 Answer

3 3 votes

Yes Mutual exclusion is guaranteed with s=2.

But this solution also lead to DeadLock.

Position:
Show:

Related questions

0 0 votes
1 1 answer
1.5k
1.5k views
humblefool asked Dec 13, 2017
1,539 views
Process P1Process P2P(S1)P(S1)P(S2)P(S2)Critical SectionCritical SectionV(S2)V(S1)V(S1)V(S2)In one of the Gateoverflow tests, this question was given and it was told that...
2 2 votes
1 answers 1 answer
2.2k
2.2k views
LavTheRawkstar asked Nov 4, 2016
2,157 views
difference in following: [i] mutual exclusion [ii] critical section [iii] semaphore
0 0 votes
2 2 answers
2.2k
2.2k views
shivajikobardan asked Jul 22, 2023
2,191 views
Sorry if this is a stupid question. But it really intrigued me. Same resources at different algorithms are telling different ways to test these stuffs.Here's an algorith...
3 3 votes
3 answers 3 answers
3.4k
3.4k views
Purple asked Jan 29, 2016
3,439 views
var occupiedvar blockedEnter Region:{If (occupied) {then blocked= blocked +1sleep ( );}else occupied= 1;}Exit Region:{occupied= 0If (blocked) {then wakeup (process);block...