@ srestha
I have few points to say :
Point 1:
At first only P1 apply for critical section . As no other process in this time in critical section,so P1 can get critical section easily.
see below code snippet from given algo :
while (wants2 == true); // there is a semicolon after while(), that means when condition is true inside while() it loop indefinitely .
And this condition is true as p2 makes ( wants2= true;) in the second line of it's code snippet .
..so P1 loop indefinitely and p1 can never enter into CS , it can only when (wants2=false;) but see the question again,
wants2=false; is done at end of P2 code snippet .
/* Critical Section */ // after getting away from while() loop , P1 can enter into CS but this not gonna happen here.
-------
Point 2 :
P1 can executes like P1 P1 P1................[As still now P2 hasnot make any request]
in P2 code snippet , at second line you can see
wants2 = true; is done by p2 means p2 has already make a request .
which contradicts your opinion.
-------
Point 3:
Now, P2 made request , but P1 still in CS. So, P2 have to wait.[Here bounded waiting applied]
How p1 still in CS ? it can never go to CS due to indefinite loop ( to be specific due to " ; " after while() )
Can you tell me how much time P2 have to wait ?
or after how many P1 , then P2 can try to enter into it's own CS ?
-----
Point 4:
P1 can executes like P1 P1 P1.
can you say specifically how many times this p1 p1 p1 continue ? if you count how many times p1 execute then there BW is satisfied .[ again Galvin definition ]
-------
Point 5 :
after apply and before grant this P2 request, how many time P1 can execute?
P2 will wait for CS, until P1 comes out. So, bounded wait is 1 here
just few lines above you said it would be like p1 p1 p1 ... then how BW is 1 here ?
if BW is 1 then it must be only p1 , is not it ?
My sincere applogize for my arguments and wasting all your time . I would be happy if you clear my doubts .
Thanks.