Docsity

Consistency and Replication - Distributed Operating Systems - Lecture Slides, Slides of Operating Systems

Partial preview of the text

Download Consistency and Replication - Distributed Operating Systems - Lecture Slides and more Slides Operating Systems in PDF only on Docsity!

Consistency and Replication

Reasons for Replication

  • Reliability:
    • Mask failures
    • Mask corrupted data
  • Performance:
    • Scalability (size and geographical)
  • Examples:
    • Web caching
    • Horizontal server distribution

Consistency Issues – Access/Update

Ratio

time

…

Updates to the Web page
User accesses to the page

Consistency Model

  • When and how the modifications are made = consistency model:
    • Weak versus strong consistency model

Consistency Models (cont)

  • A process performs a read operation on a data item, expects the operation to return a value that shows the result of the last write operation on that data
  • No global clock ļƒž difficult to define the last write operation
  • Consistency models provide other definitions
  • Different consistency models have different restrictions on the values that a read operation can return
read
read

Summary of Consistency Models a) Consistency models not using synchronization operations. b) Models with synchronization operations. Consistency Description Strict Absolute time ordering of all shared accesses matters. 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. FIFO All processes see writes from each other in the order they were used. Writes from different processes 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)

Framework for Consistency

Operations and Data Items

  • Operations are either writes or reads
  • A write is denoted w p (x)v
  • A read is denoted rp(x)v
  • A read-write data item is the set of all sequences <o 1 , o 2 , … on> such that
  1. Each oi is either a read or a write
  2. Each read returns the same value written by the most recent preceding write in the sequence

Framework for Consistency

Operations and Processes

  • Each operation can be decomposed into two components:
    • Invocation and response
  • wp(x)v : invocation = wp(x)v; response = empty
  • rp(x)v : invocation = rp(x)?; response = v
  • A process is a sequence of operation invocations
  • A process computation is a sequence of operations obtained by augmenting each invocation in the process by its response

Framework for Consistency

Example

Program p:
x = y
Process p:
r(y)v?
w(x)v?
Program q:
y = x
Process q:
r(x)v?
w(y)v?
Process p
Comp:
r(y)
w(x)
Process q
Comp:
r(x)
w(y)
System (P,D):
P = {p,q}
D = {x,y}
System (P,D) Computation:
p: r(y)5 w(x)
q: r(x)0 w(y)

Framework for Consistency

Program Order

  • Define program order, denoted (O, <po), by o 1 <po o 2 iff o 2 follows o 1 in p’s computation
Process p:
r(y)v?
w(x)v?
Process q:
r(x)v?
w(y)v?
Process p
Comp:
r(y)
w(x)
Process q
Comp:
r(x)
w(y)
  • r p (y)5 < po
w

p

(x)
  • r q (x)0 < po
w

q

(y)
  • All of program order for
the example
Program p:
x = y
Program q:
y = x

Relation of Consistency Models

  • Sequential All processes see all shared accesses in the
same order
  • Strict Absolute time ordering of all shared accesses
matters.
  • For two consistency models CM 1
and CM

2

CM

1

is
stronger than CM

2

if the constraints of CM

1

imply those
of CM

2

  • CM 2 is weaker than CM 1
  • Sequential consistency is weaker than strict consistency

Framework for Consistency – Validity

  • Given a set of operations O
  • O|w indicates all the write operations in O
  • O|r indicates all the read operations in O
  • O|p is the subset of O containing p’s operations, for some process p
  • O| x is the subset of O containing operations on x , for some data item x
  • Let (O,<) be a total order of O
  • (O,<) is valid if for each data item x , the subsequence (O| x ,<) is valid for x

Sequential Consistency (SC)

  • Two constraints:
    • the result of any execution is the same as if the
operations of all the processes were executed in some
sequential order, and
  • the operations of each individual process appear in this
sequence in the order specified by its program
  • Let O be the set of all the operations of a
computation C of a system (P,D). Then, C satisfies
SC if there is a valid total order (O,<) such that (O,<po)
ļƒ (O,<)

SC – Intuition

process (^) …

All Data Items (the set D)
process process
Switch
FIFO
Channels