11.04.2013 Views

Concorrência: exclusão mútua e sincronização - UFF

Concorrência: exclusão mútua e sincronização - UFF

Concorrência: exclusão mútua e sincronização - UFF

SHOW MORE
SHOW LESS

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

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

Variável de Bloqueio<br />

Não confirma <strong>exclusão</strong> <strong>mútua</strong>:<br />

Processos entrar ao mesmo tempo em região crítica,<br />

pois dois processos podem testar turn antes de setá-la<br />

para true<br />

var turn: 0..1<br />

turn := 0<br />

Process Pi:<br />

...<br />

while turn = 1 do {nothing};<br />

turn := 1;<br />

< critical section ><br />

turn := 0;<br />

...

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

Saved successfully!

Ooh no, something went wrong!