In computer science, Consistency models are used in distributed systems like distributed shared memory systems or distributed data stores (such as a filesystems, databases, optimistic replication systems or Web caching). The system is said to support a given model if operations on memory follow specific rules. The data consistency model specifies a contract between programmer and system, wherein the system guarantees that if the programmer follows the rules, memory will be consistent and the results of reading, writing, or updating memory will be predictable. This is different from Cache coherence, an next that occurs in systems that are cached or cache-less is consistency of data with respect to all processors. This is not handled by Coherence as coherence deals with maintaining a global order in which writes only to a single location or a single variable are seen by all processors. Consistency deals with the ordering of operations to multiple locations with respect to all processors.
High level languages, such as C++ and Java, partially maintain the contract by translating memory operations into low-level operations in a way that preserves memory semantics. To hold to the contract, compilers may reorder some memory instructions, and library calls such as pthread_mutex_lock()
encapsulate required synchronization.
Verifying sequential consistency through model checking is undecidable in general, even for finite-state cache-coherence protocols.
Consistency models define rules for the apparent order and visibility of updates, and it is a continuum with tradeoffs.