Unit 1
Unit 1
1
What are the trends in Distributed systems.
Distributed systems are undergoing a period of significant change
and this can be traced back to a number of influential trends:
the emergence of pervasive networking technology;
the emergence of ubiquitous computing coupled with the desire to
support
user mobility in distributed systems;
the increasing demand for multimedia services;
the view of distributed systems as a utility.
Pervasive networking and the modern Internet
Logical Time
3.2.1 Definition
A system of logical clocks consists of a time domain T and a logical
clock C.
Elements of T form a partially ordered set over a relation < called as
happened before or causal precedence.
The logical clock C is a function that maps an event e to the time
domain T, denoted as C(e) and called the timestamp of e, and is
defined as follows:
C: H T
such that the following monotonicity property is satisfied then it is
callled the clockconsistency condition.
for two events ei and ej, ei→ ej⇒ C(ei) < C(ej).
When T and C satisfy the following condition, the system of clocks
is said to bestrongly consistent.
for two events ei and ej , ei→ej ⇔ C(ei) < C(ej ),
3.2.2 Implementing logical clocks
Implementation of logical clocks requires addressing two issues:
data structures local to every process to represent logical time and
a protocol to update the data structures to ensure the consistency
condition.
Each process pi maintains data structures with the following two
capabilities:
o A local logical clock, lci, that helps process pi to measure its
own progress.
o A logical global clock, gci, represents the process pi’s local
view of logical global time. It allows this process to assign consistent
timestamps to its local events.
The protocol ensures that a process’s logical clock, and thus its
view of global time, is managed consistently.
The protocol consists of the following two rules:
o R1 This rule governs how the local logical clock is updated by
a process when it executes an event (send, receive, or internal).
o R2 This rule governs how a process updates its global logical
clock to update its view of the global time and global progress. It
dictates what information about the logical time is piggybacked in a
message and how it is used by the process to update its view of
global time.
3.3 Scalar time
3.3.1 Definition
The scalar time representation was proposed by Lamport to totally
order events in a distributed system. Time domain is represented as
the set of non-negative integers.
The logical local clock of a process pi and its local view of global
time are squashed into one integer variable Ci.
Rules R1 and R2 used to update the clocks is as follows:
R1 : Before executing an event (send, receive, or internal), process pi
executes:
Ci := Ci + d (d > 0)
d can have a different value, may be application-
dependent. Here d is kept at 1.
R2 : Each message piggybacks the clock value of its sender
at sending time. When a
process pi receives a message with timestamp Cmsg, it
executes the following actions:
1. Ci := max(Ci, Cmsg);
2. execute R1;
3. deliver the message.
Figure 3.1 shows the evolution of scalar time with d=1.
Total Ordering
Scalar clocks can be used to totally order events in a distributed
system.
Problem in totally ordering events: Two or more events at different
processes may have an identical timestamp. i.e., for two events e1
and e2, C(e1) = C(e2) ⇒ e1|| e2.
In Figure 3.1, 3rd event of process P1 and 2nd event of process P2
have same scalar timestamp. Thus, a tie-breaking mechanism is
needed to order such events.
A tie among events with identical scalar timestamp is broken on the
basis of their process identifiers. The lower the process identifier
then it is higher in priority.
The timestamp of an event is a tuple (t, i) where t - time of
occurrence and i – identity of the process where it occurred. The
total order relation ≺ on two events x and y with
timestamps (h,i) and (k,j) is:
x ≺ y⇔ (h < k or (h = k and i < j))
Event counting
If the increment value of d is 1 then, if the event e has a timestamp
h, then h- 1 represents minimum number of events that happened
before producing the event e;
In the figure 3.1,five events precede event b on the longest causal
path ending at b.
No strong consistency
The system of scalar clocks is not strongly consistent; that is, for
two events ei and ej,
C(ei) < C(ej) ≠> ei→ej .
In Figure 3.1, the 3rd event of process P1 has smaller scalar
timestamp than 3rd event of process P2.
3.4 Vector time
Definition
The system of vector clocks was developed Fidge, Mattern, and
Schmuck.
Here, the time domain is represented by a set of n-dimensional
non-negative integer vectors.
Each process pi maintains a vector vti[1..n], where vti[i] is the local
logical clock of pi that specifies the progress at process.
vti[j] represents process pi’s latest knowledge of process pj local
time.
If vti[j] = x, then process pi knowledge on process pj till progressed
x.
The entire vector vti constitutes pi’s view of global logical time and
is used to timestamp events.
Process pi uses the following two rules R1 and R2 to update its
clock:
R1:
Before executing an event, process pi updates its local logical time
as follows:
vti[i] = vti[i] + d (d>0)
R2:
Each message m is piggybacked with the vector clock vt of the
sender process at sending time.
On receipt of message (m,vt), process pi executes:
1. update its global logical time as follows:
1 ≤ k ≤n : vti[k] := max(vti[k], vt[k])
2. execute R1;
3. deliver the message m.
The timestamp associated with an event is the value of vector clock
of its process when the event is executed.
The vector clocks progress with the increment value d = 1. Initially,
it is [0, 0, 0, .. , 0].
The following relations are defined to compare two vector
timestamps, vh and vk:
vh = vk ⇔∀x : vh[x] = vk[x]
vh ≤ vk ⇔∀x : vh[x] ≤ vk[x]
vh < vk ⇔vh ≤ vk and ∃ x : vh[x] < vk[x]
4
Synchronous versus asynchronous executions
An asynchronous execution is an execution in which
(i) there is no processor synchrony and there is no bound on the drift
rate of processor clocks,
(ii) message delays (transmission + propagation times) are finite but
unbounded, and
(iii) there is no upper bound on the time taken by a process to
execute a step.
Each NTP message includes the latest three timestamps T1, T2, and
T3, while T4 is determined upon arrival.
Figure :The Behaviour of fast, slow and perfect clocks with respect
to UTC.
The network time protocol (NTP) synchronization p