SlideShare une entreprise Scribd logo
1  sur  25
1
NEED??
• Time driven systems: in statically scheduled systems
activities are started at "precise" times in different points of
the distributed system.
• Time stamps: certain events or messages are associated with
a time stamp showing the actual time when they have been
produced; certain decisions in the system are based on the
"exact" time of the event or event ordering.
• Calculating the duration of activities: if such an activity starts
on one processor and finishes on another (e.g. transmitting a
message), calculating the duration needs clocks to be
synchronized.
2
 It is impossible to guarantee that physical
clocks run at the same frequency
 Lack of global time, can cause problems
 Example: UNIX make
◦ Edit output.c at a client
◦ output.o is at a server (compile at server)
◦ Client machine clock can be lagging behind the
server machine clock
When each machine has its own clock, an event
that occurred after another event may
nevertheless be assigned an earlier time.
• Every computer is equipped with CMOS clock circuit.
These are electronic devices that count oscillations
occurring in a crystal.
• Also called timer, usually a quartz crystal, oscillating at
a well defined frequency.
• Timer is associated with two registers: A Counter and
a Holding Register, counter decreasing one at each
oscillations.
• When counter reaches zero, an interrupt is generated;
this is the clock tick.
• Clock tick have a frequency of 60-100 ticks per
second.
5
• The problems:
1. Crystals cannot be tuned perfectly. Temperature and other
external factors can also influence their frequency.
Clock drift: the computer clock differs from the real time.
2. Two crystals are never identical.
Clock skew: the computer clocks on different processors of
the distributed system show different time.
6
☞ Distributed Algorithms
• There is no particular time server.
• The processors periodically reach an agreement on the
clock value by averaging the time of neighbors clock and
its local clock.
-This can be used if no UTC receiver exists (no external
synchronization is needed). Only internal
synchronization is performed.
- Processes can run on different machines and no global
clock to judge which event happens first.
7
• Cristian’s Algorithm is centralized algorithm.
 The simplest algorithm for setting time, it issues a Remote
Procedure Call to time server and obtain the time.
 A machine sends a request to time server in “d/2” seconds,
where d=max difference between a clock and UTC.
 The time server sends a reply with current UTC when
receives the request.
 The machine measures the time delay between time
server sending the message and machine receiving it.
Then it uses the measure to adjust the clock.
8
 The best estimate of message propagation time= (T0 + T1)/2
 The new time can be set to the time returned by server plus time
that elapsed since server generated the timestamp:
Tnew = Tserver + (T0 + T1)/2
9
• It is also a Centralized algorithm and its Time server is an
Active Machine.
 The server polls each machine periodically, asking it for
the time.
 When all the results are in, the master computes the
average time.
 Instead of sending the updated time back to slaves, which
would introduce further uncertainty due to network delays,
it sends each machine the offset by which its clock needs
adjustment.
 If master machine fails, any other slave could be elected
to take over.
10
a) The time daemon sends synchronization query to other
machines in group.
b) The machines sends timestamps as a response to query.
c) The Server averages the three timestamps and tells everyone
how to adjust their clock by sending offsets.
11
• NTP is an application layer protocol
• Default port number 123
• Uses standard UDP Internet transport protocol
• Adjust system clock as close to UTC as possible
over the Internet.
• Enable sufficiently frequently resynchronizations.
(scaling well on large num
• The NTP service is provided by a network of servers
located across the Internet.
• Primary servers are connected directly to a time
source. (e.g. a radio clock receiving UTC, GPS).
bers of clients and servers)
12
 Secondary servers are synchronized with primary
servers.
 The servers are connected in a logical hierarchy
called a synchronization subnet. Each level of the
synchronization subnet is called stratum.
13
 A requests time of B at its own T1
 B receives request at its T2, records
 B responds at its T3, sending values of T2 and T3
 A receives response at its T4
 Question: what is θ = TB – TA?
Synchronization in
Distributed SystemsCS-4513 D-term 2008
14
A
B
T1
T2 T3
T4
 Question: what is θ = TB – TA?
 Assume transit time is approximately the same both
ways
 Assume that B is the time server that A wants to
synchronize to
Synchronization in
Distributed SystemsCS-4513 D-term 2008
15
A
B
T1
T2 T3
T4
( ) ( )2314 TTTT −−−
 A knows (T4 – T1) from its own clock
 B reports T3 and T2 in response to NTP
request
 A computes total transit time of
Synchronization in
Distributed SystemsCS-4513 D-term 2008
16
A
B
T1
T2 T3
T4
( ) ( )
2
2314 TTTT −−−
( ) ( )
2
2314
3
TTTT
T
−−−
+
 One-way transit time is approximately ½ total,
