SYSTEMS
98 ADVANCED CONCEPTS IN OPERATING
5.2.1 Absence of a Global Clock In
system, there exists no systemwide common clock (global clock),this
In a distributed global time does not exist. A
reader might think that
the notion of
other words,
either having a clock common to all the computers
problem can be easily solved by
system or having synchronized clocks, one at each computer. Unfor
(processes) in the reasons.
solve the problem for the following
tunately. these two approaches cannot available for all the processes in the system.
Suppose a global (common) clock is instants
two different processes can observe a global clock value at different
In this case, delays. Therefore, two different processes
due to unpredictable message transmission
physical time to be a single instant in
may falsely perceive two different instants in
physical time. in the system with a physical clock
On the other hand, if we provide each computer drift from the physical time and
and try to synchronize them, these physical due clocks can
the drift rate may vary from clock clock to technological limitations, Therefore,
at different computers that
this approach can also have two different processes arunning single instant. Hence, we cannot
perceive two different instants in physical time as
have a system of perfectly synchronized clocks.
ordering
IMPACT OF THE ABSENCE OF GLOBAL TIME. The concept of temporal
to the design and devel
of events pervades our thinking about systems and is integral is responsible
opment of distributed systems [12]. For example, an operatingis system
temporal order in
for scheduling processes. A basic criterion used in scheduling the event). Due
which requests to execute processes arrive (the arrival of a request is an of events in
the absence of global time, it is difficult to reason about the temporal order
to de
a distributed system. Hence, algorithms for a distributed system are more difficultabsence
sign and debug compared to algorithms for centralized systems. In addition, the
of a global clock makes it harder to collect up-to-date information on the state of the en
tire system. The detailed description and analysis of this shortcoming is discussed next.
5.2.2 Absence of Shared Memory
Since the computers in a distributed system do not share common memory, an up-to
date state of the entire system is not available to any individual process. Up-to-date
state of the system is neceSsary for reasoning about the system's behavior, debugging,
recovering from failures (see Chap. 12), etc.
A process in a distributed system can obtain a coherent but partial view of the
system or a complete but incoherent view of the system [13). Aview is said to be
coherent if all the observations of different processes (computers) are made at the same
physical time. A complete view encompasses the local views (local state) at all the
computers and any messages that are in transit in the distributed system. Acomplete
view is also referred to as a global state. Similarly, the global state of a distributed
computation encompasses the local states of all the processes and any messages that
are in transit between the processes. Because of the absence of a global clock in a
distributed system, obtaining a coherent global state of the system is difficult.
The following simple situation illustrates the dificulty in obtaining a coherent
global state while underlining the need for a coherent global state.
THEORETICAL FOUNDATIONS 99
Example 5.1. Let Sl and S2 be two distinct sites (entities) of a distributed
(see Fig. 5.1) that maintain bank accounts A and B, respectively. A site in our system
refers to a process. Knowledge of the global staie of the system may be
example
necessary to
compute the net balance of both accounts. The initial state of the two accounts is shown
in Fig. 5.1(a). Let site ST transter, say, $50 from account A to account B. During
the collection of a global state, if site SI records the state of A immediately after the
debit has occurred, and site S2 saves the state of B before the fund transfer message
has reached B, then the global system state will show $50 missing (see Fig. 5.1(b).
Note that the communication channel cannot record its state by itself. Hence, sites
have to coordinate their state recording activities in order to record the channel state.
On the other hand, if A's state is recorded immediately before the transfer and B's
state is recorded after account B has been credited $50, then the global system state
will show an extra $50 (see Fig. 5.1(c)).
We next present two schemes that implement an abstract notion of virtual time
to order events in a distributed system. In addition, readers will find the application of
these schemes throughout the book (see Secs. 6.5 and 6.6, Chap. 7, Secs. 12.10, 13.11,
and 20.4). We also describe an application that makes use of one of the schemes.
Local state Local state
of A of B
Communication
$500 $200
(a) Channel
S1:A S2:B
(b) $450
(E)a $200
) Sl:A
S2:B
$250
(c) $500
S2:B FIGURE 5.1
Sl:A Adistributed system with two sites.
GLOBAL STATE: 1
CI:EMPTY
$500 $200
C2:EMPTY
Sl:A S2:B
SGLOBAL STATE: 2
C1:TRANSFER $50
$450 $200
C2:EMPTY
S1:A S2:B
GLOBAL STATE: 3
CI:EMPTY
$450 $250
C2.EMPTY
ÍGURE 5.7
Sl:A S2:B Global-states and their transitions the
bank accounts example.
Ab sence o- a Gil okal clsck
Comnsn clack Cgb bal cloc k)
ob serve a global clock al at
Diff. passes
different instanfs
sical time
physical clocks can ditt from thecockphyto clock
rate may varg fom
Absenca of shard Menoy
is not
upto- date state ofeira
v
availasle to any indi vidual pncss.
V aherentMies | - easg to cbtain
Pastial vieo
Coherent
- Dificult to oktaiy
glo bal stat
Ccomplete vie)
|Giloba state Cconsstont) challergis
Cohe rent slabal state is oa
Recorig
task due to the absence of a glaba/ clock
and Sha red memrd
5.7
(Pig
Incon sisdeny
mess age was Sont
A's st ate recordlad bafore
CI's oftor
Cosistoneg affer messaz wwas sant
CAsstate recordecd
C's Ye Cared
Cwas
B'S before
rB's after
Ms1. as Yecaived
CI'S Stat yecoded after at B
(channel is empty)
A's state yacorded otter mag
Sent.
Local State
For a sit lcompute) Si, local state at a
given ime Jo cal Context Gf tha distibuted
oppi atin.
LS; locat state of S; at any tima.
Nototsn
v Send (mi) Serdl event of massage miy frm
proess i Ci) to pn cessj C)
(or Site ) (sitej)
V ree (mj) : Yecaive event of mi by 1; ( j
State
time (x) : ime atwhich enat x awar recsrded
tina(Send (m)): Time at wich event send (om)
OCcuiyed
wSnd (mij) e LS, iff tim (erd imi)) <fimesi)
ime at which msg time
mj Sent from Si atich
Lsof Si /A
ie., in tris local stale, Si TeCsrdad
w! knoS that Msg. mij Os set
mij was Tecajved before it
ie, S; /P koows
was JeCorded
Stafe
(messs in transit
tansit ((LS;, Ls)
LS; Arclmij) Lsi
mij | Sond (mij)é
were Sent before
of messageS ohlch not yet reai Ved
Set TecoYded but
State of S; co0s
when stat of )
Inon sistent (LSi,LSi)
cohich send event was not
Set of messages fr Yecordad odin LS;
cNas rerded
but the YaCaive erent
in LS
6ilobal State
States
ollecti n of local n: no of siteo
LSf
GS ={LS, , LS,, - in tha syoem
tert
6S is Consis
1<ij <n:: inmsisknt(LS,, Ls)=
ti, tj :
incsnsistat me Sages between
/-e) thare coontd be no
erarg pair of Sites /pases.
Transi tes global state
G S is tsunsitless fft(Lsi, Ls,) =
l<ii<n .:: tansi
ti, j:
tas sit
are in
emo messaçe ohich
L the channeo are
Con siskent global state
Consis teat if it S
Gs js Stngly
Con Sistent and
transiless
b pfilt to captura
LSi
LS23
LS31
LSs2
nsistent Gs
6i5:fLSy, LS2, LSsz
Incensisknt
Steng ycnsistnt: Ls, LS21) Lisy
GS