SlideShare a Scribd company logo

Distributed Systems
Chapter 5 Synchronization
Synchnonization in Distributed Systems
Time in DS
• Time is an interesting and Important issue in DS
– Ex. At what time of day a particular event occurred at a particular
computer … Consistency (use of timestamp for serialization), e-
commerce, authentication etc.
• Algorithms that depend upon clock synchronization
have been developed for several problems.
• Due to loose synchrony, the notion of physical time is
problematic in DS
– There is no absolute physical “global time” in DS
Clocks
– How time is really measured?
» Earlier: Solar day, solar second, mean solar second
• Solar day: time between two consequtive transits
of the sun
• Solar second: 1/86400 of a solar day
• Mean solar day: average length of a solar day
• Problem: solar day gets longer because of
slowdown of earth rotation due to friction (300
million years ago there were 400 days per year)
Physical Clocks
• International Atomic Time (TAI): number of
ticks of Cesium 133 atom since 1/1/58
(atomic second)
• Atom clock: one second defined as (since
1967) 9,192,631,770 transitions of the atom
Cesium 133
Physical Clocks
• Because of slowdown of earth, leap seconds have
to be introduced
• Correction of TAI is called Universal Coordinated
Time (UTC): 30 leap seconds introduced so far
• Network Time Protocol (NTP) can synchronize
globally with an accuracy of up to 50 msec
Physical Clocks
• TAI seconds are of constant length, unlike solar
seconds. Leap seconds are introduced when necessary
to keep in phase with the sun.
Clocks
– Computers contain physical clock (crystal
oscillator)
» Physical time t, hardware time Hi(t), software time Ci(t)
» The clock output can be read by SW and scaled into a
suitable time unit and the value can be used to timestamp
any event
Ci(t) = Hi(t) + 
– Clock skew
» The instantaneous difference between the
readings of any two clocks
– Clock drift: Crystal-based clocks count time at different
rates, and so diverge.
Why
synchronization?
• You want to catch the 5 pm bus at the Harar stop,
but your watch is off by 15 minutes
– What if your watch is Late by 15 minutes?
– What if your watch is Fast by 15 minutes?
• Synchronization is required for
– Correctness
– Fairness
Why synchronization?
• Airline reservation system
• Server A receives a client request to purchase last
ticket on flight ABC 123.
• Server A timestamps purchase using local clock
9h:15m:32.45s, and logs it. Replies ok to client.
• That was the last seat. Server A sends message to
Server B saying “flight full.”
• B enters “Flight ABC 123 full” + local clock value
(which reads 9h:10m:10.11s) into its log.
• Server C queries A’s and B’s logs. Is confused
that a client purchased a ticket after the flight
became full.
– May execute incorrect or unfair actions.
Clock synchronization
• UTC signals are synchronized and broadcast
regularly from land-based radio stations and
satellites covering many parts of the world
– E.g. in the US the radio station WWV broadcasts time signals on
several short-wave frequencies
– Satellite sources include Geo-stationary Operational
Environmental Satellites (GOES) and the GPS
Clock synchronization
– Radio waves travel at near the speed of light. The propagation
delay can be accounted for if the exact speed and the distance
from the source are known
– Unfortunately, the propagation speed varies with atmospheric
conditions – leading to inaccuracy
– Accuracy of a received signal is a function of both the accuracy
of the source and its distance from the source through the
atmosphere
Clock Synchronization Algorithms
• The relation between clock time and UTC when clocks tick at different
rates.
Problem: show that, in order
to guarantee that no two
clocks differ by more than ,
clocks must be
resynchronized at least every
/2 seconds.
Clock Synchronization Algorithms
• The constant  is specified by the manufacturer and is
known as the maximum drift rate.
• If two clocks are drifting from the Universal Coordinated
Time (UTC) in opposite direction, at a time t after they are
synchronized, they maybe as much as 2*  *t apart.
• If the operating system designer want to guarantee that no
two clocks ever differ by more than , clocks must be
synchronized at least every  /2  seconds.
Clock synchronization
–Remember the definition of
synchronous distributed system?
» Known bounds for message delay, clock
drift rate and execution time.
• Clock synchronization is easy in this
case
» In practice most DS are asynchronous.
• Cristian’s Algorithm
• The Berkeley Algorithm
Clock synchronization in a synchronous system
• Consider internal synch between two procs in a
synch DS
• P sends time t on its local clock to Q in a msg m
• In principle, Q could set its clock to the time t + Ttrans,
where Ttrans is the time taken to transmit m between
them
• The two processes would then agree (internal synch)
Clock synchronization in a synchronous system
• Unfortunately, Ttrans is subject to variation and
is unknown
– All processes are competing for resources with P and Q
and other messages are competing with m for the network
– But there is always a minimum transmission time min that
would be obtained if no other processes executed and no
other network traffic existed
– min can be measured or conservatively estimated
Clock synchronization in a synchronous system
• In synch system, by definition, there is also an upper
bound max on the time taken to transmit any
message
• Let the uncertainty in the msg transmission time be u,
so that u = (max – min)
– If Q sets its clock to be (t + min), then clock skew may be as much
as u (since the message may in fact have taken time max to arrive).
– If Q sets it to (t + max), the skew may again be as large as u.
– If, however, Q sets it clock to (t + (max + min)/2), then the skew is at
most u/2.
– In general, for a synch system, the optimum bound that can be
achieved on clock skew when synchronizing N clocks is u(1-1/N)
• For an asynch system Ttrans = min + x, where x >=0
Cristian’s Algorithm (Accuracy)
• Assumption
– Request & reply via same network
– The value of minimum transmission time min is known or
conservatively estimated.
The Berkeley Algorithm (internal synchronization)
• A coordinator (time server): master
– Periodically the master polls the time of each
client (slave) whose clocks are to be
synchronized.
– Based on the answer (by observing the RTT as in
Cristian’s algorithm), it computes the average
(including its own clock value) and broadcasts the
new time.
• This method is suitable for a system in which no
machine has a WWV receiver getting the UTC.
• The time daemon’s time must be set manually by the
operator periodically.
The Berkeley Algorithm
• The balance of probabilities is that the average
cancels out the individual clock’s tendencies to
run fast or slow
• The accuracy depends upon a nominal maximum
RTT between the master and the slaves
• The master eliminates any occasional readings
associated with larger times than this maximum
The Berkeley Algorithm
– Instead of sending the updated current time
back to the comps – which will introduce further
uncertainty due to message transmission time –
the master send the amount by which each
individual slave’s clock requires adjustment (+
or - )
– The algorithm eliminates readings from faulty
clocks (since these could have significant
adverse effects if an ordinary average was
taken) – a subset of clock is chosen that do not
differ by more than a specified amount and then
the average is taken.
The Berkeley Algorithm
• The time daemon asks all the other machines for their clock values
• The machines answer
• The time daemon tells everyone how to adjust their clock
Averaging Algorithms
• Both Cristian’s and Berkeley’s methods are highly
centralized, with the usual disadvantages - single point
of failure, congestion around the server, … etc.
• One class of decentralized clock synchronization
algorithms works by dividing time into fixed-length re-
synchronization intervals.
• The ith
interval starts at T0 + iR and runs until T0 + (i+1)R,
where T0 is an agreed upon moment in the past, and R
is a system parameter.
25

