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