Distributed Computing Notes - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Distributed Computing Notes

Description:

Message passing to synchronize clock. message transit time not ... if a b and b c, then a c (Transitive) Casual affects - past events influence future events ... – PowerPoint PPT presentation

Number of Views:134
Avg rating:3.0/5.0
Slides: 24
Provided by: fredk5
Category:

less

Transcript and Presenter's Notes

Title: Distributed Computing Notes


1
Distributed Computing Notes
  • CS422

2
Time and Event Ordering
  • Synchronizing clocks
  • Lamports Logical Clock
  • Event Ordering
  • Vector Clock
  • Causal Ordering of Events

3
Clock Synchronization
  • Message passing to synchronize clock
  • message transit time not predictable
  • can not be used to establish an event order
  • Network Time Protocol

4
Logical Time and Logical Clocks
  • Within a process, events ordered by local clock
  • two events within a process occur in the order
    they are observed
  • Distributed events must be ordered using a
    logical clock
  • The act (event) of sending a message occurs
    before the event of receiving the message.

5
Lamports Logical Clock
Scheme to order event in a distributed system
using logical clocks Process execution
characterized by a sequence of events. Events
can be procedure invocation instruction
execution message exchange sending a
message receiving a message
6
Definitions
Ascertain order of two events based on behavior
of underlying computation Happened Before
Relation (?) - Casual relationship between two
events. a ? b, events in same process, a
occurred before b a ? b, a is sending message, b
is receiving message if a ? b and b ? c, then a ?
c (Transitive) Casual affects - past events
influence future events
7
Definitions
Causally Related Events - Event a causally
affects event b if a ? b. Concurrent Events ()
- events a and b are concurrent (ab) if a b
and b a. That is, no causal affect. For
any two events in a system either a ? b, b ? a,
or a b Note a ? b only represents a potential
causality.
8
Example space-time diagram
e12
e14
e11
e13
e24
e21
e22
e23
9
Logical clocks
Clock Ci for each process Pi in system Ci (a)
assigns a timestamp to event a at Pi Logical
clocks take monotonically increasing values
10
Logical Clocks - Conditions
If a ? b, then C(a) lt C(b) C1 For any two
events a and b in a process Pi, if a occurs
before b then Ci(a) lt Ci(b) C2 If a is sending
a message m from Pi and b is receiving a message
m at Pj, then Ci(a) lt Cj(b)
11
Logical Clocks - Implementation
IR1 Clock Ci is incremented before each event
in Pi Ci Ci 1 if a and b are successive
events in Pi and a ? b, then Ci(b) Ci(a)
1 IR2 If event a is sending message m by Pi,
then m is assigned timestamp tm Ci(a) (obtained
after applying IR1). On receiving (m, t) by Pj,
Cj max(Cj, tm 1)(on receiving m Cj is
incremented by IR1)
12
Ordering of Events
Set of all events can be totally ordered (gt) if
a is any event at Pi, b any event at Pj then
agtb ? Ci(a) lt Cj(b) ? (Ci(a) Cj(b) ? Pi ? Pj)
where ? defines an arbitrary relation that orders
P
e11
e12
e14
e13
e13
(2)
(4)
(5)
(3)
(1)
(1)
(5)
(2)
(4)
e21
e22
e23
e24
13
Limitations of Lamports Clocks
a ? b ? C(a) lt C(b), but reverse not necessarily
true (rules of inference). For example, if a and
b are in different processes. C(a) lt C(b) ? Note
? represents a conditional relationship (if X
then Y, X is the antecedent and Y is the
consequent). The only time a conditional is
false (invalid) is when the antecedent is true
but the consequent if false.
14
Causal Ordering of Messages
Maintaining the same causal relationship that
holds among message send events with the
corresponding message receive events.
Distinguish between causal ordering of events and
messages
e12
e14
e13
e11
e13
e21
e22
e24
e23
e31
e32
e33
e34
15
Global State
  • Made difficult due to absence of global clock and
    shared memory
  • Definitions
  • Si Site i
  • LSi Local State for Site i
  • send(mij) send event of message mij by Si to Sj
  • rec(mij) receive event of message mij by Sj
  • time(x) time state x was recorded
  • time(send(m)) time event send(m) occured.

16
Local State
  • Definitions
  • Si Site i
  • LSi Local State for Site i
  • send(mij) send event of message mij by Si to Sj
  • rec(mij) receive event of message mij by Sj
  • time(x) time state x was recorded
  • time(send(m)) time event send(m) occured.

17
Local State
  • for a message mij sent by Si to Sj
  • send(mij) is in LSi iff time(send(mij)) lt
    time(LSi)
  • rec(mij) is in LSi iff time(rec(mij)) lt time(LSj)
  • Inconsistent
  • inconsistent(LSi, LSj) mij send(mij) not in
    LSi and rec(mij) in LSj
  • Transit
  • transit(LSi, LSj) mij send(mij) in LSi and
    rec(mij) not in LSj

18
Global State
  • Global State (GS) collection of the local
    states of system sites. GS LSi, LS2, ..., LSn
  • Does not guarantee consistency
  • Consistent Global State A global state GS
    LSi, LS2, ..., LSn is consistent iff for all i
    and j, 1 lt i,j lt n inconsistent(LSi, LSj) is
    the null set.
  • Consistent State gt every receive event has a
    corresponding send event
  • Inconsistent Stategt there is at least one
    receive event for which not send event is recorded

19
Global State
  • Transitless Global State - All communication
    channels are empty.
  • for all i, j 1lti,jltntransit(LSi, LSj) NULL
  • Strongly Consistent State - State is both
    consistent and transitless. In other words,
    consistent global state with all communications
    channels empty.

20
Chandy-Lamport (Snapshot) Algorithm
  • Uses marker message to initiate algorithm
  • Communication channels are FIFO
  • Can be initiated by any process
  • Several processes can initiate concurrently
  • Each initiation requires a unique marker
    identifier (process-id, sequence number).
  • All local state must be collected simple method
    is to include identifier in marker and each
    process then sends LS to the initiating process.

21
Basic Algorithm
  • R1 Marker Send Rule - P sends, channel C
  • P records its local state (LSp)
  • foreach outgoing channel C send marker before
    sending another message
  • R2 Marker Receive Rule - Q receives, channel C
  • if LSq NULL, then record state C NULL, go to R1
  • else record state C sequence of messages
    received since LSq recorded and marker received.

22
Discussion
  • The collected global state may not correspond a
    real global state. This is due to distributed
    nature of the algorithm and propagation delays.
  • However, the algorithm has the ability to detect
    stable properties such as process termination,
    computation completion, or deadlock.

23
Distributed Coordination
Server implemented mutual exclusion Distributed
mutual exclusion Central server Distributed
manager ring-based
Write a Comment
User Comments (0)
About PowerShow.com