Linearizability - PowerPoint PPT Presentation

About This Presentation
Title:

Linearizability

Description:

Sequential consistency ... Causal consistency ... To implement this consistency model, the editor must invalidate the cached copy, ... – PowerPoint PPT presentation

Number of Views:214
Avg rating:3.0/5.0
Slides: 21
Provided by: Sukuma7
Category:

less

Transcript and Presenter's Notes

Title: Linearizability


1
Linearizability
  • Linearizability is a correctness criterion for
    concurrent object (Herlihy Wing ACM TOPLAS
    1990). It provides the illusion that each
    operation on the object takes effect in zero
    time, and the result is equivalent to some
    legal sequential computation.

W (x0)
R (x1)
W (x0)
R(x1)
W (x1)
Is this acceptable? It violated linearizability
(Initially xy0)
2
Linearizability
  • A trace is consistent, when every read returns
    the latest value written into the shared variable
    preceding that read operation. A trace is
    linearizable, when (1) it is consistent, and (2)
    the temporal ordering among the reads and writes
    is respected.

W (x0)
R (x1)
W (x0)
R(x1)
W (x1)
(Initially xy0)
3
Sequential consistency
  • Some interleaving of the local temporal order of
    events at the different replicas is a consistent
    trace.

W(x100)
W(x99
R(x100)
R(x99)
4
Sequential consistency
  • Is sequential consistency satisfied here? Assume
    that initially xy0.

W(x10)
W(x8
R(x10)
W(x20)
R(x20)
R(x10)
5
Causal consistency
  • All writes that are causally related must be
    seen by every process in the same order.

W(x10)
W(x20)
R(x10)
R(x20)
R(x10)
R(x20)
6
Implementing consistency models
  • Why are there so many consistency models?
  • The cost (measured by message complexity) of
  • implementation decreases as the models become
    weaker.

7
Implementing linearizability
W(x20)
Read X
W(x10)
Read X
Needs total order multicast of all reads and
writes
8
Implementing linearizability
  • The total order broadcast forces every process to
    accept and handle all reads and writes in the
    same temporal order.
  • The peers update their copies in response to a
    write, but only send acknowledgements for reads.
    After this, the local copy is returned

9
Implementing sequential consistency
  • Use total order broadcast all writes only,
  • but immediately return local copies for reads.

10
Exercise
  • Let x, y be two shared variables
  • Process P Process Q
  • initially x0 initially y0
  • x 1 y1
  • if y0 ? x2 fi if x0 ? y2 fi
  • Print x Print y
  • If sequential consistency is preserved, then
    what are the possible values of the printouts?
    List all of them.

11
Client centric consistency model
12
Client centric consistency model
  • Read-after-read
  • If read from A is followed by read from B then
    the second read should return a data that is as
    least as old the previous read.

A
B
13
Client centric consistency model
  • Read-after-write
  • Each process must be able to see its own
    updates.
  • Consider updating a webpage. If the editor and
    the browser are not integrated, the editor will
    send the updated HTML page to the server, but the
    browser may return an old copy of the page when
    you view it
  • To implement this consistency model, the editor
    must invalidate the cached copy, forcing the
    browser to fetch the recently uploaded version
    from the server.

edit
B
Server
14
Client centric consistency model
  • Write-after-read
  • Each write operation following a read should
    take effect on the previously read copy, or a
    more recent version of it.
  • x0 x0
  • x20

x x 5
x5?
Write should take effect on x20, not x0
15
Quorum-based protocols
A quorum system engages only a designated minimum
number of the replicas for every read or write
operation this number is called the read or
write quorum. When the quorum is not met, the
operation (read or write) is postponed.
16
Quorum-based protocols
N no of replicas.
Ver 3
Ver 2
quorum
Thomas rule
To write, update gt N/2 of them, and tag it with
new version number. To read, access gt N/2
replicas with identical values or version
numbers. Otherwise, abandon the read
17
How it works
N no of replicas.
1. Send a write request containing the state and
new version number to all the replicas and waits
to receive acknowledgements from a write quorum.
At that point the write operation is complete and
the proxy can return to the user code. 2. Send
a read request for the version number to all the
replicas, and wait for replies from a read
quorum. Then it takes the biggest version number.
18
Quorum-based protocols
After a partition, only the larger segment runs
the consensus protocol. The smaller segment
contains stale data, until the network is
repaired.
Ver.1
Ver.0
19
Quorum-based protocols
No partition satisfies the read or write quorum
20
Quorum-based protocols
Asymmetric quorum W R gt N W gt N/2
No two writes overlap No read overlaps with a
write.
R read quorum W write quorum
Write a Comment
User Comments (0)
About PowerShow.com