+ All Categories
Home > Documents > SES Algorithm

SES Algorithm

Date post: 03-Jun-2018
Category:
Upload: duongmf682450010
View: 256 times
Download: 3 times
Share this document with a friend

of 23

Transcript
  • 8/12/2019 SES Algorithm

    1/23

    1

    SES Algorithm SES: Schiper-Eggli-Sandoz Algorithm. No

    need for broadcast messages. Each process maintains a vector V_P of size

    N - 1, N the number of processes in thesystem. V_P is a vector of tuple (P,t): P the

    destination process id and t, a vectortimestamp.

    Tm: logical time of sending message m Tpi: present logical time at pi

    Initially, V_P is empty.

  • 8/12/2019 SES Algorithm

    2/23

  • 8/12/2019 SES Algorithm

    3/23

    3

    SES Algorithm ... What does the condition t Tp2 imply?

    t is message vector time stamp. t > Tp2 -> For all j, t[j] > Tp2[j] This implies some events occurred without P2s

    knowledge in other processes. So P2 decides to buffer themessage.

    When t < Tp2, message is delivered & Tp2 isupdated with the help of V_P2 (after the mergeoperation).

  • 8/12/2019 SES Algorithm

    4/23

    4

    SES Buffering Example

    P1

    P2

    P3

    M1

    (0,2,1)

    (0,1,0) (0,2,0)

    (2,2,2)(1,1,0)

    (0,2,2)

    M2

    M3

    V_P2empty

    V_P2:(P1, )

    V_P3:(P1,)

    Tp1:

    Tp2:

    Tp3:

    (0,0,0)

    M4V_P3:(P1,)

    V_P2:

    (P1, )(P3, )

  • 8/12/2019 SES Algorithm

    5/23

    5

    SES Buffering Example... M1 from P2 to P1: M1 + Tm (=) + Empty

    V_P2 M2 from P2 to P3: M2 + Tm () + (P1,

    ) M3 from P3 to P1: M3 + + (P1, ) M3 gets buffered because:

    Tp1 is , t in (P1, t) is & so Tp1 < t

    When M1 is received by P1: Tp1 becomes , by rules 1 and 2 of vector clock.

    After updating Tp1, P1 checks buffered M3. Now, Tp1 > t [in (P1, ]. So M3 is delivered.

  • 8/12/2019 SES Algorithm

    6/23

    6

    SES Algorithm ...

    On delivering the message: Merge V_M (in message) with V_P2 as follows.

    If (P,t) is not there in V_P2, merge.

    If (P,t) is present in V_P2, t is updated with max(t[i] inVm, t[i] in V_P2). {Component-wise maximum}.

    Message cannot be delivered until t in V_M isgreater than t in V_P2

    Update site P2s local, logical clock. Check buffered messages after local, logical

    clock update.

  • 8/12/2019 SES Algorithm

    7/237

    SES Algorithm

    P1

    P2

    P3

    M2

    M1(0,0,1)

    (0,1,1)

    (0,2,1)

    (1,2,1) (2,2,1)

    (0,2,2)

    V_P3 isempty

    V_P2 isempty

  • 8/12/2019 SES Algorithm

    8/238

    Global State

    $500 $200

    A B

    C1: Empty

    C2: Empty

    Global State 1

    $450 $200

    A B

    C1: Tx $50

    C2: Empty

    Global State 2

    $450 $250

    A B

    C1: Empty

    C2: Empty

    Global State 3

  • 8/12/2019 SES Algorithm

    9/23

  • 8/12/2019 SES Algorithm

    10/2310

    Recording Global State... Similarly, for consistency m = m m: no. of messages received along channel before Bs state

    recording m: no. of messages received along channel by B before

    channels state was recorded.

    Also, n >= m, as in no system no. of messages sentalong the channel be less than that received

    Hence, n >= m Consistent global state should satisfy the above

    equation. Consistent global state:

    Channel state: sequence of messages sent before recordingsenders state, excluding the messages received before

    receivers state was recorded. Only transit messages are recorded in the channel state.

  • 8/12/2019 SES Algorithm

    11/2311

    Recording Global State Send(Mij): message M sent from Si to Sj rec(Mij): message M received by Sj, from Si time(x): Time of event x

    LSi: local state at Si send(Mij) is in LSi iff (if and only if) time(send(Mij)) cj) and !(cj-> ci).

    S1

    S2

    S3

    S4

    c1

    c2c3

    c4

    VTc=

  • 8/12/2019 SES Algorithm

    20/2320

    Time of a Cut C = {c1, c2, .., cn} with vector time stamp VTci.

    Vector time of the cut, VTc = sup (VTc1, VTc2, ..,VTcn).

    sup is a component-wise maximum, i.e., VTci =

    max(VTc1[i], VTc2[i], .., VTcn[i]). Now, a cut is consistent iff VTc = (VTc1[1], VTc2[2],

    .., VTcn[n]).

  • 8/12/2019 SES Algorithm

    21/2321

    Termination Detection Termination: completion of the sequence of algorithm. (e.g.,)

    leader election, deadlock detection, deadlock resolution. Use a controlling agent or a monitor process. Initially, all processes are idle. Weight of controlling agent is 1

    (0 for others).

    Start of computation: message from controller to a process.Weight: split into half (0.5 each).

    Repeat this: any time a process send a computation messageto another process, split the weights between the twoprocesses (e.g., 0.25 each for the third time).

    End of computation: process sends its weight to the controller. Add this weight to that of controllers. (Sending processsweight becomes 0).

    Rule: Sum of W always 1. Termination: When weight of controller becomes 1 again.

  • 8/12/2019 SES Algorithm

    22/23

    22

    Huangs Algorithm B(DW): computation message, DW is the weight. C(DW): control/end of computation message; Rule 1: Before sending B, compute W1, W2 (such that W1 + W2 is

    W of the process). Send B(W2) to Pi, W = W1.

    Rule 2: Receiving B(DW) -> W = W + DW, process becomesactive. Rule 3: Active to Idle -> send C(DW), W = 0. Rule 4: Receiving C(DW) by controlling agent -> W = W + DW, If W

    == 1, computation has terminated.

  • 8/12/2019 SES Algorithm

    23/23

    23

    Huangs Algorithm

    P1

    P2 P3

    P4 P5

    1/2

    1/4

    1/8

    1/16

    1/16

    P1

    P2 P3

    P4 P5

    0.5

    0.5

    0

    0

    0


Recommended