closed by
524 views
1 votes
1 votes
closed with the note: I got the answer I was looking for

Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.

Method used by P1 Method used by P2
while (S1==S2);
Critical Section
S1=S2;
while (S1!=S2);
Critical Section
S2 = not(S1)

The above two processes are both deadlock free and starvation free . Is this statement right? Because both s1 and s2 are taking different sets of values to enter the critical section and hence no way they are getting blocked out all at once from their critical section.So no deadlock.
Also its starvation free .

closed by

1 Answer

Best answer
3 votes
3 votes
Yes, This sequence of statements is both Deadlock free & Starvation free. Though as you can see, Progress is not guranteed. (If P1 does not want to enter critical section it can block P2 & so on !)
selected by

Related questions

0 votes
0 votes
1 answer
1
ajayraho asked Oct 23, 2022
876 views
What is the significance of infinite loop that is written in every example of process synchronisation? What would happen if there wasn't any infinite loop?
3 votes
3 votes
0 answers
2
iarnav asked Sep 28, 2018
720 views
Any implementation of a critical section requires the use of an indivisible machine- instruction ,such as test-and-set?Is the above statement True or False?