Is Bounded Waiting satisfied for this 2 process Solution? This is my new post linked with my previous post. 

Is bounded waiting satisfied in the 2 Process Solution?



The answer in that post was very useful and cleared many concepts, but I just want to apply that answer for this example, that how BW works here .

Especially, I want to know this definition works for this example.


  Define $k$-bounded waiting for a given mutual exclusion algorithm to
  mean that if $D_A^j \to D_B^l$ then $CS_A^{j} \to CS_B^{l+k}$.




Here, the Question comes


  What can be said bout the Bounded Waiting of this 2 process solution"


&lt;------- P1 -------> 

While(True)
{
    acquire(lock1)
    acquire(lock2)
        withdraw(from, amount)
        deposit(to, amount)
    release(lock2)
    release(lock1)
}


&lt;-------- P2 -------->

While(True)
{
    acquire(lock1)
    acquire(lock2)
        withdraw(from, amount)
        deposit(to, amount)
    release(lock2)
    release(lock1)
}
In the following, I treat the first two statements acquire(lock1) acquire(lock2) as "trying", the middle two statements withdraw(from, amount) deposit(to, amount) as the "critical section", and the last two statements release(lock2) release(lock1) as "exiting".

This algorithm does not satisfy the bounded waiting property. Consider the following execution: $P_1$ and $P_2$ simultaneously execute acquire(lock1) and $P_1$ wins. $P_1$ acquires lock2 successfully, enters the critical section, and then exit by releasing locks. Now, $P_1$ and $P_2$ contend on acquire(lock1) again and $P_1$ wins again .... In this way, $P_2$ is actually starved.