More Related Content

PPT
Time-Synchronization-ds14.pptmmmmmmmmmmmmmmmmmmmmmmmmmmm
PPT
Clock synchronization in distributed system
PPT
Chapter 10
PPTX
3. syncro. in distributed system
PPTX
Lesson 05 - Time in Distrributed System.pptx
PDF
Clock.pdf
PPT
Clock Synchronization (Distributed computing)
Time-Synchronization-ds14.pptmmmmmmmmmmmmmmmmmmmmmmmmmmm
Clock synchronization in distributed system
Chapter 10
3. syncro. in distributed system
Lesson 05 - Time in Distrributed System.pptx
Clock.pdf
Clock Synchronization (Distributed computing)

Similar to Chapter Five: Introduction to Syncho.pptduction to Syncho.ppt (20)

PPT
dokumen.tips_synchronization-in-distributed-systems-chapter-6.ppt
PPTX
Unit iii-Synchronization
PPTX
Unit V Synchronization of distributed system.pptx
PPTX
Synchronization Pradeep K Sinha
PPT
L12.FA20.ppt
PDF
6.Distributed Operating Systems
PPT
clock synchronization in Distributed System
PPT
Chapter 6-Synchronozation2.ppt
PDF
Synchronisation
PPTX
Synchronization of multihop sensor networks in the app layer
PPTX
Synchronization
PPTX
slides.06.pptx
PPT
Chapter 5-Synchronozation.ppt
PPT
Unit- 4, Time and Global States Clocks, events and process states
PPT
09-time+synch.ppt
PPTX
Introduction to Timekeeping
PDF
Clock Synchronization in Distributed Systems
PDF
Hu3513551364
dokumen.tips_synchronization-in-distributed-systems-chapter-6.ppt
Unit iii-Synchronization
Unit V Synchronization of distributed system.pptx
Synchronization Pradeep K Sinha
L12.FA20.ppt
6.Distributed Operating Systems
clock synchronization in Distributed System
Chapter 6-Synchronozation2.ppt
Synchronisation
Synchronization of multihop sensor networks in the app layer
Synchronization
slides.06.pptx
Chapter 5-Synchronozation.ppt
Unit- 4, Time and Global States Clocks, events and process states
09-time+synch.ppt
Introduction to Timekeeping
Clock Synchronization in Distributed Systems
Hu3513551364
Ad