i.e.,
 B’s clock at T4 reads approximately
Synchronization in
Distributed SystemsCS-4513 D-term 2008
17
A
B
T1
T2 T3
T4
 Servers organized as strata
◦ Stratum 0 server adjusts itself to WWV directly
◦ Stratum 1 adjusts self to Stratum 0 servers
◦ Etc.
 Within a stratum, servers adjust with each other
CS-4513 D-term 2008
Synchronization in Distributed
Systems 18
LogicaL cLocks
19
 Assume no central time source –
 Each system maintains its own local clock .
 No total ordering of events .
 Allow to get global ordering on events.
 Assign sequence numbers to messages –
 All cooperating processes can agree on order
of event.
20
• It is used to provide a partial ordering of events
with minimal overhead.
• It is used to synchronize the logical clock.
• It follows some simple rules:
 A process increments its counter before each event in
that process i.e. Clock must tick once between every two
events.
 When a process sends a message, it includes its
timestamp with the message.
 On receiving a message, the receiver process sets its
counter to be the maximum of the message counter and
increments its own counter .
21
 a ‘Happened Before’ b : a→b
1. If a and b are events in the same process, and a
comes before b, then a → b.
2. If
a :message sent
b : receipt of the same message
then a → b.
1. Transitive: If a → b and b → c then a → c.
2. Two distinct events a and b are said to be concurrent
if a -/->b and b -/->a
22
Figure 6-9. (a) Three processes, each with its own clock.
The clocks run at different rates.
 For two events a and b in same process p1
 C(b)= C(a)+1
 If a is sending process and b is receiving process
of pi and pj then,
 Cj(b)=max((Ci(a)+1),Cj(b))
24
Lamport’s algorithm corrects the clocks.

Contenu connexe

Tendances

Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud Computing
Jithin Parakka
 
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
Nitesh Singh
 
Election algorithms
Election algorithmsElection algorithms
Election algorithms
Ankush Kumar
 

Tendances (20)

Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 
Process Management-Process Migration
Process Management-Process MigrationProcess Management-Process Migration
Process Management-Process Migration
 
Client Centric Consistency Model
Client Centric Consistency ModelClient Centric Consistency Model
Client Centric Consistency Model
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts
 
Remote Procedure Call (RPC) Server creation semantics & call semantics
Remote Procedure Call (RPC) Server creation semantics & call semanticsRemote Procedure Call (RPC) Server creation semantics & call semantics
Remote Procedure Call (RPC) Server creation semantics & call semantics
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud Computing
 
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
 
Election algorithms
Election algorithmsElection algorithms
Election algorithms
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 

En vedette

Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
Sri Prasanna
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)
Sri Prasanna
 
Clock Synchronization
Clock SynchronizationClock Synchronization
Clock Synchronization
innovationwireless
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
karan2190
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
Rupsee
 
Virtualization (Distributed computing)
Virtualization (Distributed computing)Virtualization (Distributed computing)
Virtualization (Distributed computing)
Sri Prasanna
 
04 ota053001 clock synchronization theory issue1.0
04 ota053001 clock synchronization theory issue1.004 ota053001 clock synchronization theory issue1.0
04 ota053001 clock synchronization theory issue1.0
Vũ Trần Huy
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
guest61205606
 
Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availability
Renato Lucindo
 

En vedette (20)

Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed Systems
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
 
6.Distributed Operating Systems
6.Distributed Operating Systems6.Distributed Operating Systems
6.Distributed Operating Systems
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)
 
Clock Synchronization
Clock SynchronizationClock Synchronization
Clock Synchronization
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Clock synchronization using servo-clock
Clock synchronization using servo-clockClock synchronization using servo-clock
Clock synchronization using servo-clock
 
Marketing and concepts of database.
Marketing and concepts of database.Marketing and concepts of database.
Marketing and concepts of database.
 
Distributed information sys
Distributed information sysDistributed information sys
Distributed information sys
 
Virtualization (Distributed computing)
Virtualization (Distributed computing)Virtualization (Distributed computing)
Virtualization (Distributed computing)
 
Autonomous Pervasive Systems and the Policy Challenges of a Small World!
Autonomous Pervasive Systems and the Policy Challenges of a Small World!Autonomous Pervasive Systems and the Policy Challenges of a Small World!
Autonomous Pervasive Systems and the Policy Challenges of a Small World!
 
04 ota053001 clock synchronization theory issue1.0
04 ota053001 clock synchronization theory issue1.004 ota053001 clock synchronization theory issue1.0
04 ota053001 clock synchronization theory issue1.0
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
 
