Time Synchronization in Distributed Systems: Clocks, Algorithms, and Logical Clocks, Study notes of Electrical and Electronics Engineering

The importance of synchronizing clocks in distributed systems, sources of time, and various algorithms for internal and external synchronization. It covers concepts such as skew, synchronization interval, real time, and logical clocks. Algorithms like the berkeley algorithm, cristian's method, and ntp are explained.

Typology: Study notes

Pre 2010

Uploaded on 02/24/2010

koofers-user-6zt
koofers-user-6zt 🇺🇸

10 documents

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture2
time,clocks,andsynchronization
distributedsystems
CS425/ECE428/CSE424
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Time Synchronization in Distributed Systems: Clocks, Algorithms, and Logical Clocks and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Lecture

time,

clocks,

and

synchronization

distributed

systems

CS

/^ ECE

/^ CSE

acknowledgment

These^ slides

are^ based

on^ ideas

and^ material

from^ the

following

sources:

-^ slides

prepared

by^ Professors

M.^ T.^ Harandi and

J.^ Hou and

subsequently

modified

by^ Professors

Indranil Gupta,

Nitin Vaidya,

and^ Yih

‐Chun^

Hu at

University

of^ Illinois

-^ slides

from^ Professor

S.^ Ghosh’s course

at^ University

of^ Iowa

plan

for

today

• sources

of^ time

• how

to^ synchronize

clocks?

• can

we^

define

sequence

of^ events

without

using

physical

clocks

time

sources

-^ primary

standard

=^ rotation

of^ the

earth

-^ not^ a

stable

-^ de^ facto^ primary

standard

=^ International

Atomic

Time^

(TAI)

-^1 atomic

second

=^ 9,192,631,

orbital

transitions

(^133) of Cs

-^86400

atomic

seconds

=^1 solar

day^ – 3ms

-^ Coordinated

Universal

Time^

(UTC)

=^ international

standard

-^ derived

from^ TAI

by^ adding

leap^ seconds

to^ keep

it^ close

to^ solar

time

-^ UTC

source

signals

are^ synchronized

-^ UTC

time^ is

re‐transmitted

by^ GPS

satellites

(0.1‐^10

mS)

ρ^ for

some

real

oscillators

PPM^

stability

over

oscillator

0 ‐^70 °

C^

years

NCXO

5 ‐^100

1 ‐^10

TCXO

0.1‐^5

0.1‐^2

OCXO

‐^1

0.02‐^2

MCXO

‐^2

0.02‐^2

Source:^ http://www.isotemp.com/

‐010.html

terminology

-^ a^ distributed

system

consists

of^ N^ processes

p^ ,^ p^ ,^1

…,^ p^ N

-^ process

p^ ,^ i^ œ i^
{1,…,^
N}

-^ state:

values

of^ local

variables

including

time

-^ c^ (t):^ i^ the^ reading

of^ the^ software

clock^ at

process

i^ when^

the^ real^

time^ is^ t

.

-^ actions:

send,^ receive,

compute

-^ occurrence

of^ an^

action^

is^ called

an^ event t^1

t^2

m^

m’

send(m)

send(m’) recv(m)

recv(m’)

p^2 p^1

comp

real^ time

ƒ^ uses

an^ elected

leader^

process

to^ ensure

that^ maximum

skew^

is^ δ

ƒ^ leader

broadcasts

to^ all^ machines

for^ their

time

ƒ^ adjusts

times^

received

for^ transmission

delay &^ latency

ƒ^ averages

times^

after^ removing

outliers

ƒ^ tells

each^ machine

how^ to

adjust.

ƒ^ in^ some

systems

multiple

time^ servers

are^ used

ƒ^ avg.

time^ is

more^

accurate,

but^ still

drifts

ƒ^ failure

of^ the

leader

requires

some^

time^ for

re‐election,

so^ accuracy

cannot internal^ be^ guaranteed

synchronization:

Berkeley

algorithm

mr mt

pi^

Time server,S

external

synchronization:

Cristian’s

method

  • suppose

we^ know

the^ minimum

client

‐server

one‐ way^

transmission

delay:

min

  • then,

the^ actual

time^

could

be^ between

[T+min,

T+RTT— min] • accuracy

RTT/

‐^ min

external

synchronization:

Cristian’s method

t^1

t^2

Server^ Client

mr^

T m(T)t

secondary servers,synched by theprimary server

Primary server, direct synch.

Strata 3,synched by thesecondaryservers

ƒ^ uses

a^ network

of^ time

servers

to^ synchronize

all^ processes

on^ a

network. ƒ time^ servers

are^ connected

by^ a^ synchronization

subnet

tree

ƒ^ the^

root^ is

adjusted

directly

ƒ^ each

node^ synchronizes

its^ children

nodes. 1 2

2

2

3

3

3

3

3

3

Network

Time

Protocol

(NTP)

T^ i-1 Ti T^ i-2 Ti- 3 Server B Server A

m^

m'

Time Time

-^ o :^ true

skew^ of

clock^ at

B^ relative

to

that^ at^

A^ =^ c– cA^

B

-^ t^ and

t’:^ actual

transmission

times

for^ m^ and

m’

-^ o :^ estimated i

skew

-^ d^ =^ t^ i^

+^ t’^ :^ estimate

of^ accuracy

of^ oi

Theoretical

Base

for

NTP

T=^ Ti‐^2

+^ t^ +^ i‐ 3 o T=^ Ti^ i‐^1

+^ t’^ – o addingt^ +^ t’^ =^ T

^ Ti‐ 2 i‐^3 +^ T‐^ T i^ i‐^1

subtractingo^ =^ ½^ [T

^ Ti‐ 2 i‐^3 ^ T+^ T i^

]^ +^ ½i‐ 1 [t’^ – t]

let^ o=^ ½i^

[T‐^ i‐^2

T‐^ T^ i‐^3 i^

+^ T]i‐^1

|o^ – o|i^

§^ ½^ |t’

- t|^ §^

½^ [t’^ +^ t]^ =^ ½^ d

i

summary

• several

algorithms

for^

internal

and

external

clock

synchronization

• accuracy

depends

on^ uncertainty

in

message

delays

• we

have

not

discussed

failures

– there

are^ algorithms

for^ synchronization

with

a^ fraction

of^ failed

clocks

[e.g.,

Lamport,

Melliar

‐Smith

algorithm]

ƒ^ is

it^ always

necessary

to^ give

absolute

time

to^ events?

ƒ^ suppose

we^

can^

assign

relative

time

to

events,

in^ a

way

that

does

not

violate

their

causality

logical

clocks

happens

‐before

relation

on

events

ƒ^ define

a^ relation

→^ on

the^ events as

follows

ƒ^ on^

the^ same

process:

a^ →^ b ,^

iff^ time(a)

<^ time(b)

ƒ^ if^ p

sends 1 m^ to^ p

:^ send(m) 2

→^ receive(m)

ƒ^ (transitivity)

if^ a^ →

b^ and^

b^ →^ c^ then
a^ →^ c

ƒ^ →^

is^ called

the^ Happens

‐Before

relation

ƒ^ events

a^ and b^ are^ concurrent if

not^ (a

→^ b^

or^ b^ →

a)

t^1

t^2

m^

m’

send(m)

send(m’) recv(m)

recv(m’)

p^2 p^1

comp

real^ time