12.2. Monitors

The critical region construct, in itself, has no way of enforcing modularity and a program might be structured as shown in Figure 12.3. That is, critical region statements performing operations on the shared data, may be dispersed through-out the program. Therefore, if one wanted to check how a particular piece of shared data is used, the programmer would have to go through the entire program to find all the critical regions related to that shared data.

Figure 12.3. Possible program structure with conditional critical regions.

A solution to this problem is to use a monitor, where a monitor has the structure of an abstract data object. ...

Get Operating Systems: Concurrent and Distributed Software Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.