4.2.1. Synchronization RequirementsΒΆ
The shared buffer problem (see Data Inconsistency) and most synchronization problems require mutual exclusion: Only one process or thread can be in the critical section at a time.
Other problems, such as Readers and Writers allow more than one read only thread in the critical section at the same time. (See Classic Synchronization Problems)
Even to implement a simple lock, requires mutual exclusion:
shared boolean locked; ... while( locked ) WAIT(); /* THIS IS A BAD TIME FOR A CONTEXT SWITCH */ locked = True; /**********************/ Critical Section /**********************/ locked = False;
Without mutual exclusion, results of multiple execution are not determinate.
Need an Operating System provided mechanism.