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 />

– Sleep and Wakeup<br />

» race condition occurs when:<br />

consumers tests value (previously read) count<br />

value is 0 so consumer sleeps()<br />

scheduler resumes producer<br />

eventually, producer will fill the buffer and sleep()<br />

now both producer and consumer sleep … deadlock!<br />

» Key problem: waking up a process that is not<br />

asleep … wasting a wakeup call<br />

» The solution is to use Semaphores<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!