Docsity

Understanding Data Consistency in Distributed Systems: Consistency Models, Study notes of Operating Systems

Partial preview of the text

Download Understanding Data Consistency in Distributed Systems: Consistency Models and more Study notes Operating Systems in PDF only on Docsity!

Consistency Models^ Based on Tanenbaum/van Steen’s

“Distributed Systems”, Ch. 6, section 6.

Consistency Models

Both for DSM, but also for regularmultiprocessors with real sharedmemory

-^

i.e., either hardware or software could beenforcing these protocols

(Tanenbaum

Strict Consistency

Strict consistency is the strictest model

–^

a read returns the most recently written value(changes are instantaneous)

-^

not well-defined unless the execution ofcommands is serialized centrally

-^

otherwise the effects of a slow write may have notpropagated to the site of the read

-^

this is what uniprocessors

support:

a = 1; a = 2; print(a);

always produces “2”

–^

to exercise our notation:^ P1: W(x)1^ P2:

R(x)

R(x)

–^

is this strictly consistent?

Sequential Consistency

Sequential consistency (

serializability

): the results

are the same as if operations from differentprocessors are interleaved, but operations of asingle processor appear in the order specified bythe program

Example of sequentially consistent execution:

P1:

W(x) P2:

R(x)

R(x)

Sequential consistency is inefficient: we want toweaken the model further

Pipelined RAM (PRAM) or FIFO

Consistency

PRAM consistency is even more relaxed than causalconsistency: writes from the same processor arereceived in order, but writes from distinct processorsmay be received in different orders by differentprocessors

P1:

W(x) P2:

R(x)

W(x)

P3:

R(x)

R(x)

P4:

R(x)

R(x)

Slight refinement:

–^

Processor consistency

: PRAM consistency plus writes to

the same memory location are viewed everywhere in thesame order

Weak Consistency

•^

Weak consistency uses synchronization variables topropagate writes to and from a machine at appropriatepoints:^ –

accesses to synchronization variables are sequentiallyconsistent – no access to a synchronization variable is allowed until allprevious writes have completed in all processors – no data access is allowed until all previous accesses tosynchronization variables (by the same processor) havebeen performed

-^

That is:^ –

accessing a synchronization variable “flushes thepipeline” – at a synchronization point, all processors have consistentversions of data

Release Consistency

Release consistency is like weak consistency,but there are two operations “lock”

and

“unlock”

for synchronization

–^

(“acquire/release”

are the conventional names)

–^

doing a “lock”

means that writes on other processors

to protected variables will be known

-^

doing an “unlock”

means that writes to protected

variables are exported

-^

and will be seen by other machines when they do a“lock”

(lazy release consistency) or immediately

(eager release consistency)

example (valid or not?):

P1: L W(x)1 W(x)2 U P2:

L R(x)

U
P3:

R(x)

Variant: entry consistency: like lazyrelease consistency but all datavariables are explicitly associated withsynchronization variables

a) Consider the following sequence of

operations:

P1: W(x)

W(x)

P2:

W(x)

P3:

R(x)

R(x)

P4:

R(x)

R(x)

Is this execution causally consistent? Add

or modify an event to change theanswer.

d) Consider the following sequence of operations: P1:

L W(x)

W(x)

U

P2:

L

R(x)

U

R(x)

Is this execution release consistent? Add or modify

an event to change the answer.