0% found this document useful (0 votes)
3 views11 pages

Chapter 6

Chapter 6 discusses clock synchronization in distributed systems, emphasizing its importance for event ordering, accurate time stamping, and coordinated activities. It outlines two main approaches: external clock synchronization, which is highly accurate but complex, and internal clock synchronization, which is less accurate but simpler. Additionally, the chapter introduces logical clocks, including Lamport timestamps and vector clocks, as mechanisms to capture event ordering in systems without a global clock.

Uploaded by

GETACHEW AZMIR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

Chapter 6

Chapter 6 discusses clock synchronization in distributed systems, emphasizing its importance for event ordering, accurate time stamping, and coordinated activities. It outlines two main approaches: external clock synchronization, which is highly accurate but complex, and internal clock synchronization, which is less accurate but simpler. Additionally, the chapter introduces logical clocks, including Lamport timestamps and vector clocks, as mechanisms to capture event ordering in systems without a global clock.

Uploaded by

GETACHEW AZMIR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 6

Time and Clocks


Introduction
Clock synchronization is the process of ensuring that the clocks of all the
computers in a distributed system are as close to synchronized as possible.

This is important for a variety of reasons, including:

To ensure that events happen in the correct order. If the clocks of two
computers are not synchronized, then it is possible for an event to happen on one
computer before it happens on the other computer.

This can lead to problems, such as data corruption or incorrect results.


Introduction
To allow for correct time stamping of data. Time stamping is the process of
assigning a timestamp to a piece of data.

This timestamp indicates when the data was created or modified. If the clocks of
the computers are not synchronized, then the timestamps of the data may not be
accurate. This can make it difficult to track changes to data or to troubleshoot
problems.
Introduction
To allow for coordinated activities. In some distributed systems, it is necessary
for the computers to coordinate their activities.

For example, if a distributed system is used to control a robotic arm, then the
computers need to be synchronized so that they can all send commands to the
arm at the same time.
Approaches to Clock Synchronization

There are two main approaches to clock synchronization in distributed systems:

● External clock synchronization


● Internal clock synchronization
External clock synchronization

External clock synchronization uses an external time source, such as an atomic


clock, to synchronize the clocks of the computers.

This is the most accurate method of clock synchronization, but it can be


expensive and complex to implement.
Internal clock synchronization

● Internal clock synchronization uses the clocks of the computers


themselves to synchronize with each other.
● This is less accurate than external clock synchronization, but it is also
less expensive and complex to implement.
● The best approach to clock synchronization for a particular distributed
system will depend on the specific requirements of the system.
Here are some examples of clock synchronization:
● In a financial trading system, it is important for the clocks of all the computers
to be synchronized so that trades can be executed in the correct order.
● In a distributed sensor network, it is important for the clocks of the sensors to
be synchronized so that the data from the sensors can be accurately
combined.
● In a distributed video conferencing system, it is important for the clocks of the
computers to be synchronized so that the video streams from the different
computers are in sync.
● Clock synchronization is an important part of the design and implementation
of distributed systems. By ensuring that the clocks of the computers are
synchronized, it is possible to avoid problems such as data corruption,
incorrect results, and incorrect time stamping.
Logical Clocks
A logical clock is a mechanism for capturing chronological and causal relationships
in a distributed system.

Often, distributed systems may have no physically synchronous global clock.

In these systems, logical clocks are used to provide a consistent ordering of


events across all processes.
Logical Clocks
There are two main types of logical clocks:

● Lamport timestamps:
○ Lamport timestamps are a simple but effective way to create a logical clock.
○ Each process maintains a counter, and each event is assigned a timestamp
that is the value of the counter at the time the event occurred.
○ If a process receives an event with a timestamp that is greater than its own
timestamp, then it knows that the event happened before the event that it is
currently processing.
Logical Clocks
● Vector clocks:
○ Vector clocks are a more complex but more accurate way to create a logical
clock.
○ Each process maintains a vector of timestamps, one for each other process
in the system.
○ When an event occurs, the process increments its own timestamp and the
timestamps of all the processes that it has communicated with since the last
event.
○ This allows the system to track the causal relationships between events
across all processes.

You might also like