MC714: Sistemas Distribu´ ıdos
- Prof. Lucas Wanner
Instituto de Computac ¸ ˜ ao, Unicamp
Coordenac ¸ ˜ ao Aula 9: Sincronizac ¸ ˜ ao de rel´
- gios
Aula 10: Rel´
- gios l´
- gicos e vetoriais
MC714: Sistemas Distribu dos Prof. Lucas Wanner Instituto de - - PowerPoint PPT Presentation
MC714: Sistemas Distribu dos Prof. Lucas Wanner Instituto de Computac ao, Unicamp Coordenac ao Aula 9: Sincronizac ao de rel ogios Aula 10: Rel ogios l ogicos e vetoriais Aula 11: Exclus ao m utua
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 2 / 47
3 / 47
5 / 47
6 / 47
7 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 8 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 9 / 47
Fast clock P e r f e c t c l
k S l
c l
k Clock time, C dC dt > 1 dC dt = 1 dC dt < 1 UTC, t
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 10 / 47
Height x (-6,6) r = 10 (14,14) r = 16 Point to be ignored
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 11 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 12 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 13 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 14 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 15 / 47
1
2
3
16 / 47
17 / 47
1
2
3
4
18 / 47
19 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 20 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 21 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 22 / 47
6 12 18 24 30 36 42 48 54 60 8 16 24 32 40 48 56 64 72 80 10 20 30 40 50 60 70 80 90 100 m1 m2 m3 m4 6 12 18 24 30 36 42 48 70 76 8 16 24 32 40 48 61 69 77 85 10 20 30 40 50 60 70 80 90 100 m1 m2 m3 m4 P adjusts its clock P adjusts its clock (b) (a) P1 P2 P3 P1 P2 P3
2 1
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 23 / 47
Application layer Middleware layer Network layer Message is delivered to application Adjust local clock Message is received Adjust local clock and timestamp message Application sends message Middleware sends message
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 24 / 47
Update 1 Update 2 Update 1 is performed before update 2 Update 2 is performed before update 1 Replicated database
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 25 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 26 / 47
6 12 18 24 30 36 42 48 70 76 8 16 24 32 40 48 61 69 77 85 10 20 30 40 50 60 70 80 90 100 m1 m2 m3 m5 m4 P1 P2 P3
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 27 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 28 / 47
29 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 30 / 47
P0 P1 P2
2
VC = (1,0,0)
2
VC = (1,1,0)
1
VC = (1,0,0) VC = (1,1,0) VC = (1,1,0)
2
m m*
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 31 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 32 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 33 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 34 / 47
1 1 1 2 2 2 8 8 8 12 12 12 OK OK OK OK Accesses resource Accesses resource (a) (b) (c)
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 35 / 47
1 2 3 4 5 6 7 2 4 7 1 6 5 3 (a) (b)
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 36 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 37 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 38 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 39 / 47
1 2 4 5 6 3 7 1 2 4 5 6 3 7 1 2 4 5 6 3 7 1 2 4 5 6 3 7 Election Election E l e c t i
Election OK OK Previous coordinator has crashed E l e c t i
Election 1 2 4 5 6 3 7 OK Coordinator (a) (b) (c) (d) (e) Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 40 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 41 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 42 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 43 / 47
Source: Maarten van Steen, Distributed Systems: Principles and Paradigms 44 / 47
1
2
3
4
5
6
45 / 47
7
8
46 / 47
9
47 / 47