Anda di halaman 1dari 5

Time

Abstract— Time is an important practical The notion of physical time is also problematic in
issue. For example, we require computers around a distributed system. This is not due to the effects of
the world to timestamp electronic commerce special relatively, which are negligible or nonexistent
transactions consistently. Time is also an for normal computers. Rather, the problem is based
important theoretical construct in understanding on a similar limitation in our ability to timestamp
how distributed executions unfold. But time events at different nodes sufficiently accurately to
problematic in distributed systems. Each know the order in which any pair of events occurred,
computer may have its own physical clock, but the or whether they occurred simultaneously.
clocks typically deviate, and we cannot II. CLOCKS, EVENTS AND PROCESS STATES
synchronize them perfectly. We explain logical A distributed system consists of a collection of N
clocks, including vector clocks, which are a tool processes pį, i = 1, 2 …N, where si is the state of pi.
for ordering events without knowing precisely For example are variables. The actions of pi is an
when they occurred. operations that transform pi‘s state and it send or
receive message between pi. Then, e is an event that
I. INTRODUCTION
occurrence of a single action. The relation between
Time is an important and interesting issue in the events (i) such as e  ie’: e is occurs before e’
distributed systems, for several reasons. First, time is at pi. The history (pi) = hi = <ei0, ei2 …> It is series
a quantity we often want to measure accurately. In of events e in process pi.
order to know at what time of day a particular event
occurred at a particular computer it is necessary to The clock in a computer is an electronic device
synchronize its clock with an authoritative, external that counts oscillations that occurring in a crystal at a
source of time. It is important for auditing purposes definite frequency. The Hardware time: Hi (t) is the
that those events are timestamped accurately. counts of oscillation since an original point. Whereas,
the Software time: Ci (t) = ăHi (t) + ß
Second, algorithms that depend upon clock
synchronization have been developed for several
problems in distribution data, checking the
authenticity of a request sent to a server (depends on
loosely synchronized clocks) and eliminating the
processing of duplicate updates.
Measuring time can be problematic due to the
existence of multiple frames of reference. The Fig. 1. The Network
relative order of two events can even be reserved for
The clock drift is a clocks count time at different
two different observers. But this cannot happen if one
rates, while the clock skew is the instantaneous
event causes the other to occur. In that case, the
different between the readings of any two clocks. The
physical effect follows the physical cause for all
calculate clock skew for Host A and Host B has
observers, although the time elapsed between caused
shown in figure below:
and effect can vary. The timing of physical events
was thus proved to be relative to the observer. There
is no special physical clock in the universe to which
we can appeal when we want to measure intervals of
time.

1
 Receiver’s clock = t + (min + max) / 2

There are there types of synchronizing the physical


clocks such as the following below:

A. Cristian’s method
 For asynchronous communication
Fig. 2. Calculation the Clock Skew  Use time server
 Protocol
 mr – request the time
 Clock Skew for host A: 10:41:38 – 10-41:56  mt (t) – receive the time an inserted
= - seconds in the message
 Clock Skew for host B: 10:42:56 – 10-41:56  T round – round-trip, send request
=- 60 seconds and get reply
 Estimated time: t in mt + T round /
The Coordinated Universal Time (UTC) is an
2
international standard for time keeping. UTC signal
are sync and broadcast regularly from radio station
and satellites covering many parts of the world. The,
the time standard used for many internet and World
Wide Web standards. The Network Time Protocol
was designed to synchronize the clocks of computers
over the internet and encodes times using the UTC P Time
system. server, S
III. SYNCHRONOUS PHYSICAL CLOCKS Fig. 3. The Protocol of Cristia’s method
There are two types of synchronization, which are
internal and external synchronization. The notations  Accuracy analysis
are a Ci: pi’s clock and I is an internal of real time.  If the minimum delay of a message
The external synchronization is for a synchronization transmission is min, then accuracy: +
bound D > 0, and for a source S of UTC time, |S(t) – (T round / 2 – min)
Ci(t)| < D, for i = 1,2 …N and for all real times t in I.
The clocks Ci are accurate to within the bound D.
Besides, the internal synchronization is a for
synchronization bound D > 0, |Ci (t) – Cj (t)| < D for
i, j = 1, 2 …N, for all real times t in I. While, the
clocks Ci agree within the bound D. The clocks that
are internally synchronized are not necessarily
externally synchronized. If the system p is externally
synchronized with a bound D, then the same system
is internally synchronized with a bound of 2D.
The synchronization in a synchronous system is a
protocol that: Fig. 4. Cristian’s method of synchronous clocks
 Sender: send M (t)
 Receiver: set time to t + T trans B. The Berkeley Algorithm
The bounds are known in synchronous system is:
 Min <T trans < max (constant) The international using a coordinator computer
The optimum transmission time is: (master). Other computers that their clocks need to
 T trans = (min +max) / 2 be synchronized are known as slaves.

2
1. The master polls the slaves clocks -Enable clients to resynchronize sufficiently
2. The master estimates the slaves’ clocks by frequently to offset the rates of drift found
round-trip time in most computers
3. The master averages the slaves’ clock o Security
values - Protect against interference with the time
4. The master sends back to the slaves the service. The time service uses
amount that the slaves’ clocks should adjust authentication techniques to check whether
5. Slave adjusts its clock. timing data originate from trsuted sources.