Synchronization Pradeep K Sinha
Synchronization Pradeep K SinhaSynchronization Pradeep K Sinha
Synchronization Pradeep K Sinha
 
Communications is distributed systems
Communications is distributed systemsCommunications is distributed systems
Communications is distributed systems
 
Distributed System
Distributed System Distributed System
Distributed System
 
Pervasive Computing
Pervasive ComputingPervasive Computing
Pervasive Computing
 
Wireless Security
Wireless SecurityWireless Security
Wireless Security
 
Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availability
 

Similaire à Clock synchronization in distributed system

Synchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layerSynchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layer
Vaishnavi
 

Similaire à Clock synchronization in distributed system (20)

Synch
SynchSynch
Synch
 
3. syncro. in distributed system
3. syncro. in distributed system3. syncro. in distributed system
3. syncro. in distributed system
 
Shoaib
ShoaibShoaib
Shoaib
 
Clock.pdf
Clock.pdfClock.pdf
Clock.pdf
 
Shoaib
ShoaibShoaib
Shoaib
 
Unit iii-Synchronization
Unit iii-SynchronizationUnit iii-Synchronization
Unit iii-Synchronization
 
Chapter 6-Synchronozation2.ppt
Chapter 6-Synchronozation2.pptChapter 6-Synchronozation2.ppt
Chapter 6-Synchronozation2.ppt
 
Chap 5
Chap 5Chap 5
Chap 5
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptx
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.ppt
 
Synchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layerSynchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layer
 
Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed Systems
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
Getting date and time from ntp server with esp8266 node mcu
Getting date and time from ntp server with esp8266 node mcuGetting date and time from ntp server with esp8266 node mcu
Getting date and time from ntp server with esp8266 node mcu
 
slides.06.pptx
slides.06.pptxslides.06.pptx
slides.06.pptx
 
Synchronisation
SynchronisationSynchronisation
Synchronisation
 
Distributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithmDistributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithm
 
Ds ppt imp.
Ds ppt imp.Ds ppt imp.
Ds ppt imp.
 
Synchronization
SynchronizationSynchronization
Synchronization
 
CS6601-Unit 4 Distributed Systems
CS6601-Unit 4 Distributed SystemsCS6601-Unit 4 Distributed Systems
CS6601-Unit 4 Distributed Systems
 

Plus de Sunita Sahu (8)

Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
Writing software requirement document
Writing software requirement documentWriting software requirement document
Writing software requirement document
 
Writing software requirement document
Writing software requirement documentWriting software requirement document
Writing software requirement document
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Slowly changing dimension
Slowly changing dimension Slowly changing dimension
Slowly changing dimension
 
Fact less fact Tables & Aggregate Tables
Fact less fact Tables & Aggregate Tables Fact less fact Tables & Aggregate Tables
Fact less fact Tables & Aggregate Tables
 
Dimensional Modeling
Dimensional ModelingDimensional Modeling
Dimensional Modeling
 
Attacks in MANET
Attacks in MANETAttacks in MANET
Attacks in MANET
 

