If flag[j] is true then it will go in infinite will loop?

if , process 2 want to enter , then flag[j]=true,
then it will go for infinite time??

Hi @Vipin_coder,
See if flag[j] is true that means j process requested to do work before i process hence i process will let j process do the work so i process will wait until j process has finished the work and turn flag[j] = false; hence it will not take infinite loop as j process will complete its work at some point of time and after that it will turn flag[j]=false and i process will come out of infinite loop and complete its work

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.