SNAPSHOT - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

SNAPSHOT

Description:

The communication history of a process is recorded in its state: cp(0) ... for the channel pq: cp(i) contains the list of messages sent(i)pq. sent in the events: ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 28
Provided by: lm58
Category:

less

Transcript and Presenter's Notes

Title: SNAPSHOT


1
SNAPSHOT
2
Motivation Termination detection
  • a ring topology, token based algorithm
  • a process is inactive
  • a process can be activated
  • after accepting a message
  • First traversal paints nodes white
  • If Pi sends a message to Pj , i gt j,
  • gt change a color
  • Second traversal checks the color
  • The token changes a color after passing
    a colored node

3
Snapshot
  • observing a system from within the same system
  • applications of a snapshot
  • 1. analysis of stable properties
  • (P is a stable property, ? is a reachable
    configuration from ?)
  • P( ? ) ? ? gt ? gt P( ? )
  • termination
  • loss of tokens
  • deadlock
  • 2. restart of a system
  • 3. debugging distributed programs

4
Preliminaries
  • A distributed algorithm may have many possible
    executions.
  • Equivalence class of executions is called
  • C ... computation .
  • Computation is defined by
  • Ev... set of events
  • and their partial causal order.
  • Assumptions
  • every message is delivered in finite time (weak
    fairness)
  • a network is strongly connected

5
States of processes
  • cp(0), cp(1), ... states of local process p

  • P ... set of processes in a
    distributed system
  • cp(0) ... initial state
  • Ev ?p? P ep(1) , ep(2) , ...
  • denotation for local causal order ?p for p
    ep(i) ?p ep(j) ltgt i lt j
  • global causal order ?
  • events internal, send, receive
  • The communication history of a process is
    recorded in its state

6
Global snapshot
  • for the channel pq
  • cp(i) contains the list of messages
    sent(i)pq
  • sent in the events
  • cq(i) contains the list of messages
    rcvd(i)pq
  • received in the events

  • local snapshot of state of p cp cp(i)
  • preshot j ? i
    postshot events j gt i
  • global snapshot S (cp1 , ... cpN )

7
Channels
  • Snapshot S includes communication histories
  • so it defines a configuration ?
  • if the state of channel pq can be obtained
    from
  • sentpq \
    rcvdpq
  • Then the system configuration ? can be obtained
    from such a snapshot
  • ? local states
    channel states

8
Feasible snapshot
  • cp1, cp2 not feasible
  • m1 ? rcvdp1p2 ? m1? sentp1p2
    rcvdp1p2 ? sentp1p2

  • (cp2 ) (cp1 )
  • cp1, cp3 feasible sentp1p3 \ rcvdp1p3
    - message in transit m2

9
Feasibility, a meaningful snapshot
  • Snapshot S is feasible if for each two
    (neighbor) processes p and q,
  • rcvdpq ? sentpq
  • Preshot resp. postshot message is sent in a
    preshot resp. postshot event
  • Snapshot S is meaningful in computation C if
    there
  • exists an execution E ? C such that
  • ? is a configuration of E.
  • Algorithm has to take a snapshot in such a way
    that it is meaningful.
  • Feasibility concerns neighboring processes, while
    meaningfulness is a global property

10
Cuts
  • A cut of Ev is a set L ? Ev such that
  • e ? L ? e ?p e gt
    e ? L
  • One-to-one correspondence between cuts and
    snapshots
  • For every snapshot, the preshot events constitute
    a cut
  • Every cut either doesnot include any event from a
    process or it does
  • if it does, it also includes all preceding
    events therefore it contains all preshot
    events and the preshot events constitute a
    snapshot
  • Cut L2 is said to be later than cut L1 if
  • L1 ? L2
  • A consistent cut of Ev is a set L ? Ev such
    that
  • e ? L ? e ? e gt e ? L

11
Equivalent properties
  • Let S be a snapshot and L the cut implied by
    S. The following three statements are
    equivalent
  • (1) S is feasible
  • (2) L is a consistent cut
  • (3) S is meaningful

12
Proof
  • (1) implies (2)
  • S is feasible gt L is a consistent cut
  • rcvdpq ? sentpq e ? L ?
    e ? e gt e ? L
  • consider e ? L and e ? e
  • a. e ?p e gt e ? L , as L is a cut
    (only proving feasible)
  • b. e ... send, e ... receive p ? q
  • e ? L gt e is preshot gt m ?
    rcvdpq
  • gt m ? sentpq as S is
    feasible
  • gt e ? L

