L25 Data-Centric Consistency NRay
L25 Data-Centric Consistency NRay
Consistency Models
3
Consistency Model Diagram
Notation
Wi(x)a – a write by process ‘i’ to item ‘x’
with a value of ‘a’. That is, ‘x’ is set to ‘a’.
6
Sequential Consistency Diagrams
In other words: all processes see the same interleaving set of
operations, regardless of what that interleaving is.
7
Problem with Sequential
Consistency
With this consistency model, adjusting the
protocol to favour reads over writes (or
vice-versa) can have a devastating impact
on performance (refer to the textbook for
the gory details).
x = 1; y = 1; z = 1;
print ( y, z); print (x, z); print (x, y);
9
Linearizability and Sequential
Consistency (2)
Four valid execution sequences for the processes
of the previous slide. The vertical axis is time.
x = 1; x = 1; y = 1; y = 1;
print ((y, z); y = 1; z = 1; x = 1;
y = 1; print (x,z); print (x, y); z = 1;
print (x, z); print(y, z); print (x, z); print (x, z);
z = 1; z = 1; x = 1; print (y, z);
print (x, y); print (x, y); print (y, z); print (x, y);
incorrect
correct
15
Introducing Weak
Consistency
Not all applications need to see all writes,
let alone seeing them in the same order.
16
Weak Consistency
Properties
The three properties of Weak Consistency:
1. Accesses to synchronization variables
associated with a data-store are
sequentially consistent.
2. No operation on a synchronization
variable is allowed to be performed until
all previous writes have been completed
everywhere.
3. No read or write operation on data items
are allowed to be performed until all
previous operations to synchronization
variables have been performed.
17
Weak Consistency: What It
Means
So …
18
Weak Consistency Examples
Wrong!!
Answer: It doesn’t!
All processes must see all shared accesses in the same order. Accesses are furthermore ordered
Linearizability
according to a (nonunique) global timestamp.
Sequential All processes see all shared accesses in the same order. Accesses are not ordered in time.
Causal All processes see causally-related shared accesses in the same order.
All processes see writes from each other in the order they were used. Writes from different processes
FIFO
may not always be seen in that order.
(a)
Consistency Description
Weak Shared data can be counted on to be consistent only after a synchronization is done.
Release Shared data are made consistent when a critical region is exited.
Entry Shared data pertaining to a critical region are made consistent when a critical region is entered.
(b) 26