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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.