12.07.2015 Views

Spis treœci - Patrz

Spis treœci - Patrz

Spis treœci - Patrz

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

eginif ls[i] > O then begines[i] := es [i] - 1;ls[i] := ls[i] - 1;pój [i] := true;V(S[i])endend; {dajSINGLE}procedure daj AND;beginif ls[0] * ls[l] > O then beginca := ca - 1;Is[O] := Is[O] - 1;ls[l] := ls[l] - 1;pój [0] := false;pój [1] := false;V(A)endend; {daj AND}procedure daj;beginif ca = O then begin {nikt nie chce wykonać PAND}if cs[0] > O then dajSINGLE(O);if cs[l] > O then dajSINGLE(l)endelse {ktoś czeka na wykonanie PAND}if cs[0] * cs[l] > O then{są czekający na S[0] i S[l]}if pój [0] and pój [1] then{ostatnio na obu wykonano PSINGLE}daj AND {można dać czekającemu na oba}else begin {jeśli po j [0] and not poj[l]}dajSINGLE(O); {lub na odwrót, to priorytet też}dajSINGLE(l) {mają operacje PSINGLE}endelseif cs[0] > O then {ktoś czeka na S[0] , nikt na S[l]>if pój [0] then {ostatnio na S[0] było PSINGLE}daj AND {można dać czekającemu na oba}else {ostatnio na S[0] wykonano PAND}dajSINGLE(O)elseif cs[l] > O then {ktoś czeka na S[l], nikt na S[0]}if pój [1] then {ostatnio na S[l] było PSINGLE}daj AND {można dać czekającemu na oba}else {ostatnio na S[l] było PAND}dajSINGLE(l)else {nikt nie czeka ani na S[0],}daj AND {ani na S[2]}end; {daj}procedure YSINGLE (i: nrsem);beginPB(W);ls[i] := ls[i] + 1;daj;if (ls[i] > ca) and (cs[i] > 0) then dajSINGLE(i);VB(W)end;51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!