1,542 views
0 0 votes
Process P1 Process P2
P(S1) P(S1)
P(S2) P(S2)
Critical Section Critical Section
V(S2) V(S1)
V(S1) V(S2)

In one of the Gateoverflow tests, this question was given and it was told that in the above case mutual exclusion is not guaranteed. But I can't understand why. As far as I see it, when any process accesses the Critical Section, both Semaphore S1 and S2 must be locked. When even one lock could suffice, here both are locked before accessing the critical section. As far as the order of unlocking, I dont see a problem there. Can someone please explain why mutual exclusion is not guaranteed?

1 Answer

0 0 votes
What is the type of semaphore s1 and s2 here???

Also provide initial values then only we can identify me is guaranteed or not
Position:
Show:

Related questions

2 2 votes
1 answers 1 answer
2.2k
2.2k views
LavTheRawkstar asked Nov 4, 2016
2,158 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,192 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...
1 1 vote
1 1 answer
2.0k
2.0k views
thor asked Sep 25, 2016
1,957 views
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 b...
0 0 votes
1 1 answer
844
844 views
N3314nch41 asked Sep 10, 2023
844 views
How to approach synchronization (specifically semaphore) question, there size are really intimidating and i’m unable to decode the code written? What to do??