(3.2.3) ~ Consistency models

Sarita V. Adve and Kourosh Gharachorloo. Shared Memory Consistency Models: A Tutorial, IEEE Computer, December 1996, pp. 66-76. IEEE Xplore link

Memory consistency model
     specifies the constraints in the order in which memory operations must appear to be performed wrt to the other processor

Sequential consistency
     1) All processors execute sequentially
     2) Some sequentiality exists between these procs operations on memory
     3) catch : for processor 0, if write A, read A happens, read A should wait till write A is seen by all the other processors

(1) All cores insert their loads and stores into the order <m respecting their program order,

regardless of whether they are to the same or different addresses (i.e., a=b or ab). There are four

cases:

If L(a) <p L(b) L(a) <m L(b) /* LoadLoad */

If L(a) <p S(b) L(a) <m S(b) /* LoadStore */

If S(a) <p S(b) S(a) <m S(b) /* StoreStore */

If S(a) <p L(b) S(a) <m L(b) /* StoreLoad */

(2) Every load gets its value from the last store before it (in global memory order) to the same

address:

Value of L(a) = Value of MAX <m {S(a) | S(a) <m L(a)}, where MAX <m denotes “latest in

memory order.”

Coherence makes caches invisible. Consistency can make shared memory

look like a single memory module.

Total Store Order (Sparc)
     A TSO execution requires:

(1) All cores insert their loads and stores into the memory order <m respecting their program

order, regardless of whether they are to the same or different addresses (i.e., a==b or a!=b). There

are four cases:

If L(a) <p L(b) L(a) <m L(b) /* Load Load */

If L(a) <p S(b) L(a) <m S(b) /* Load Store */

If S(a) <p S(b) S(a) <m S(b) /* Store Store */

If S(a) <p L(b) ==> S(a) <m L(b) /* Store-->Load */ /* Change 1: Enable FIFO Write

Buffer */

(2) Every load gets its value from the last store before it to the same address:

Value of L(a) = Value of MAX <m {S(a) | S(a) <m L(a)} /* Change 2: Need Bypassing */

Value of L(a) = Value of MAX <m {S(a) | S(a) <m L(a) or S(a) <p L(a)}

Weak Consistency
     Syncronization actions are consistent (sequential)

Release consistency
Lock aquire/release...
     eager, where all coherence actions are performed on release operations, and
     lazy, where all coherence actions are delayed until after a subsequent acquire
.