The NTP service is provided by servers located


across the internet that primary servers are connected
directly to an time source. For example radio clock
receiving UTC. While, the secondary servers are
synchronized to primary servers.

Fig. 6. Network Time Protocol (NTP)


The modes of NTP synchronizaion is divide into
three type such as:
a) Multicast mode (servers send the time)
 Intended for use on a high speed LAN
Fig. 5. Berkeley Algorithm  One or more servers multicast the time to
C. The Network Time Protocol (NTP) other servers in the LAN
 Low accuracy but suffiecient
The Network Time Protocol (NTP) is an b) Procedure-call mode
architecture for a time service and a protocol to  Similar to Cristian’s
distribute time information over the internet. There  Higher accuracy than multicast
are several aims for NTP such as below: c) Symmetric mode (between high and lower
level server)
o External synchronnization  Use by the servers that supply time
- Enable clients across the internet to be information in LAN’s and by the higher
synchronized accurately to UTC levels of the synchronization subnet
o Reliability
 The highest accuracy
- Can survive length looses of connectivity
>> redundant server & redundant path IV. LOGOCAL TIME & LOGICAL CLOCKS
between servers The logical time and logical clocks is an events in
o Scalability single process is ordered uniquely by times shown in
the local clock. The clock is unable to be

3
synchronized perfectly across distributed system. The happened before can be captured by
Hence, we cannot use physical time to find out the number, called logical clock.
order of any arbitrary pairs of events occurring within It is software counter whose value has no
it. But, we can use a scheme that is similar to physical particular relation to any physical clocks.
causality to order some events that occur at different
processes. Each process keeps its own logical clock Li
which it uses to apply Lamport timestamps to
There also have three types for logical time and events.
logical clocks which are:
To capture happened before relation, processes
i.Happened-Before Relation update their logical clocks and transmit the
It is also sometimes known as the relation of values of their clocks in messages as follow:
causal ordering or potential causal ordering.  LC1: Logical clock (L) is incremented
The simple points are:
before each event is issued at process pi: Li =
 If two events occurred at the same Li +1
process, then they occurred in the order
in which P observe them  LC2: (a) When a process pi, sends a
 Whenever a message is sent between message m,
processes, the event of sending the it adjoin the value t = Li on m
message occurred before the event of (b) on receiving (m, t), a process Pj
receiving the message computes L: max (Lj, t) and
then
By generalizing the two relationships, we can applies LC1 before
define the Happened-before relation (): timestamping the
event receive (m).
HB1: If Ǝ process pi: e’, then e  e’
HB2: For any message m, send (m) 
receive (m)
- where send (m) is the event of
sending the message, and receive (m)
is the event of receiving it.
HB3: If e, e’ and e” are events such that e 
e’ and e’  e”, then e  e”.

Fig. 8. Lamport Timestamps


Algorithm
iii.Vector Clocks Algorithm
It’s totally ordered logical clocks algorithm.
We define total order on the set of events; all
pairs of distinct event are ordered, by taking
Fig. 7. Happened-Before Relation into account the identifier of the process at
which events occur.
a-/-> and e-/->a, since they occurred at the The assumption:
different process and there is no chain of Ti: local timestamp of e that is an
message exchange them. We say events a and event occuring t pi.
e are not ordered by , they are concurrent
and write a||e. Tj: local timestamp of e’ that is an
event occuring at pj.
ii. Lamport Timestamps Algorithm

4
The timestamps of two events e and e’ are V. SUMMARY
(Ti, i), (Tj, j) when (Ti, i) < (Tj, j) if and For summarize, this chapter began by describing
only if Ti < Tj, or Ti = Tj and i < j. the importance of accurate timekeeping for
distributed systems. It then described algorithms for
The Vector Clocks algorithm consists of synchronizing clocks despite the drift between them
each process pi, keeps a vector clock Vi; and the variability of message delays between
computers.
The degree of synchronization accuracy that is
VC1: Initially, Vi[j] = 0, for i,j = 1,2… N practically obtainable fulfills many requirements but
VC2: Just before pi, timestamps an event, is nonetheless not sufficient to determine the
it sets Vi[i]: = Vi[i] + 1 ordering of an arbitrary pair of events occurring at
different computers. The happened-before relation is
VC3: pi includes the value t=Vi in every
a partial order on events that reflects a flow of
message it sends
information between them within a process.
VC4: When pi receives a timestamps t in a Other that, some algorithms requires events to be
message it sets Vi[j]: = max (Vi[j], ordered in happened-before order, for example,
t[j]), for j = 1,2…N successive updates made to separate copies of data.
Lamport clocks are counters that are updates in
accordance with the happened-before relationships
between events. While, Vector clocks are an
improvement on Lamport clocks, in that it is possible
to determine by examining their vector timestamps
whether two events are ordered by happened-before
or are concurrent.

Fig. 9. Vector Clock Algorithm

Anda mungkin juga menyukai