in Operating System
578 views
1 vote
1 vote

what is difference between in both question...? it  is totally look same just difference in variable.

https://gateoverflow.in/1256/gate2007-58 

https://gateoverflow.in/8405/gate2015-3-10

 

in Operating System
578 views

2 Comments

in the 2007 question,

while (wants2 == true);

it means, if wants2=true ====> P1 is in continuous loop

 

in the 2015 question,

 while (varQ == true)
    {
        /* Critical Section */
        varP = false;
    }

VarQ=true ====> X entered in Critical Section.

 



 wants1 = true;
    while (wants2 == true);
    /* Critical Section */
    wants1 = false;

 

equivalent to 

wants1 = true;
while (wants2 == true)
{


}
    /* Critical Section */
wants1 = false;

 

BUT IT IS NOT EQUVIVALENT TO

wants1 = true;
while (wants2 == true)
{
    /* Critical Section */
    wants1 = false;
} ( this is GATE2015 Question )
3
3
I got it...thanks...
0
0

Please log in or register to answer this question.