Peterson two process solution :: bounded waiting:
- Assume $P_1$ and $P_2$ tries to enter into critical section.
- By above statement, it is implied that they have executed initial parts of the codes and initialized a couple of global flags .
- Assume $P_1$ gets success and enters the critical section and $P_2$ waits in
while loop
.
- After some time $P_1$ exits from the critical section.
- Bounded waiting could be violated if $P_1$ again get a chance and if somehow it attempts again and successfully enter into critical section while $P_2$ still in waiting in
while loop
. But this can not happen because of a global flag named turn.