CSE221 Monitors and Mesa

Andreas Anagnostatos (aanagnos@cs.ucsd.edu)
Thu, 11 May 2000 02:14:58 -0700

C. A. R. Hoare, "Monitors: An Operating System Structuring Concept,"
Communications of the ACM, Vol. 17, No. 10, October, 1974, pp. 549-557.

The paper defines the use of monitors as a mechanism to provide
exclusive controlled access to resources as well as scheduling. A
monitor is simply a piece of code with procedures and data where only
one process can execute at any one time. A process acquires the monitor
lock on entrance and releases it on exit. A process cannot enter a
monitor if it cannot acquire the monitor lock. Several examples are
given for the use of monitors such as a bounded buffer, an alarm clock
and the writters-readers problem. Finally, some considerations are
presented with regards to the disjointness of monitors and the
possibility of a deadly embrace (deadlock).

B. W. Lampson and D. D. Redell, "Experience with Processes and Monitors
in Mesa," Communications of the ACM, Vol. 23, No. 2, February 1980, pp.

The authors of this paper express some of the difficulties experienced
with monitors in the development of Pilot, an operating system written
in Mesa. Previous work on monitors does not deal with the complexity the
arises when building a large application such as an operating system.
The authors had to deal with and find solutions for a number of problems
such as nested monitor calls, priority scheduling, handling of timeouts,
aborts and exceptions, and creation and destruction of processes. The
paper then presents how these primitives and solutions interact with the
Pilot operating system and their effects in flexibility and performance.

An interesting point made in the paper is that scheduling policy should
be decided at a higher level than monitors. Therefore, monitors should
not explicitly start the processes that entered the waiting queue in a
FIFO manner, but instead notify all processes waiting to enter the
monitor. The order in which they enter should be decided by higher level
rules, thereby separating mechanism from policy.