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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Comutação não Alternada<br />

Um processo entra na sua região crítica se o outro não<br />

estiver interessado<br />

Caso os dois processos estejam interessados o valor de<br />

turn decide qual processo ganha a região crítica<br />

P A<br />

interested[A] = true;<br />

turn = B;<br />

while (interested[B] && turn==B);<br />

< região crítica ><br />

interested[A] = false;<br />

P B<br />

interested[B] = true;<br />

turn = A;<br />

while (interested[A] && turn==A);<br />

< região crítica ><br />

interested[B] = false;

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

Saved successfully!

Ooh no, something went wrong!