Distributed Systems: Consistency Models - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Distributed Systems: Consistency Models

Description:

Tell programmers, 'Well, you always see things in exact order' ... How strong is Orbitz's model? If it shows a ticket available, is it really? ... – PowerPoint PPT presentation

Number of Views:1475
Avg rating:3.0/5.0
Slides: 26
Provided by: Ken667
Category:

less

Transcript and Presenter's Notes

Title: Distributed Systems: Consistency Models


1
Distributed SystemsConsistency Models
  • CS 654Lecture 17November 13, 2006

2
  • Make up day on Tuesday?
  • Second mid-term?

3
Consistency Models Review
  • Enforcing absolute ordering is too expensive,
    especially with replication and caching.
  • So we need to allow for mis-ordering.
  • We could just do it casually. Tell programmers,
    Well, you always see things in exact order.
  • They would say, What do you mean?
  • So we need an exact, very precise way of
    specifying the kinds of inconsistencies that the
    application might see.
  • That is the purpose and point of having
    consistency models.

4
Data Centric Consistency Models
5
Data Stores
  • Consistency is viewed as read/write ops on shared
    data.
  • A consistency model is a contract between the
    processes and the data store.

6
Notation
  • Processes execute to the right as time
    progresses.
  • The notation W1(x)a means that the process wrote
    the value a to the variable x.
  • The notation R2(x)a means that the process read
    the value a from the variable x.
  • The subscript is often dropped.

7
Sequential Consistency
  • The result of any execution is the same as if the
    (read and write) operations by all processes on
    the data store were executed in some sequential
    order and the operations of each individual
    process appear in this sequence in the order
    specified by its program.
  • There is some global order.
  • Operations between processes must be as in the
    program.

Program A A-OP1A-OP2A-OP3
Global Order 2 A-OP1B-OP1A-OP2B-OP2B-OP3A-OP3
Global Order 3 A-OP1B-OP1A-OP2B-OP3B-OP2A-OP3
Global Order 1 A-OP1A-OP2A-OP3B-OP1B-OP2B-OP3
Program B B-OP1B-OP2B-OP3
8
Sequential Consistency (3)
9
Sequential Consistency (4)
  • Figure 7-6. Three concurrently-executing
    processes.

10
Sequential Consistency (5)
  • Figure 7-7. Four valid execution sequences for
    the processes of Fig. 7-6. The vertical axis is
    time.

11
Causal Consistency
  • For a data store to be considered causally
    consistent, it is necessary that the store obeys
    the following condition
  • Writes that are potentially causally related must
    be seen by all processes in the same order.
    Concurrent writes may be seen in a different
    order on different machines.

12
Causal Consistency (2)
  • This sequence is allowed with a
    causally-consistent store, but not with a
    sequentially consistent store.

13
Causal Consistency
  • Causally consistent?

14
Continuous Consistency (1)
  • Figure 7-2. An example of keeping track of
    consistency deviations adapted from (Yu and
    Vahdat, 2002).

15
Continuous Consistency (2)
  • Figure 7-3. Choosing the appropriate granularity
    for a conit. (a) Two updates lead to update
    propagation.

16
Continuous Consistency (3)
  • Figure 7-3. Choosing the appropriate granularity
    for a conit. (b) No update propagation is needed
    (yet).

17
Grouping Operations
  • Do SMP machines also need consistency models?
  • Yes, there are many kinds.
  • Why we not care about these when writing MT
    programs?
  • We do, if we are platform dependent and dont use
    locks.
  • How do we handle consistency in MT programs?
  • Use locks.
  • As viewed by an external, data-centric process,
    what do locks do?
  • They turn non-atomic operations into atomic ones
    (functionally).
  • In other words, they group them.

18
Synchronization Variables
  • Operations are grouped via synchronization
    variables (locks).
  • Each sync var protects an associated data.
  • Each kind of sync var has some associated
    properties.

19
Grouping Operations
  • Entry Consistency Necessary criteria for correct
    synchronization
  • An acquire access of a synchronization variable
    is not allowed to perform until all updates to
    guarded shared data have been performed with
    respect to that process.
  • Before exclusive mode access to synchronization
    variable by a process is allowed to perform with
    respect to that process, no other process may
    hold the synchronization variable, not even in
    nonexclusive mode.
  • After exclusive mode access to a synchronization
    variable has been performed, any other process
    next nonexclusive mode access to that
    synchronization variable may not be performed
    until it has performed with respect to that
    variables owner.

20
Grouping Operations (2)
  • A valid event sequence for entry consistency.

21
Client Centric Models
22
Weaker Models
  • Sometimes strong models are needed, if the result
    of race conditions are very bad.
  • Banks
  • Sometimes the result of races are just
    inefficiency, or inconvenience, etc.
  • How strong is Orbitzs model?
  • If it shows a ticket available, is it really?
  • How does it prevent two people from reserving the
    same seat?
  • One kind of weaker model is eventual consistency
  • It eventually becomes consistent

23
Eventual Consistency
  • How well does EC work for mobile clients?
  • Client-centric is for this. Consistent for a
    single client.

24
Notation
  • xit is the version of x at local copy Li at
    time t.
  • Version xit is the result of a series of write
    operations at Li that took place since
    initialization. This is WS(xit).
  • If operations in WS(xit) have also been
    performed at local copy Lj at a later time t2, we
    write WS(xit1xjt2).

25
Monotonic Reads
  • A data store is said to provide monotonic-read
    consistency if the following condition holds
  • If a process reads the value of a data item x any
    successive read operation on x by that process
    will always return that same value or a more
    recent value.

26
Monotonic Reads
27
Monotonic Writes
  • In a monotonic-write consistent store, the
    following condition holds
  • A write operation by a process on a data item x
    is completed before any successive write
    operation on x by the same process.

28
Monotonic Writes
29
Read Your Writes
  • A data store is said to provide read-your-writes
    consistency, if the following condition holds
  • The effect of a write operation by a process on
    data item x will always be seen by a successive
    read operation on x by the same process.
  • Suppose your web browser has a cache.
  • You update your web page on the server.
  • You refresh your browser.
  • Do you have read-your-writes consistency?

30
Read Your Writes (2)
31
Writes Follow Reads (1)
  • A data store is said to provide
    writes-follow-reads consistency, if the following
    holds
  • A write operation by a process
  • on a data item x following a previous read
    operation on x by the same process
  • is guaranteed to take place on the same or a more
    recent value of x that was read.

32
Writes Follow Reads (2)
  • Figure 7-15. (a) A writes-follow-reads consistent
    data store.

33
Writes Follow Reads (3)
  • Figure 7-15. (b) A data store that does not
    provide writes-follow-reads consistency.
Write a Comment
User Comments (0)
About PowerShow.com