Shared State Concurrency is concurrency among two or more processes (here, a process is a flow of control; rather than a particular type of kernel object) which have some shared state between them; which both processes can read to and write from. See also MessagePassingConcurrency.
SharedStateConcurrency has the following advantages...
...and disadvantages
- Much more difficult to model and prove a system correct.
- Requires lots of synchronization primitives (SynchronizationStrategies) to prevent race-conditions
- Does not scale well to distributed systems, especially in the presence of unreliable connections between processes (i.e. over a network).
Criticisms of the "advantages" above:
- It's not particularly useful for a system to be fast but incorrect, and in any case the speed advantage relative to message passing is small.
- The point about GlobalConsensus is refuted at MessagePassingConcurrency. In a nutshell, this depends on the actual reliability of communications, not the concurrency model.
- Passing ReferenceObjects is also easy in most message-passing models.
- If you use MessagePassingConcurrency implemented in terms of shared state, then depending on how well the shared state is hidden:
- its disadvantages leak into the message passing layer, or
- its disadvantages don't leak, in which case it is an ImplementationDetail? and you should describe the system as using message passing.
See also
ConceptsTechniquesAndModelsOfComputerProgramming.
CategoryConcurrency