Case 1: turn = 0 or 1
This solution allows Mutual Exclusion for 2 process.
But there is strict alteration, P1 then P2 and so on…
Means No progress.
Therefore, It is not a correct solution.
Here, processes are never asked whether it want to enter the c.s. or not.
Case 2: Lets say, now we create a boolean array of Flag
One value of P1and the other for P2. If the process is interested in c.s. must
Reflect its flag value as True.
This solution allows Mutual Exclusion.
If P2 do not want to go to c.s. then P1 can do again and again(due to flag)
So, No Strict alteration.
But if P1 wants to go to c.s and executed flag = T and due to some reason
pre-empted and then P1 wants to go to c.s. and executed flag = True.
Now flag array is TT
No process can go to c.s (Deadlock Condition)
Therefore, No progress.
Case 3: Peterson’s Solution OR Decker’s Algorithm
Turn = 0 or 1 Flag
It allows both Mutual Exclusion and progress.
It also supports Bounded Wait.
But applicable for two processes only.