Dernier

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Clock synchronization in distributed system

  • 1. 1
  • 2. NEED?? • Time driven systems: in statically scheduled systems activities are started at "precise" times in different points of the distributed system. • Time stamps: certain events or messages are associated with a time stamp showing the actual time when they have been produced; certain decisions in the system are based on the "exact" time of the event or event ordering. • Calculating the duration of activities: if such an activity starts on one processor and finishes on another (e.g. transmitting a message), calculating the duration needs clocks to be synchronized. 2
  • 3.  It is impossible to guarantee that physical clocks run at the same frequency  Lack of global time, can cause problems  Example: UNIX make ◦ Edit output.c at a client ◦ output.o is at a server (compile at server) ◦ Client machine clock can be lagging behind the server machine clock
  • 4. When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time.
  • 5. • Every computer is equipped with CMOS clock circuit. These are electronic devices that count oscillations occurring in a crystal. • Also called timer, usually a quartz crystal, oscillating at a well defined frequency. • Timer is associated with two registers: A Counter and a Holding Register, counter decreasing one at each oscillations. • When counter reaches zero, an interrupt is generated; this is the clock tick. • Clock tick have a frequency of 60-100 ticks per second. 5
  • 6. • The problems: 1. Crystals cannot be tuned perfectly. Temperature and other external factors can also influence their frequency. Clock drift: the computer clock differs from the real time. 2. Two crystals are never identical. Clock skew: the computer clocks on different processors of the distributed system show different time. 6
  • 7. ☞ Distributed Algorithms • There is no particular time server. • The processors periodically reach an agreement on the clock value by averaging the time of neighbors clock and its local clock. -This can be used if no UTC receiver exists (no external synchronization is needed). Only internal synchronization is performed. - Processes can run on different machines and no global clock to judge which event happens first. 7
  • 8. • Cristian’s Algorithm is centralized algorithm.  The simplest algorithm for setting time, it issues a Remote Procedure Call to time server and obtain the time.  A machine sends a request to time server in “d/2” seconds, where d=max difference between a clock and UTC.  The time server sends a reply with current UTC when receives the request.  The machine measures the time delay between time server sending the message and machine receiving it. Then it uses the measure to adjust the clock. 8
  • 9.  The best estimate of message propagation time= (T0 + T1)/2  The new time can be set to the time returned by server plus time that elapsed since server generated the timestamp: Tnew = Tserver + (T0 + T1)/2 9
  • 10. • It is also a Centralized algorithm and its Time server is an Active Machine.  The server polls each machine periodically, asking it for the time.  When all the results are in, the master computes the average time.  Instead of sending the updated time back to slaves, which would introduce further uncertainty due to network delays, it sends each machine the offset by which its clock needs adjustment.  If master machine fails, any other slave could be elected to take over. 10
  • 11. a) The time daemon sends synchronization query to other machines in group. b) The machines sends timestamps as a response to query. c) The Server averages the three timestamps and tells everyone how to adjust their clock by sending offsets. 11
  • 12. • NTP is an application layer protocol • Default port number 123 • Uses standard UDP Internet transport protocol • Adjust system clock as close to UTC as possible over the Internet. • Enable sufficiently frequently resynchronizations. (scaling well on large num • The NTP service is provided by a network of servers located across the Internet. • Primary servers are connected directly to a time source. (e.g. a radio clock receiving UTC, GPS). bers of clients and servers) 12
  • 13.  Secondary servers are synchronized with primary servers.  The servers are connected in a logical hierarchy called a synchronization subnet. Each level of the synchronization subnet is called stratum. 13
  • 14.  A requests time of B at its own T1  B receives request at its T2, records  B responds at its T3, sending values of T2 and T3  A receives response at its T4  Question: what is θ = TB – TA? Synchronization in Distributed SystemsCS-4513 D-term 2008 14 A B T1 T2 T3 T4
  • 15.  Question: what is θ = TB – TA?  Assume transit time is approximately the same both ways  Assume that B is the time server that A wants to synchronize to Synchronization in Distributed SystemsCS-4513 D-term 2008 15 A B T1 T2 T3 T4
  • 16. ( ) ( )2314 TTTT −−−  A knows (T4 – T1) from its own clock  B reports T3 and T2 in response to NTP request  A computes total transit time of Synchronization in Distributed SystemsCS-4513 D-term 2008 16 A B T1 T2 T3 T4
  • 17. ( ) ( ) 2 2314 TTTT −−− ( ) ( ) 2 2314 3 TTTT T −−− +  One-way transit time is approximately ½ total, i.e.,  B’s clock at T4 reads approximately Synchronization in Distributed SystemsCS-4513 D-term 2008 17 A B T1 T2 T3 T4
  • 18.  Servers organized as strata ◦ Stratum 0 server adjusts itself to WWV directly ◦ Stratum 1 adjusts self to Stratum 0 servers ◦ Etc.  Within a stratum, servers adjust with each other CS-4513 D-term 2008 Synchronization in Distributed Systems 18
  • 20.  Assume no central time source –  Each system maintains its own local clock .  No total ordering of events .  Allow to get global ordering on events.  Assign sequence numbers to messages –  All cooperating processes can agree on order of event. 20
  • 21. • It is used to provide a partial ordering of events with minimal overhead. • It is used to synchronize the logical clock. • It follows some simple rules:  A process increments its counter before each event in that process i.e. Clock must tick once between every two events.  When a process sends a message, it includes its timestamp with the message.  On receiving a message, the receiver process sets its counter to be the maximum of the message counter and increments its own counter . 21
  • 22.  a ‘Happened Before’ b : a→b 1. If a and b are events in the same process, and a comes before b, then a → b. 2. If a :message sent b : receipt of the same message then a → b. 1. Transitive: If a → b and b → c then a → c. 2. Two distinct events a and b are said to be concurrent if a -/->b and b -/->a 22
  • 23. Figure 6-9. (a) Three processes, each with its own clock. The clocks run at different rates.
  • 24.  For two events a and b in same process p1  C(b)= C(a)+1  If a is sending process and b is receiving process of pi and pj then,  Cj(b)=max((Ci(a)+1),Cj(b)) 24