773 views

2 Answers

1 votes
1 votes

 initially FLAG is FALSE  when PROCESS P1 tries to enter in CRTITICAL SECTION If condition is TURE after that making FLAg value false... now PRREMPT the process P1 when it is present in CS . after that try the above code for P2 process hence now FLAG value is TRUE here for p2 process If condition falis .therfore p2 will not enter the CS hencew mutual exclusion will be satisfied.. r
 

therefore starvation occur For EXACTLY ONE PROCESS EITHER U FIRST START FROM process P1 or FROM P2.. HENCE NO DEADLOCK!

edited by
0 votes
0 votes
Processes p1 & p2 does not get the lock in the mutually exclusive manner. Every process coming out of the critical section releases the lock by setting critical_flag=FALSE. So,no deadlock is possible. But there is a possibility of starvation as the process coming out of critical section makes the request for the critical section & is allowed to do so & letting the other process to wait infinitely. But the overall system satisfies the progress requirement.
edited by

Related questions

9 votes
9 votes
2 answers
3
0 votes
0 votes
2 answers
4
shivajikobardan asked Jul 22, 2023
795 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...