Universal Monitors
摘要
The proof of the equivalence of the semaphore and monitor concept as well as the details on the implementation of the monitor concept in the previous chapter can be used—like the baton algorithm—as a template for the construction of a universal synchronization class, the universal monitors developed in this chapter. However, it is not about the protocols to protect critical sections but about ensuring the mutual exclusion of concurrent processes in their operations on shared data. It should be possible that the functions can only be executed if certain conditions are fulfilled, which—like the statements—may depend on the data. Thus, even in C, Java, and Go, which—strictly speaking—do not support the monitor concept, monitor solutions are possible in a very simple way, for which many already known examples are given here: semaphores, the account, bounded buffers and the sleeping barber, barrier synchronization, the readers-writers and the left-right problem, the dining philosophers, and the cigarette smokers.