Академический Документы
Профессиональный Документы
Культура Документы
ID of the last process to operate on the semaphore, number of processes waiting for the
semaphore value to be greater than its current value, and number of processes waiting for the
semaphore value to be zero” (Stallings 285). This simply means that the semaphore is a data
structure consisting of a counter and a queue for storing task descriptors. They can provide both
competition and cooperation synchronization. Unfortunately, they can be volatile as improper
use of semaphores can cause failures in the synchronization. This is obviously a problem.
Monitors can also provide synchronization, and are sometimes considered safer than
semaphores. Monitors themselves are just abstract data types for shared data pools. Our texts
defines them as “a programming language construct that encapsulates variables, access
procedures, and initialization code within an abstract data type” (Stallings 214). Just like
semaphores, monitors can be used for both competition and cooperation synchronization. They
are considered to be better for competition synchronization than for cooperation, as monitors
face many of the same problems that semaphores do with cooperation synchronization.