This is Problem 6.16, page 213, Silberschatz and Galvin, Operating System Concepts, fourth edition, Addison-Wesley, 1995.

Write a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of time units (ticks). You may assume the existence of a real hardware clock, which invokes a procedure tick in your monitor at regular intervals. Of course, SR already has nap(ms) and UNIX C already has sleep(secs). But don't use these in your monitor.


Fine-tune the starvation-free dining philosophers monitor so that a philosopher becomes very hungry only if its two neighbors alternate their collaborative eating three times.


Write a monitor for the sleeping barber problem. Modify it to support multiple barbers.


Write a monitor for another classical operating systems synchronization problem.