5. Predavanje - VTS NS
5. Predavanje - VTS NS
5. Predavanje - VTS NS
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Uposleno čekanjeRešenje (Peterson 1981.):process P1beginloopflag1:=true; turn:=2; (* Announce intent to entry *)while flag2 and turn=2 do null end; (* Busy wait *) (* Critical section *)flag1 := false; (* Exit protocol *)endend P1;process P2beginloopflag2:=true; turn:=1; (* Announce intent to entry *)while flag1 and turn=1 do null end; (* Busy wait *) (* Critical section *)flag1 := false; (* Exit protocol *)endend P2;Problemi:neefikasnostsloženost, posebno za opšti slučaj višeprocesa55/285