294 views
0 votes
0 votes
In Peterson's solution if P0 sets it's interested and then preempt or terminate the P1 will keep waiting at while loop for indefinite time then how progress is guaranteed

1 Answer

0 votes
0 votes
Bro When P0 sets its interest(Flag=TRUE) and suddenly got preempted without executing turn   and then  process p1 comes then p1 will find While loop as true because (Flag(P0)==T and  turn==1) it will be in busy wait after that p0 will be resumed and find while loop as true (Flag(P1)==T and  turn==0) then it will be in busy wait but now p1 will get into critical section because turn is now 0(set by p0)  and then comes out from  Critical section  and then set flag(P1==F) which will make process 0 to get into critical section and if it agains wanted to get into critical section then it will get into it because if process p1 doesn't want to get into critical section then process p0 will find FLAG(p1=F) hence while loop will be false and PROGRESS is GUARANTEED.

Related questions

0 votes
0 votes
1 answer
1
ajayraho asked Oct 23, 2022
875 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
717 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?
0 votes
0 votes
0 answers
3
Tushar Garg asked Aug 22, 2018
389 views
In peterson's process synchronisation the process which perform 4th statement i.e (turn= process )first will get the critical section but if this is happen then their is...
0 votes
0 votes
0 answers
4
Anuranjan Chauhan asked Aug 8, 2018
171 views