1 distribuerede systemer og sikkerhed – 11. marts 2002 zfrom coulouris, dollimore and kindberg...
TRANSCRIPT
![Page 1: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/1.jpg)
1
Distribuerede systemer og sikkerhed – 11. marts 2002
From Coulouris, Dollimore and Kindberg
Distributed Systems: Concepts and Design
Edition 3, © Addison-Wesley 2001
Presentation based on slides for the book:
Slides modified by Jens B Jorgensen, University of Aarhus
![Page 2: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/2.jpg)
2
Slides for Chapter 10: Time (and Global State)
From Coulouris, Dollimore and Kindberg
Distributed Systems: Concepts and Design
Edition 3, © Addison-Wesley 2001
![Page 3: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/3.jpg)
3
Time – basics
We want to know when something happened.Algorithms may depend upon clock synchronization.No global notion of time.
![Page 4: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/4.jpg)
4
Time – system model
N processes: Each executes on a single processor. No shared memory. Only communication means is exchange of messages.
pi has state si.An event is the occurrence of a single action, i.e.:
An internal state-transforming action by pi, or a communication action.
e (->i) e’ iff e occurs before e’ in pi.
![Page 5: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/5.jpg)
5
Time – clocks
Each computer has its own physical clock.The software clock Ci can be used to timestamp any
event at pi.Problems: Clock skew and clock drift.
Network
![Page 6: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/6.jpg)
6
Time – Coordinated Universal Time (UTC)
International standard for timekeeping.Based on atomic time.Synchronizes with astronomical time using leap
seconds.UTC signals are synchronized and broadcast
regularly from land-based radio stations and satellites.
Computers with receivers attached can synchronize their clocks with these timing signals.
![Page 7: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/7.jpg)
7
Synchronizing physical clocks – basics
External synchronization: For each i, synchronize Ci with an authoritative, external source of time.
Internal synchronization: For each i,j, synchronize Ci and Cj with each other.
Other issues: Correctness, monotonicity, faulty clocks, crash failures, arbitrary failures.
![Page 8: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/8.jpg)
8
Synchronizing physical clocks – in a synchronous system
Internal synchronization.Sender sends local time t to receiver.Receiver ideally sets time to: t + T(trans).T(trans) in [min,max].Receiver set time to: t + (max+min)/2.
![Page 9: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/9.jpg)
9
Synchronizing physical clocks – Cristian’s algorithm
mr
mtp Time server,S
p records total round-trip time T(round);p sets its time to t+T(round)/2;If minimal transmission time is known, accuracy can be calculated.Problem: single point of failure.
External synchronization
![Page 10: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/10.jpg)
10
Synchronizing physical clocks – the Berkeley algorithm
Internal synchronization.A coordinator computer chosen to act as master.Master periodically polls the other computers (the
slaves).Slaves send back their clock values to master.Master calculates an average (taking the roundtrip
times into account).Master sends the amount by which each individual
slave’s clock requires adjustment.The algorithm eliminates readings from faulty clocks.
![Page 11: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/11.jpg)
11
Synchronizing physical clocks – the Network Time Protocol (NTP) aims
Provide a service enabling clients across the Internet to be synchronized accurately to UTC.
Provide a reliable service that can survive lengthy losses of connectivity.
Enable clients to resynchronize sufficiently frequently to offset the rates of drift found in most computers.
Provide protection against interference with the time service, whether malicious or accidental.
![Page 12: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/12.jpg)
12
Synchronizing physical clocks – NTP architecture
1
2
3
2
3 3
Note: Arrows denote synchronization control, numbers denote strata.
- A network of servers located across the Internet.
- Primary servers connected directly to time source.
- Secondary servers synchronized with primary servers.
- Servers connected in logical hierarchy, synchronization subnet.
- Three modes of sync.: Multicast, procedure-call, symmetric.
![Page 13: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/13.jpg)
13
Synchronizing physical clocks – NTP peers message exchange
Ti
Ti-1Ti-2
Ti- 3
Server B
Server A
Time
m m'
Time
T(i-3): Time when previous message sent.T(i-2): Time when previous message was received.T(i-1): Time when this message (just received) was sent.T(i): Time when this message was received.
![Page 14: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/14.jpg)
14
Logical time and logical clocks – happened-before relation
If two events occurred at the same process pi, then they occurred in the order in which pi observes them (->i).
Whenever a message is sent between processes, the event of sending the message occurred before the event of receiving the message.
Transitivite relation.
![Page 15: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/15.jpg)
15
Logical time and logical clocks – happened-before example
p1
p2
p3
a b
c d
e f
m1
m2
Physicaltime
![Page 16: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/16.jpg)
16
Logical time and logical clocks – Lamport logical clocks and timestamps
A Lamport logical clock is a monotonically increasing software counter.
Each process pi keeps its own logical clock Li which is used to apply Lamport timestamps to events.
To capture the happened-before relation ->, processes update their logical clocks and transmit the values of their logical clocks in messages as follows: Before each event at pi: Li := Li+1 When pi sends a message m, it piggybacks t=Li. When pj receives (m,t): Lj := max(Lj,t)+1.
e -> e’ => L(e) < L(e’).
![Page 17: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/17.jpg)
17
Logical time and logical clocks – Lamport timestamps example
a b
c d
e f
m1
m2
21
3 4
51
p1
p2
p3
Physical time
![Page 18: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/18.jpg)
18
Logical time and logical clocks – Vector timestamps example
a b
c d
e f
m1
m2
(2,0,0)(1,0,0)
(2,1,0) (2,2,0)
(2,2,2)(0,0,1)
p1
p2
p3
Physical time
Vi[i]: The number of events that pi has timestamped;Vi[j]: The number of events that have occurred at pj that pi has potentially been affected by, j <> i.
![Page 19: 1 Distribuerede systemer og sikkerhed – 11. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley](https://reader036.vdocument.in/reader036/viewer/2022082820/56649f3e5503460f94c5f03a/html5/thumbnails/19.jpg)
19
Summary
TimeSynchronization of physical clocks:
In a synchronous system. Cristian’s method. The Berkeley algorithm. The Network Time Protocol (NTP).
Logical time and logical clocks: The happened-before relation. Lamport’s logical clocks and Lamport’s timestamps. Vector timestamps.