More from gadisaadamu101 (9)

PPTX
chapter Three artificial intelligence 1.pptx
PPTX
Chapter Four Deep Learning artificial intelligence .pptx
PPTX
Software Development Life Cycle and Models.pptx
PPTX
Introduction to Project Planning chapter 1.pptx
PPTX
introduction to software SDLC and Models.pptx
PPTX
Introductions to Design Logic.pptx IT level
PPT
Network and system administration Chapter 5.pptxChapter 6.ppt
PPTX
Network and system administration Chapter 5.pptx
PPT
network and system admistration by Chapter 4.ppt
chapter Three artificial intelligence 1.pptx
Chapter Four Deep Learning artificial intelligence .pptx
Software Development Life Cycle and Models.pptx
Introduction to Project Planning chapter 1.pptx
introduction to software SDLC and Models.pptx
Introductions to Design Logic.pptx IT level
Network and system administration Chapter 5.pptxChapter 6.ppt
Network and system administration Chapter 5.pptx
network and system admistration by Chapter 4.ppt
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
web development for engineering and engineering
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Construction Project Organization Group 2.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Project quality management in manufacturing
PDF
Digital Logic Computer Design lecture notes
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
additive manufacturing of ss316l using mig welding
R24 SURVEYING LAB MANUAL for civil enggi
web development for engineering and engineering
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
OOP with Java - Java Introduction (Basics)
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Construction Project Organization Group 2.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Project quality management in manufacturing
Digital Logic Computer Design lecture notes
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
additive manufacturing of ss316l using mig welding

