Due: In class or via email, Wednesday April 28, 10:20 am
1. Text, page 204, Question 6.16, alarm clock monitor.
2. Show how Mesa monitors can be implemented using semaphores.
To do this, you need to give implementations for monitor procedure
entry,
monitor procedure exit, condition variable wait, and condition
variable notify. (Ignore timeouts on waits and condition variable
broadcast. Assume that a notifier keeps the monitor lock until it exits
the monitor or issues a wait.)
3. Give a Mesa monitor version for a bounded semaphore (defined in Homework #2).
4. A chunking semaphore is one that permits the request (P) and release (V) of any positive number of units. It is an abstraction for a multi-unit resource allocator, for example, for main storage blocks or disk sectors. The operations are defined:
P(S, n): <
await S ³
n ®
S := S - n >
V(S, n): < S := S + n>
In both cases, n is an arbitrary positive integer and the operations
are indivisible.
Note that n can vary from call to call. Thus, for example, P(S,6),
V(S,1), V(S,200), and P(S,35) are all permissible with the same semaphore
S.
Write a Hoare monitor that implements chunking semaphores. Use priorities
on the waits with a "smallest requester first" scheduling policy.
5. Write a Hoare monitor for a binary semaphore with timeout. Your monitor should have three procedures: