Both Dekker's and Peterson's algo Account on the all 4 cases :
Mutual Exclusion is satisfied and progress is there that means freedom from deadlock .
Bounded waiting is satisfied , both are starvation free and there is no deadlock .
Consider a scenario where there are 2 person wants to enter in a cave . We start from person 1, he is giving the first try .
Dekker's Algorithm :
flag[0]=true; // "I want to enter." Here progress is satisfied .
while(flag[1]==true) // "If you want to enter and "
{
if(turn!=0) // "if it's your turn,"
{
flag[0]=false; // " I don't want to enter any more." Here it ensure No Starvation
while(turn!=0) {} // "If it's your turn I'll wait." Here Bounded waiting is satisfied
flag[0]=true; // "I want to enter."
}
}
// CS // "Enter into the Cave " Here Mutual Exclusion is satisfied
turn=1; // "You can enter next."
flag[0]=false; // "I don't want to enter any more." Ensure No Deadlock
Hence Dekker's Algorithm satisfy all four conditions .