Summary of Thursday, Jan 23, 1997



1. Monitor solution to the Readers-Writers problem

In the Readers-Writers problem, the database only allows some readers read or a single writer writes. Figure 1 shows how to use monitor to solve this problem.

Figure 1: monitor for solving Readers-Writers problem



2. Limitation of Monitors



3. Serializer

Serializer is an abstract data type defined by a set of procedures and can encapsulate the shared resources to from a protected object.

As in a monitor only one process can have accesses a serializer at a given time. But in the procedures of a serializer there are certain regions --holes-- in which multiple process can be active. When a process enters a hole, it releases the serializer. A hole in a procedure is specified by a join-crowd operation:

join-crowd (crowd-name) then actions end.

Whenever a process requests to access of a serializer, it should enter a queue to check certain conditions and wait until the condition is true. This is accomplished using an enqueue operation:

enqueue (queue-name) until condition.

When a process releases the serializer or the system condition changes, no explicit signal is send to other waiting processes. The signaling is done automatically in a serilaizer.

Figure 2 shows the structure of the serializer for solving Readers-Writers problem.

Figure 2: serializer for solving Readers-Writers problem



4. Monitors vs Serializer



Back to CS5204 Home Page