Professional Documents
Culture Documents
Blank Homework
Notes Labs Scores Blank
Lecture Notes
Dr. Tong Lai Yu, March 2010
Peter Drucker
Distributed OS Theories
1. Inherent Limitations of a Distributed System
Physical Clocks
Problem
Solution
Based on the number of transitions per second of the cesium 133 atom
(pretty accurate).
At present, the real time is taken as the average of some 50
getting longer.
Note
UTC is broadcast through short wave radio and satellite. Satellites can give
Problem
Basic principle
second.
There is a clock in machine p that ticks on each timer interrupt.
words, dC/dt = 1.
In practice: 1 - r ≤ dC / dt ≤ 1 + r.
Goal
Never let two clocks in any system differ by more than δ time units =>
synchronize at least every δ/(2r) seconds.
Basic idea
Problem
synchronized:
Principal operation
( c is speed of light )
Real distance is
Observation
Principle I
Every machine asks a time server for the accurate time at least once
Note
Okay, but you need an accurate measure of round trip delay, including
Principle II
average, and inform each machine how it should adjust its time relative
Note
Okay, you'll probably get every machine in sync. You don't even need
Fundamental
You'll have to take into account that setting the time back is never
Problem
Realization
Condition requirements:
Implementation rules:
Ci = Ci + d ( d > 0 )
vector of length n )
Each event in process Pi ~ vector clock Ci ( integer
Ci[1]
C [2]
Ci = i
..
Ci
[n]
Implementation Rules:
Ci(b)[i] =
Ci(a)[i] + d ( d > 0 )
Assertion.
At any instant
diagrams
Distributed system
send ( mij ) ∈ LSi iff time ( send ( mij ) ) < time ( LSi )
recv ( mij ) ∈ LSj iff time ( recv ( mij ) ) < time ( LSj )
if Send( M1 ) → Send( M2 )
Applications: database replication management, monitoring distributed computations, simplifying distributed algorithms,...
Solution idea: upon arrival of a message at a process, buffer (delay delivery) the message until the message immediately preceding it
is delivered
Assumes broadcast communication channels that do not lose or corrupt messages. ( i.e. everyone talks to everyone ). Use vector clocks to
"count" number of messages ( i.e. set d = 1 ). n processes.
Vector Time:
The Protocol:
and
Pj has received all messages that Pi
had received before sending m.
Example
Schiper-Eggli-Sandoz were able to solve the problem without broadcasting channels
The goal of this distributed algorithm is to capture a consistent global state. It assumes all communication channels are FIFO. It uses a
distinguished message called a marker to start the algorithm.
Pi sends marker
1. Pi records its local state
2. For each channel Cij on which Pi has not already sent a marker, Pi sends a marker before sending other messages.
Example
Snapshot s1:
Termination
Graphical representation of GS
Consistent Cut:
( ei → ej ) and
( ei → cj ) and
( ei ci )
: (This is inconsistent cut!)
Theorem
A cut C = { c1, c2, ... ,cn }
is a consistent cut iff no two cut events are causally related.
( i.e. every pair of cut events are
concurrent )
Time of a cut
Ci -- vector clock of ci
TC = sup ( C1,
C2, ... ,
Cn
)
C1[1]
C2[2]
TC = . -------------- (1)
.
Cn[n]
Proof:
C1[1]
C2[2]
TC = sup ( C1,
C2, ... ,
Cn
) = .
.
Cn[n]
System Model
Protocol
Example
The picture shows a process P0, designated the controlling agent, with W0 = 1. It asks P1 and P2 to do some computation. It sets
W01 = 0.2
W02 = 0.3
W0 = 0.5
P2 in turn asks P3 and P4 to do some computations. It sets
W23 = 0.1
W24 = 0.1
When P3 terminates, it sends C(W3) = C(0.1) to P2, which changes W2 to 0.1 + 0.1 = 0.2.
When P2 terminates, it sends C(W2) = C(0.2) to P0, which changes W0 to 0.5 + 0.2 = 0.7.
When P4 terminates, it sends C(W4) = C(0.1) to P0, which changes W0 to 0.7 + 0.1 = 0.8.
When P1 terminates, it sends C(W1) = C(0.2) to P0, which changes W0 to 0.8 + 0.2 = 1.
Total number of messages passed: 8 (one to start each computation, one to return the weight).