Deadlock and Bounded waiting are independent of each other . What bounded waiting says => That if a process expresses its desire to enter critical section then there exists a bound on the number of processes that can enter CS, after this request has been made .
Take the function B = Count of the processes that can enter CS after any process has made a request .
1). One of the GATE questions,
/* P1 */
while (true) {
wants1 = true;
while (wants2 == true);
/* Critical Section */
wants1 = false;
}
/* Remainder section */
/* P2 */
while (true) {
wants2 = true;
while (wants1 == true);
/* Critical Section */
wants2=false;
}
/* Remainder section */
Clearly, Deadlock can happen in this case but is the BW satisfied ?
Yes, it is as when P1 and P2 are both in a while loop busy waiting , then both are desiring to go into the CS. So, suppose P1 wants to enter CS , then think of the case that how many times P2 has bypassed P1 before P1 is allowed to enter critical section. If you agree, that the number of times a process P1 may be bypassed is 0 ,i.e, B = 0 then yes, bounded waiting holds .
But, any other condition was not given in this question like priority of any process is higher or anything else, we can think like this. But, if there is a synchronization protocol, like CPU always executes P2, and never provides P1 the CPU to execute.
Well thats how suppose Synchronization mechanism is programmed for P1 and P2, that Mutex is satisfied and Progress is satisfied, but CPU always makes P2 run.
Now, if P1 has a desire to enter CS, then how many times has P2 bypassed it. It can be finite but not bounded, as there is a difference between Finite and bounded . So, it all depends on how the synchronization protocol is designed .
2). Yes, thats how the progress works. Progress means finite decisive time to enter critical section, that some day process will enter CS which is done in the entery section only.
For bounded waiting, How many processes in remainder section are allowed to enter CS after any other process has made a request . Also, all other parts of code which are not CS, i.e, except CS are called remainder sections, so how many of those processes are allowed to enter CS or bypass the process which has made a request to enter CS .