Each process executes its own operations on shared variables sequentially, as specified by its own program. Nevertheless, different processes may execute their operations on the same shared variable concurrently. That is, operation executions of different processes may overlap, and they may affect one another.
Each operation on a shared variable, when executed indivisibly, transforms the variable from one consistent value to another. However, when the operations arc executed concurrently on a shared variable, the consistency of its values may not the guaranteed.
The behaviors of operation executions on shared variables must, be predictable for effective inter-process communication.
Thus, operation executions on shared variables may need to be coordinated to ensure their consistency semantics.
Coordination of accesses to shared variables is called synchronization.
A synchronization solution coordinates accesses from processes to shared variables. As shown in Figure, where all accesses to shared variables are channeled through access controllers
- The controllers do the coordination. Most operating systems implement a few different synchronization schemes for process coordination purposes. Each scheme supports a set of primitives. The primitives are used when it is absolutely necessary to have orderly executions of operations on shared variables in a particular manner.