30.10.2014 Views

Operating Systems - David Vernon

Operating Systems - David Vernon

Operating Systems - David Vernon

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.

Processes<br />

InterProcess Communication IPC<br />

– Semaphores<br />

» solution to producer-consumer problem<br />

use 3 semaphores<br />

– full number of slots that are full (0 initially)<br />

– empty number of slots that are empty (N initially)<br />

– mutex ensure mutual exclusion (for access to<br />

buffer by producer and consumer)<br />

mutex is initialized to 1 and is a binary semaphore<br />

– it is used to guarantee only one process can enter<br />

its critical region at a given time<br />

– down(mutex) before entering critical region<br />

– up(mutex) after entering critical region<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!