[ Home | Class Roster | Syllabus | Status | Glossary | Search | Course Notes]
(see also here)
Solutions:
Clock Server
Synchronized local clocks
Time Signal (GPS)
Logical Clock (establish happened before relationship)
QUESTION: why need to common notion of time? figure 5.1
Need to know causality
coherent view: all observations of different processes are made at same phyical time
complete view: local state of all processes plus messages in transit = global state
Question: what is state? what is observable?
event: any action which changes the state of a process or
transfers that state (in a message) to another process.
Could be a single instruction or a set of function calls.
Message sending events have a special significance in a distributed system - they provide the observation points of a computation.
Computation: set of interacting processes used to produce a desired result
a -> b, if "a" and "b" are in the same process and "a" occurred before "b"
a -> b, if "a" is the event of sending a message and "b" is the event of receiving that message
IF a->b and b->c, then a->c (happened before is transitive)
casually related events: event "a" casually affects "b" if a-> b
concurrent events: denoted a || b if !(a->b) AND !(b->a)
Show space-time diagram
QUESTION: what are the event relationships below?
Let "C" be a monotonically increasing function that assigns a timestamp to an event
for any events "a" and "b"
if a -> b then C(a) < C(b)
[IR1] Clock Ci is incremented between any two successive events.
[IR2] If "a" is the event of sending a message
in process "Pi", then that message is assigned the timestamp Ci(a).
Upon receiving a message with timestamp (Tm), process Pj will set it's clock to
max(Cj,Tm+d) (d > 0)
"happened before" defines a irreflexive partial order among events which can be totally ordered by breaking ties using process ID or some such tie breaking mechanism.
if a ->b then C(a) < C(b), but the reverse is not necessarily true. (figure 5.4)
That is does not distinguish local events from message passing ones.
Question: is it sufficient to only timestamp message events?
However the scheme proposed in ISIS can
resolve this.
Assign a vector of length n = number of communicating process for
each process, where the i-th location contains that processes
current understanding of the value of Pi's logical clock.
Assertion: for-all i,j: Ci[i] >= Cj[i].
QUESTION: What other assertions can be made?
fg 5.5
But what if receiver crashes and loses message number tables?
When message tables be purged?
NOTE: message arriving out of order mean that the receive events have a different -> relationship than the corresponding send events.
Use vector clocks as a message counter.
Algorithm 1: Go over Birman-etal algorihtm p. 107 - uses broadcast messages
Consider Figure 5-6
Timestamp for Send(M1) event is (1,0,0)
Timestamp for second send from P1 is (2,0,0)
Timestamp for first send of P3 is (0,0,1)
Timestamp for Send(M2) is (2,1,1)
When message M2 is received by P3 (with timestamp (2,1,1), since P3 knows that P1 has sent 2 messages but since only one has been received, it delays the delivery of M2.
Question: How does P3 "know" that M1 is for it? and therefore needs to delay?
Algorithm 2: Schipper -etal does not use broadcast
Consider figure 5-6 again.
(event e31) When P3 send its message to P2 is has timestamp (0,0,1) and empty V_P3
P3 sets V_P3 to ((P2,(0,0,1))) - that is sent message to P2 with time stamp (0,0,1)
(event e11) When P1 sends M1 it sets the timestamp of M1 to (1,0,0) and also sends V_P1 (empty)
P1 then sets V_P1 to ((P3,(1,0,0))) - that is sent message to P3 with time stamp (1,0,0)
(event e12) When P1 sends its second message to P2 it has time stamp (2,0,0) and also sends V_P1 ((P3,(1,0,0))
P1 then sets V_P1 to ((P3,(1,0,0)),(P2,(2,0,0))) - that is sent message to P2 with time stamp (2,0,0)
(event e21) When P2 receives the first message from P3, it is delivered immediately since the accompaning V-P3 is empty
update P2s logical clock to (0,1,1)
(event e22) When P2 receives the second message from P1, it is delivered immediately since the accompaning V-P1 does not contain a pair referring to P2.
Update V_P2 to ((P3,(1,0,0)))
update P2s logical clock to (2,2,1)
(event e23) When P2 sends message M2 to P3 is has timestamp (2,3,1) and V_P2 = ((P3,(1,0,0)))
(event e32) When P3 receives M2, message delayed since V_P2 has pair (P3,(1,0,0) but vector clock has 0 for P1. That is, P3 knows it should have received a message that updates P1's clock to 1.
(event e33) When P3 receives message M1, it is delivered (because V_P1 is empty indicating this message has no causalities.
update logical clock to P3 to (1,0,2)
Now can deliver M2
update logical clock in P3 to (2,3,3)
Coherent is impossible - what about "consistent"
Consider Figure 5.7: need to record state of communications channel
Question: what is meant by a consistent global state?
Question: What is the invariant here?
consistent state requires that all information exchanged between
be accounted for.
if n is the number of messages sent by process A when its local
state was recorded and n' is the number of messages sent by A as
recorded in the channel in its local state, then the global state may be
inconsistent if n < n' or if n > n'.
Hence a consistent global state requires n = n'.
Similarly for the receiver (using m and m') for the number of messages received. that is m = m' for a consistent state.
Since n' >= m, we get that in a consistent global state n >= m.
Question: what is the local state of a process?
send(Mij) in LSi iff time(send(Mij)) < time(LSi)
rec(Mij) in LSj iff time(rec(Mij)) < time(LSj)
Transit; transit(LSi,LSj) = { Mij | send(Mij) in LSi AND
rec(Mij) NOT in LSj}
Inconsistent: inconsisten(LSi,LSj) = {Mij | send(Mij) NOT in LSi AND
rec(Mij) in LSj}
A global state is a collection of local states of all processes
consistent global state: a global state = {LS1, LS2,...,LSn} is consistent iff
FORALLi,j: 1 <=i,j <=n :: inconsistent(LSi,LSj) is empty
Transitless global state: iff
FORALLi,j: 1 <=i,j <=n :: transit(LSi,LSj) is empty
strongly consistent global state iff consistent and transitless
How cuts in figure 5.8
Go over 5.6.1 with an example
Questions:
who starts the recording algorithm?
what if several processes start it?
where is the global state kept?
does it need to be kept somewhere?
Theorem: Fig 5.9 illustrates that there is a permutation of the sequence of actions which actually occurred which goes through a recorded state (which may not have ever existed in real time)
consistent cut: let Ek be an event at site(process) Sk, A cut C = {C1,C2,...,Cn} is consistent iff
FORALL Si, Sj, there does not exist a Ei,Ej such that (Ei -> Ej) AND (Ej ->Cj) AND (NOT Ei -> Ci)
Theorem 5.1: A cut is consistent iff no two cut events are causally related.
Theorem 5,2:a cut is consistent iff no cut has a vector time stamp that is componentwise less than any other cut's vector time stamp
process is either active or idle
Only active processes can send a message
An active process can be idle at any time
idle process can become active when it receives a message
A computation is idle iff all processes are idle and there are no messages
EXAMPLE: three processes (P1, P2, P3) and one controlling
process (CP). Let P1 be the "start" process.
Let CM = computation message
CP sends control message to P1 with weight = .5
P1 starts and sends CM1 to P2 with weight .25 keeping weight .25
P1 sends CM2 to P3 with weight .125 keeping .125
P1 goes idle by sending weight .125 to CP whose weight is now .625
P2 sends CM3 to P3 with weight .125 keeping .125
P3 sends CM4 to P1 with weight .125 keeping .125
P2 goes idle sending its weight to CP
P3 goes idle sending its weight to CP
P1 goes idle sending its weight to CP.
Huang's Termination detection algorithm: (go over proof and example)
Assignment 4: Pick any two of the problems 5.1 to 5.7 to solve
|
Guidelines for Assignments:
Assignments must be posted on your web sites. Obviously you should not
copy another student's assignment and treat it as your own. Assignments
are an extension of the class dialog. Basically you get credit for doing
an assignment and no credit for not doing it. Really exception answers get
extra credit. Most assignments require only short answers - but they should be well thought out answers showing insight into the problem. |