Chap 7 Slides - Synchronization - Coordination
Chap 7 Slides - Synchronization - Coordination
Execution : different steps can have varying duration S YNCHRONISATION AND C OORDINATION
Communication : transmission delays vary widely Important:
Clocks : arbitrary clock drift Doing the right thing at the right time.
Slide 5 Slide 7
Effect: Two fundamental issues:
➜ Allows no assumption about time intervals ➜ Coordination (the right thing)
X Cannot rely on timeouts to detect failure ➜ Synchronisation (the right time)
X Most asynch DS problems hard to solve
V Solution for asynch DS is also a solution for synch DS
➜ Most real distributed systems are hybrid synch and asynch
Coordinate Actions:
➜ What actions will occur
Slide 9 ➜ Who will perform actions Slide 11 T IME AND C LOCKS
Agree on Values:
➜ Agree on global value
➜ Agree on environment
➜ Agree on state
T IME
Global Time:
M AIN I SSUES ➜ ’Absolute’ time
• Einstein says no absolute time
Time and Clocks: synchronising clocks and using time in • Absolute enough for our purposes
distributed algorithms ➜ Astronomical time
Slide 10 Global State: how to acquire knowledge of the system’s Slide 12 • Based on earth’s rotation
global state • Not stable
➜ International Atomic Time (IAT)
Concurrency Control: coordinating concurrent access to
• Based on oscillations of Cesium-133
resources
➜ Coordinated Universal Time (UTC)
• Leap seconds
• Signals broadcast over the world
Timestamps:
➜ Used to denote at which time an event occurred
B ERKELEY A LGORITHM
N ETWORK T IME P ROTOCOL (NTP)
Hierarchy of Servers:
Time daemon
3:00 3:00 3:00 0 3:05 +5 ➜ Primary Server: has UTC clock
2:50 3:25 2:50 3:25 3:05 3:05 Multicast: for LAN, low accuracy
(a) (b) (c)
Procedure Call: clients poll, reasonable accuracy
Local history:
➜ N processes pi , i ∈ {1, . . . , N }
G LOBAL S TATE ➜ For each pi ,
Determining global properties: • event series he0i , e1i , e2i , . . .i
➜ Distributed garbage collection: • is called pi ’s history denoted by hi .
Do any references exist to a given object? • May be finite or infinite
Slide 30 ➜ Distributed deadlock detection: Slide 32 ➜ We denote by hki a k-prefix of hi .
Do processes wait in a cycle for each other? ➜ Each event eji is either a local event or a communication event
➜ Distributed termination detection:
Process state:
Did a set of processes cease all activity? (Consider messages in
transit!) ➜ State of process pi immediately before event eki denoted ski
➜ State ski records all events included in the history hk−1
i
N
[
H= hi
i=1 0 1 0 1
Slide 33 Slide 35 P2 r
2 r
2
s
2
s
2 s
2
2
➜ Similarly, we can combine a set of local states s1 , . . . , sN into a
global state:
0 0 1
P1 s r
S = (s1 , . . . , sN ) 1 1 r
1
Consistent cut:
Cuts: ➜ We call a cut consistent iff,
➜ Similar to the global history, we can define cuts based on
for all events e′ ∈ C, e → e′ implies e ∈ C
k-prefixes:
N
[ ➜ A global state is consistent if it corresponds to a consistent cut
C= hci i ➜ Note: we can characterise the execution of a system as a
i=1
sequence of consistent global states
➜ hci i is history of pi up to and including event eci i
Slide 34 Slide 36 S0 → S1 → S2 → · · ·
➜ The cut C corresponds to the state
S = (sc11 +1 , . . . , scNn +1 )
Linearisation:
➜ The final events in a cut are its frontier: ➜ A global history that is consistent with the happened-before
relation → is also called a linearisation or consistent run
{eci i | i ∈ {1, . . . , N }}
➜ A linearisation only passes through consistent global states
➜ A state S ′ is reachable from state S if there is a linearisation that
passes thorough S and then S ′
(a) (b)
Enters
Messages Exchanged:
critical
region ➜ Messages per entry/exit of critical section
8
• Centralised: 3
0 0 0 • Ring: 1 → ∞
8 OK OK OK
12
8 Enters
• Multicast: 2(n − 1)
1 2 1 2 1 2 critical
12 OK region Delay:
12
Slide 50 (a) (b) (c)
Slide 52 ➜ Delay before entering critical section
• Centralised: 2
• Ring: 0 → n − 1
Properties: • Multicast: 2(n − 1)