30.10.2014 Views

Operating Systems - David Vernon

Operating Systems - David Vernon

Operating Systems - David Vernon

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

while (turn == process && interested[other] == TRUE) ; /* wait */<br />

Processes<br />

/* process 0 */<br />

main () {<br />

while (TRUE) {<br />

do_some_work();<br />

enter_region(0);<br />

critical_section();<br />

leave_region(0);<br />

do_more_work();<br />

}<br />

}<br />

/* process 1 */<br />

main () {<br />

while (TRUE) {<br />

do_something();<br />

enter_region(0);<br />

critical_section();<br />

leave_region(0);<br />

do_something_else();<br />

}<br />

}<br />

process: 0<br />

other: 1<br />

turn<br />

interested<br />

0<br />

1 0<br />

Copyright © 2007 <strong>David</strong> <strong>Vernon</strong> (www.vernon.eu)

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

Saved successfully!

Ooh no, something went wrong!