Logical%20Time - PowerPoint PPT Presentation

About This Presentation
Title:

Logical%20Time

Description:

Logical Time Each event is assigned a logical time from a totally ordered set T The logical times for the events must respect any possible dependencies between events – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 15
Provided by: Nancy450
Category:

less

Transcript and Presenter's Notes

Title: Logical%20Time


1
Logical Time
  • Each event is assigned a logical time from a
    totally ordered set T
  • The logical times for the events must respect any
    possible dependencies between events
  • If event A happens before event B at some process
    or in some channel, then the logical time of A
    must precede the logical time of B

2
Logical Time
ATM 1 1000
ATM 2 1000
ATM 3 1000
w1
s(1,2)
Withdraw 100
s(1,3)
r(1,2)
w2
Withdraw 100
r(1,3)
w3
3
Logical Time
Event Time Time Time
w1 1 1 1
s(1,2) 2 2 2
s(1,3) 3 5 3
r(1,2) 4 3 6
w2 5 4 7
r(1,3) 6 6 4
w3 7 7 5
ATM 1 1000
ATM 2 1000
ATM 3 1000
w1
s(1,2)
Withdraw 100
s(1,3)
r(1,2)
w2
Withdraw 100
w1 lt s(1,2) lt s(1,3) s(1,2) lt r(1,2) r(1,2) lt
w2 s(1,3) lt r(1,3) r(1,3) lt w3
r(1,3)
w3
4
Convenient Fact (Theorem 18.1)
  • Take any allowable assignment of logical times to
    an execution s0a1s1a2s2
  • That is, ltimes are in order for ais at the same
    process and for sends and receives
  • If the execution is reordered by logical times,
    it looks exactly the same to each process

5
Logical Time
Event Time Time Time
w1 1 1 1
s(1,2) 2 2 2
r(1,2) 3 5 3
s(1,3) 4 3 6
r(1,3) 5 4 7
w3 6 6 4
w2 7 7 5
ATM 1 1000
ATM 2 1000
ATM 3 1000
w1
s(1,2)
Withdraw 100
s(1,3)
r(1,2)
Withdraw 100
w1 lt s(1,2) lt s(1,3) s(1,2) lt r(1,2) r(1,2) lt
w2 s(1,3) lt r(1,3) r(1,3) lt w3
r(1,3)
w3
w2
6
Send/receive diagramaka Call Flow or Message
Sequence Chart
ATM 1 1000
ATM 2 1000
ATM 3 1000
w1
s(1,2)
Withdraw 100
s(1,3)
r(1,2)
w2
Withdraw 100
r(1,3)
w3
7
Non-blocking time-keeping
  • Each host maintains a clock
  • Before it sends, it timestamps the message with
    the next value of the clock
  • When it receives it updates the clock to be
    strictly greater than the timestamp on the
    message and the local clock

8
Blocking time-keeping
  • Each process assigns a logical time as the time
    of the clock the order of events at the process
  • It timestamps each message with the current time
    on the clock
  • It holds messages in a queue until the local
    clock catches up

9
Logical time
ATM 1-fast 1000
ATM 2 - slow 1000
ATM 3- medium 1000
w1
s(1,2)
Withdraw 100
s(1,3)
r(1,2)
w2
Withdraw 100
r(1,3)
w3
10
The Banking Problem
  • Asynchronous send/receive network
  • Banking system with a balance at each process
  • Transfers between banks
  • Each process has a local balance
  • The total of the local balances is the correct
    amount in the system

11
The Banking ProblemUsing logical times to define
snapshot
10
30
20
2
1
1
3
2
4
3
8
5
9
4
5
6
7
10
12
The Money Counting Algorithm
  • For each process of A, determine its local
    balance after all events with logical times
    before t and before any event with logical time
    after t
  • For each channel, determine the amount of money
    in messages sent before t but received after t

13
Computing the local balance
  • For process values
  • Attach a timestamp to each send event
  • Record money value just before the first event
    with time gt t
  • For channel values
  • Record incoming messages that arrive after time t
    until the first message sent at time gt t
  • The balance sum of the process value and all
    incoming channels

14
Global Snapshot Problem
  • A global snapshot returns a state of the system
  • States of all processes and channels
  • Looks to each process as if it was taken at the
    same instant everywhere
  • The bank problem is a special case
  • Note that the actual values computed in the bank
    algorithm may never have been observable by an
    omniscient observer.
Write a Comment
User Comments (0)
About PowerShow.com