Professional Documents
Culture Documents
Introduction To Synchronization
Introduction To Synchronization
Clock Synchronization
In a centralized system time is unambiguous.
In a distributed system agreement on time is not obvious.
When each machine has its own clock, an event that occurred after another event
may be assigned an earlier time.
Clock Synchronization Algorithms
If 1 dC/dt < 1 + maximum drift rate
Resynchronization interval maximum time difference
The relation between clock time and UTC when clocks tick at different rates.
Cristian's Algorithm
synchronization with a time server
Time must never run backward gradual changes
Non zero message propagation time
The Berkeley Algorithm
synchronization without time server
Logical clocks
Lamport Timestamps
If a b C(a) < C(b)
If a sen., b rec. C(a) < C(b)
C(a) C(b)
Vector timestamps
Global State
it is the local state of each process, together with the messages currently in transit
b) Process Q receives a marker for the first time and records its local state
c) Q records all incoming message
d) Q receives a marker for its incoming channel and finishes recording the
state of the incoming channel
A process has finished its part of the algorithm when it has received a
marker along each of its incoming channels, and processed each one.
a) Two processes (0,2) want to enter the same critical region at the same moment.
b) Process 0 has the lowest timestamp, so it wins.
c) When process 0 is done, it sends an OK also, so 2 can now enter the critical
region.
This algorithm is worse than the centralized one, but possible
A Toke Ring Algorithm
start
Crash of any
Distributed 2(n1) 2(n1)
process
Lost token,
Token ring 1 to 0 to n 1
process crash
Primitive Description
a) A transaction
b) d) The log before each statement is executed
In distributed systems each machine keeps its own log of changes to its
local file system
Concurrency Control
allows several transaction to be executed simultaneously leaving data in a
consistent way