882 views
0 votes
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 votes
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

Related questions

0 votes
0 votes
2 answers
2
shivajikobardan asked Jul 22, 2023
726 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 votes
1 votes
1 answer
3
thor asked Sep 25, 2016
1,200 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 votes
0 votes
1 answer
4
N3314nch41 asked Sep 10, 2023
341 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??