CS6223 Distributed Systems: Tutorial 8 - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

CS6223 Distributed Systems: Tutorial 8

Description:

It is often argued that weak consistency models impose an extra burden for programmers. ... In such a consistency model, when a process performs an operation ... – PowerPoint PPT presentation

Number of Views:132
Avg rating:3.0/5.0
Slides: 18
Provided by: george591
Category:

less

Transcript and Presenter's Notes

Title: CS6223 Distributed Systems: Tutorial 8


1
CS6223 Distributed Systems Tutorial 8
  • Q1. Does using timestamping for concurrency
    control ensure serializability? In Slide 2,
    assume that ts(T1)1, ts(T2)6, ts(T3)7, discuss
    the examples in Slide 2 (Note that for (f), we
    may assume that ts(T3)5).
  • Q2. Discuss the properties of strict consistency,
    sequential consistency, and weak consistency with
    synchronization variables, and their differences.
  • Q3. In Slide 3, there are four valid execution
    sequences under sequential consistency. However,
    the outputs (results) are different, which result
    is regarded as the correct one? If it is required
    that a unique output (result) is produced, say
    001011 (in (a)), what we should do?

2
Timestamp Ordering Examples
  • Concurrency control using timestamps.

3
Sequential Consistency Examples
  • Four valid execution sequences for the processes.
    The vertical axis is time.

4
CS6223 Distributed Systems Tutorial 8
  • Q4. Explain how replication in DNS takes place,
    and why it actually works so well.
  • Q5. Suppose that there are two processes as
    follows
  • Process P1 Process
    P2
  • a 1 b
    1
  • if (b0) kill (P2) if
    (a0) kill (P1)
  • List all possible statement interleaving that
    are allowed under sequential consistency memory.
  • Q6. It is often argued that weak consistency
    models impose an extra burden for programmers. To
    what extent is this statement actually true?

5
Tutorial 8 Q1 Ans.
  • Q1 Ans.
  • Yes. Stronger yet, it either completely
    serializes the transactions in their timestamp
    order, or it aborts some of them.
  • Considering T2 writing a data x,
  • in (a) and (b), tsRD(x) and tsWR(x) are equal
    to ts(T1) (1) lt ts(T2) (6), the write is
    accepted.
  • In (c) and (d), T3 has either read x in (c)
    or written x in (d) and committed, since
    ts(T3)(7) gt ts(T2) (6), T2 is aborted.

6
Tutorial 8 Q1 Ans.
  • Considering T2 reading a data x, in (e) there
    is no conflict and the read can happen
    immediately.
  • In (f), some interloper (say T3, it would be
    better to use other letter, such as T4) has got
    in there, here ts(T3) (5) lt ts(T2) (6), so T2
    simply waits until the interloper commits.
  • In (g) T3 had changed x and committed, again
    T2 must abort.
  • In (h) T3 is in the process of changing x
    (although it has not committed). Again T2 is too
    late and must abort.

7
Tutorial 8 Q2 Ans.
  • Q2 Ans.
  • Strict consistency Any read on a data item x
    returns a value corresponding to the result of
    the most recent write on x.
  • The definition implicitly assumes the
    existence of absolute global time, so that the
    determination of most recent is unambiguous.
  • There is no notion of absolute global time in
    DS. It is impossible to implement strict
    consistency in DS.

8
Strict Consistency
  • Behavior of two processes, operating on the same
    data item.
  • (a) A strictly consistent store.
  • (b) A store that is not strictly consistent.

9
Tutorial 8 Q2 Ans.
  • Sequential consistency (Lamport, 1979) A data
    store is said to be sequentially consistent if it
    satisfies the following condition
  • 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.
  • when processes run concurrently, possibly on
    different machines, any interleaving of read and
    write operations is acceptance behavior, but all
    processes should see the same interleaving of
    operations.

10
Sequential Consistency
  • A sequentially consistent data store.
  • A data store that is not sequentially consistent.

11
Tutorial 8 Q2 Ans.
  • Weak consistency models using synchronization
    variables, have the following three properties
  • (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.

12
Tutorial 8 Q2 Ans.
  • In such a consistency model, when a process
    performs an operation on an ordinary shared data
    item (e.g., in critical region) no guarantees are
    given about when they will be visible to other
    processes. Only when an explicit synchronization
    takes place, are changes propagated. Weak
    consistency enforces (sequential) consistency on
    a group of operations, using synchronization
    variables as boundaries.

13
Weak Consistency
  • A valid sequence of events for weak consistency.
  • An invalid sequence for weak consistency.

14
Summary of Consistency Models
15
Tutorial 8 Q3
  • Q3 Ans.
  • All four outputs (results) are correct. In
    practice, users are taught to program in such a
    way that exact order of statement execution (in
    interleaving) does not matter. That is, any
    result from a valid interleaving should be
    acceptable. When such an execution order is
    essential, i.e., a unique interleaving is
    required to produce a unique result,
    synchronization operations (or semaphore etc)
    should be used to enforce such an execution.

16
Tutorial 8 Q4 Q5 Ans.
  • Q4 Ans. The basic idea is that name servers cache
    previously looked up results. These results can
    be kept in a cache for a long time, because DNS
    makes the assumption that name-to-address
    mappings do not change often.
  • Q5 Ans. The six statement interleavings are as
    follows
  • (1) a1 if (b0) b1 if (a0)
  • (2) a1 b1 if (a0) if (b0)
  • (3) a1 b1 if (b0) if (a0)
  • (4) b1 if (a0) a1 if (b0)
  • (5) b1 a1 if (b0) if (a0)
  • (6) b1 a1 if (a0) if (b0)

17
Tutorial 8 Q6 Ans.
  • Q6 Ans.
  • It really depends. Many programmers are used
    to protect their shared data through
    synchronization mechanisms such as locks or
    transactions. The main idea is that they require
    a coarser grain of concurrency than one offered
    at the level of only read and write operations.
    However, programmers do expect that operations on
    synchronization variables adhere to sequential
    consistency.
Write a Comment
User Comments (0)
About PowerShow.com