Is bounded waiting ensured in given version of Dekker's solution for critical section problem? 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?
A reasonable definition of bounded waiting is:


  After a process made a request to enter its critical section and before it is granted the permission to enter, there exists a bound on the number of turns that other processes are allowed to enter.  [1]


In your case each process makes its request to enter by setting its flag (line 5 for Process 0, line 20 for Process 1.  The granting of permission is the test of the other process' flag (flag[1] false on line 6 grants permission to Process 0, flag[0] false on line 21 grants permission to Process 1).

So the only way to test the bounded waiting requirement here is to consider the case that Process 0 has just tested flag[1] on line 6, and found it true, and ask, "how many times can Process 1 leave and reenter the critical section while Process 0 is stuck in the loop?"  (Hint: consider the case where Process 0 has really bad luck, and Process 1 is able to leave and reenter the critical section during Process 0's delay on line 9).

[1] source: http://www.csl.mtu.edu/cs3331.ck/common/05-Sync-Basics.pdf