Chapter Five: Introduction to Syncho.pptduction to Syncho.ppt

  • 3. Time in DS • Time is an interesting and Important issue in DS – Ex. At what time of day a particular event occurred at a particular computer … Consistency (use of timestamp for serialization), e- commerce, authentication etc. • Algorithms that depend upon clock synchronization have been developed for several problems. • Due to loose synchrony, the notion of physical time is problematic in DS – There is no absolute physical “global time” in DS
  • 4. Clocks – How time is really measured? » Earlier: Solar day, solar second, mean solar second • Solar day: time between two consequtive transits of the sun • Solar second: 1/86400 of a solar day • Mean solar day: average length of a solar day • Problem: solar day gets longer because of slowdown of earth rotation due to friction (300 million years ago there were 400 days per year)
  • 5. Physical Clocks • International Atomic Time (TAI): number of ticks of Cesium 133 atom since 1/1/58 (atomic second) • Atom clock: one second defined as (since 1967) 9,192,631,770 transitions of the atom Cesium 133
  • 6. Physical Clocks • Because of slowdown of earth, leap seconds have to be introduced • Correction of TAI is called Universal Coordinated Time (UTC): 30 leap seconds introduced so far • Network Time Protocol (NTP) can synchronize globally with an accuracy of up to 50 msec
  • 7. Physical Clocks • TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with the sun.
  • 8. Clocks – Computers contain physical clock (crystal oscillator) » Physical time t, hardware time Hi(t), software time Ci(t) » The clock output can be read by SW and scaled into a suitable time unit and the value can be used to timestamp any event Ci(t) = Hi(t) +  – Clock skew » The instantaneous difference between the readings of any two clocks – Clock drift: Crystal-based clocks count time at different rates, and so diverge.
  • 9. Why synchronization? • You want to catch the 5 pm bus at the Harar stop, but your watch is off by 15 minutes – What if your watch is Late by 15 minutes? – What if your watch is Fast by 15 minutes? • Synchronization is required for – Correctness – Fairness
  • 10. Why synchronization? • Airline reservation system • Server A receives a client request to purchase last ticket on flight ABC 123. • Server A timestamps purchase using local clock 9h:15m:32.45s, and logs it. Replies ok to client. • That was the last seat. Server A sends message to Server B saying “flight full.” • B enters “Flight ABC 123 full” + local clock value (which reads 9h:10m:10.11s) into its log. • Server C queries A’s and B’s logs. Is confused that a client purchased a ticket after the flight became full. – May execute incorrect or unfair actions.
  • 11. Clock synchronization • UTC signals are synchronized and broadcast regularly from land-based radio stations and satellites covering many parts of the world – E.g. in the US the radio station WWV broadcasts time signals on several short-wave frequencies – Satellite sources include Geo-stationary Operational Environmental Satellites (GOES) and the GPS
  • 12. Clock synchronization – Radio waves travel at near the speed of light. The propagation delay can be accounted for if the exact speed and the distance from the source are known – Unfortunately, the propagation speed varies with atmospheric conditions – leading to inaccuracy – Accuracy of a received signal is a function of both the accuracy of the source and its distance from the source through the atmosphere
  • 13. Clock Synchronization Algorithms • The relation between clock time and UTC when clocks tick at different rates. Problem: show that, in order to guarantee that no two clocks differ by more than , clocks must be resynchronized at least every /2 seconds.
  • 14. Clock Synchronization Algorithms • The constant  is specified by the manufacturer and is known as the maximum drift rate. • If two clocks are drifting from the Universal Coordinated Time (UTC) in opposite direction, at a time t after they are synchronized, they maybe as much as 2*  *t apart. • If the operating system designer want to guarantee that no two clocks ever differ by more than , clocks must be synchronized at least every  /2  seconds.
  • 15. Clock synchronization –Remember the definition of synchronous distributed system? » Known bounds for message delay, clock drift rate and execution time. • Clock synchronization is easy in this case » In practice most DS are asynchronous. • Cristian’s Algorithm • The Berkeley Algorithm
  • 16. Clock synchronization in a synchronous system • Consider internal synch between two procs in a synch DS • P sends time t on its local clock to Q in a msg m • In principle, Q could set its clock to the time t + Ttrans, where Ttrans is the time taken to transmit m between them • The two processes would then agree (internal synch)
  • 17. Clock synchronization in a synchronous system • Unfortunately, Ttrans is subject to variation and is unknown – All processes are competing for resources with P and Q and other messages are competing with m for the network – But there is always a minimum transmission time min that would be obtained if no other processes executed and no other network traffic existed – min can be measured or conservatively estimated
  • 18. Clock synchronization in a synchronous system • In synch system, by definition, there is also an upper bound max on the time taken to transmit any message • Let the uncertainty in the msg transmission time be u, so that u = (max – min) – If Q sets its clock to be (t + min), then clock skew may be as much as u (since the message may in fact have taken time max to arrive). – If Q sets it to (t + max), the skew may again be as large as u. – If, however, Q sets it clock to (t + (max + min)/2), then the skew is at most u/2. – In general, for a synch system, the optimum bound that can be achieved on clock skew when synchronizing N clocks is u(1-1/N) • For an asynch system Ttrans = min + x, where x >=0
  • 19. Cristian’s Algorithm (Accuracy) • Assumption – Request & reply via same network – The value of minimum transmission time min is known or conservatively estimated.
  • 20. The Berkeley Algorithm (internal synchronization) • A coordinator (time server): master – Periodically the master polls the time of each client (slave) whose clocks are to be synchronized. – Based on the answer (by observing the RTT as in Cristian’s algorithm), it computes the average (including its own clock value) and broadcasts the new time. • This method is suitable for a system in which no machine has a WWV receiver getting the UTC. • The time daemon’s time must be set manually by the operator periodically.
  • 21. The Berkeley Algorithm • The balance of probabilities is that the average cancels out the individual clock’s tendencies to run fast or slow • The accuracy depends upon a nominal maximum RTT between the master and the slaves • The master eliminates any occasional readings associated with larger times than this maximum
  • 22. The Berkeley Algorithm – Instead of sending the updated current time back to the comps – which will introduce further uncertainty due to message transmission time – the master send the amount by which each individual slave’s clock requires adjustment (+ or - ) – The algorithm eliminates readings from faulty clocks (since these could have significant adverse effects if an ordinary average was taken) – a subset of clock is chosen that do not differ by more than a specified amount and then the average is taken.
  • 23. The Berkeley Algorithm • The time daemon asks all the other machines for their clock values • The machines answer • The time daemon tells everyone how to adjust their clock
  • 24. Averaging Algorithms • Both Cristian’s and Berkeley’s methods are highly centralized, with the usual disadvantages - single point of failure, congestion around the server, … etc. • One class of decentralized clock synchronization algorithms works by dividing time into fixed-length re- synchronization intervals. • The ith interval starts at T0 + iR and runs until T0 + (i+1)R, where T0 is an agreed upon moment in the past, and R is a system parameter.
  • 25. 25