28.01.2015 Views

PDF format

PDF format

PDF format

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Problem 4 (30 pts)<br />

a) (15 pts) Three processes share four resource units that can be reserved and<br />

released only one at a time. Each process acquires and releases resources over<br />

time but only needs a maximum of two resource units at any one time. Deadlock<br />

can not occur. Why<br />

b) (15 pts) Consider a system consisting of m resources of the same type, being<br />

shared by n processes. Resources can be requested and released by processes<br />

only 1 at a time. Show that the system is deadlock free if the following two<br />

conditions hold:<br />

(I) The max need for each process is between 1 and m resources.<br />

(II) The sum of all max needs is less than n + m.<br />

Problem 5 (15 pts)<br />

In lecture we said that, if the semaphore operations Wait and Signal are not executed<br />

atomically, then mutual exclusion may be violated. Assume that Wait and Signal are<br />

implemented as below:<br />

void Wait (Semaphore S) {<br />

while (S.count

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

Saved successfully!

Ooh no, something went wrong!