13
Proof contd
  • (2) implies (3)
  • L is a consistent cut gt S is meaningful
  • The cut corresponds to a snaphot (we are proving
    only that it is meaningful)
  • The snaphot divides events to pre and postshot
  • Meaningful snaphot corresponds to a possible
    execution
  • Lets create the possible execution F of the
    observed algorithm,
  • 1. create permutation f of events in Ev
    (computation for this algorithm), in which the
    cut (preshot events) creates an introductory part
    of the execution
  • 2. prove that the permutation f of events
    corresponds to a possible execution F, i.e. prove
    that it is consistent with ?

14
Proof contd
  • f (f0, f1, ...) enumeration of events from
    Ev, preshot events first
  • Both preshot and postshot events are listed in
    any order that is possible according to ?
  • preshot events
    postshot events

15

Proof contd
  • Show that the whole sequence is consistent with
    ?
  • Lets have fi ? fj
  • fi , fj are both preshot events i lt j
    follows because preshot resp. postshot events
    are enumerated in an order consistent with ?
  • fi , fj are both postshot events i lt j
    follows for the same reason
  • fi . . preshot event, fj . . postshot event ,
    i lt j
  • because as all preshot events are before
    postshot events (snapshot)
  • fi . . postshot event , fj . . preshot event
    cannot happen because L is consistent (contains
    only preshot events)
    if fj ? L and fi ?
    fj , then fi ? L , i.e. fi is a preshot
    event

16
Proof contd
  • We conclude that f is consistent with ?
  • If events in f are in order consistent with ?
    , then there exists a computation F, that has
    events in Ev in the same order as they are in f.
  • F reaches a configuration ? after performing
    all preshot events.
  • We built an a possible execution F based on the
    fact that the cut is consistent (defines all
    preshot events)

17
Proof contd
  • (3) implies (1)
  • S is meaningful gt S is feasible
  • if S is meaningful then ? occures in an
    execution of C
  • in each execution rcvdpq ? sentpq for each p
    and q
  • hence S is feasible

18
Chandy-Lamports algorithm
  • the taking of a local snaphot must be triggered
    in each process
  • no postshot message is received in a preshot
    event
  • channels are FIFO

19
CHANDY-LAMPORT
20
Lemma
  • If at least one process initiates the algorithm,
    all processes take a local snapshot within finite
    time.
  • Proof Because each process takes a snapshot and
    sends ltmkrgt at most once, the algorithm ceases
    within finite time.
  • The connectivity of the network implies that each
    process that has not taken the snapshot yet will
    take it after receiving the ltmkrgt message.
  • -------------------
  • Time O(D) Messages 2E

21
Theorem
  • The algorithm of Chandy and Lamport computes a
    meaningful snapshot within finite time after its
    initialization by at least one process.
  • Proof Snaphot is feasible
  • Let m be a postshot message sent from p to q.
  • Before sending m, p took a local snapshot and
    sent a ltmkrgt message to q.
  • Because the channel is FIFO, q received ltmkrgt
    before m.
  • q took its snapshot upon receipt of this message
    or earlier.
  • conseq. gt the receipt of m is a postshot event

22
Lai Yang algorithm
  • the algorithm does not ensure that each process
    eventually records its state
  • the algorithm can be augmented with control
    messages (no FIFO)
  • every basic message of an algorithm is tagged
    with an information on preshot resp. postshot
    status

23
Lai Yang algorithm
24
Lai Yang algorithm
  • The algorithm of Lai and Yang only computes
    meaningful snapshots.
  • Proof Let m ltmess, cgt be a postshot message
    from p to q
  • gt c true gt process q records its state before
    receipt of m at the latest
  • gt acceptance of m is a postshot event

25
Computation of the channel state
  • In a feasible snapshot, sentpq \ rcvdpq
  • equal the set of messages sent by p in a
    preshot event and received by q in a postshot
    event.
  • Proof
  • if m is sent in a preshot event m ?
    sentpq
  • if m is received in a postshot event
  • m ? rcvdpq
  • gt m ? sentpq \ rcvdpq

26
Computation of the channel state
  • Process q constructs the state of channel pq by
    recording all preshot-sent messages that are
    received postshot.
  • Chandy-Lamport postshot-received messages that
    are received before ltmkrgt message
  • Record a local state
  • Record all messages received through a channel
    before a marker
  • These messages define a state of the channel
  • Lai-Yang postshot-received messages tagged with
    false process q has to know the number of
    preshot messages sent to q, so that it can finish
    recording of messages.

27
Channel states in Chandy-Lamport algorithm
S11
recording
record empty
S2 0
stop recording
record 1
Two-dollar bank algorithm
the snaphot
Write a Comment
User Comments (0)
About PowerShow.com