William Stallings discuss various step by step process in developing Dekker's algorithm in his Operating Systems book. In process, he reaches to following version of algorithm (which is incomplete as it results in livelock):
1
2 /* PROCESS 0 */
3 .
4 .
5 flag[0] = true;
6 while (flag[1])
7 {
8 flag[0] = false;
9 /* delay */ ;
10 flag[0] = true;
11 }
12 /* critical section*/;
13 flag[0] = false;.
14
15 .
16
17 /* PROCESS 1 */
18 .
19 .
20 flag[1] = true;
21 while (flag[0])
22 {
23 flag[1] = false;
24 /* do */ ;
25 flag[1] = true;
26 }
27 /* critical section*/;
28 flag[1] = false;.
29
30 .
31
32
I want to know whether above algorithm satisfies the "bounded waiting" requirement of critical section solution.
My current opinion is that, if process 0 fails on lines 6,7,8,11,12,13,14,15, that is all lines where flag[0] is already set to true, then process 1 will be blocked and hence will result in unbounded waiting. Am I correct?
Also is there easy way to find whether given/proposed algorithm for critical section problem solution satisfies "bounded waiting" requirement?