You are on page 1of 4

GC82100:

Distributed Operating Systems

Final exam (take-home); Handed out on 05/20/15; Due on 05/23/15


Instructor: K. Ravindran,
Spring 15
[Send your answer sheets to my webmail address: ravir222@hotmail.com
DO NOT SEND TO MY DEPARTMENT ADDRESS
(for some reason, department mailer drops emails with large attachments)]
1.

(30 pts) The communication level agents of processes in a group form a logical ring, with
each agent C(pi ) for a process pi having an incoming channel ini and an outgoing channel
outi that connect to its predecessor C(pi1 ) and successor C(pi+1 ) respectively in the ring
through a network, where i = 1, 2, . . . , N (modulo N addition is used for process indexes). See
Figure 1. On this communication configuration, the following basic implementation of causal
broadcast related primitives (C Bcast and C Deliver) is employed for the case of lossless
(and non-duplicating) channels and no process failures:
C Bcast(m) by ps for 1 s N

and

C Deliver by pi for i = 1, 2, . . . , N

C(ps )
C(pi )
seq no := seq no + 1
pend lst := , del set := , seq no := 0
m.prev del := del set
/* Initialize communication related variables */
forever
m.s id := my id
Receive(m0 , ini )
m.s no := seq no
Send(m, outs )
if (m0 .s id 6= my id)
include (seq no, my id) in del set
include m0 in pend lst
while x pend lst 3 (x.prev del del set) do
include (x.s no, x.s id) in del set
strip s id, s no and prev del from x
and deliver x to pi
remove x from pend lst
Send(x, outi )
else
notify pi about completion of C Bcast(m0 ).
del set: List of previously delivered messages;
seq no: Last assigned message sequence
number at this process; pend lst: List of messages awaiting delivery; 3 such that0 .

2.

A:

Describe the functioning of the above causal broadcast message delivery algorithm.

B:

Given an underlying network behavior in which the channels are lossy but a C(pi ) knows
about a guaranteed upper bound on the transfer delay of a message m sent using
Send(m, outi ) in the case m is delivered at the receiver C(pi+1 ) at the other end of outi ,
how will you modify the above algorithm using timeout based message retransmissions ?
Assume that each C(pi ) knows about the total number of members N in the group.

(30 pts)
A:

Establish the truth or otherwise of the following statements:

Given a set of messages m1 , m2 and m3 , {(m1 m2 ), (m3 m2 )} (m1


k{m2 , m3 }), where denotes Lamports happens before relation and k denotes concurrent messages;
1

Machines

Application
layer
(C_Bcast/
C_Deliver)
Broadcast
layer
(Send/
Receive)

process
group
p1

p2

pi

C(p1)

C(p2)

..
in
i

C(pi)

pN

..

C(pN)

out i

Network channel for communication


Figure 1: A realization of causal broadcast layer on ring-based networks
B:

Electing a leader among a set of processes is an instance of the generic problem of mutual
exclusion among these processes.

C:

With send-omission behavior of processes (ie., a process arbitrarily deciding not to send
any message when it is supposed to send one), that a process is alive or otherwise cannot
be accurately determined.

D:

Given a set of processes, the saving of local states during a run (i.e., checkpointing)
without any coordination among the processes results in a shorter recovery time upon a
process failure, than a coordinated checkpointing.

You may give an example, where necessary, to support your answer.


3.

(25 pts) Consider a set of processes {pa , pb , pc , } interconnected in the form of a logical
ring through non-lossy and FIFO channels. An election algorithm uses information on the
ranking among processes to choose the highest ranked process as the leader (the positional
order of processes in the ring may not reflect the rank order). For example, if rank(pb ) >
rank(pc ) > rank(pa ), the algorithm will choose pb as the leader. A process does not know
before-hand as to which other processes are actually on the ring. Thus, the election algorithm
amounts to finding out the highest ranked process in a given ring configuration. Any of the
processes can start an election: say, when the heart-beat message I AM ALIVE(u) is not heard
from the current leader u or when a non-leader v spontaneously wishes to challenge u to take
over its role1 . Assume that the ring is static (with no breaks) during an entire run of the
election algorithm2 . See Figure 2.
For algorithm design purposes, the ring connection data structure is distributed among processes. Each process pi maintains two variables: [succ(pi ), pred(pi )], indicating the process

1
The ranking of processes is a meta-information used only for the purpose of election. This information goes into
the blind-spot of processes when there is no election.
2

A background algorithm reconfigures the ring when a process in the ring fails or a new process joins the ring. Such
a reconfiguration is however atomic with respect to an election activity. In the earlier example, even if a new process
pd with rank(pd ) > rank(pb ) subsequently joins the ring, the join of pd does not by itself trigger an eviction pb as the
leader. Only when pb crashes or its leadership gets challenged, the ensuing election will choose pd as the leader.

_M
CT
ELE

,v
E (C

succ(x), predx)

ar)

s
ldr
A

succ

variables
maintained
by a process x

pred C

channel
segment of ring
(non-lossy, FIFO)

process A

UNIDIRECTIONAL
RING STRUCTURE
s

succ

pred B
ldr
A

state information
kept by a process
during election

s
rank(B) > rank(C) > rank(A)
ldr
A

process C
I_AM_ALIVE

message flow

(A)

succ

pred

process B
ldr(x):
process id of
leader as known
to process x

Figure 2: Sructure of ranking-based election algorithm executed on a ring


ids of its immediate successor and predecessor on the ring. An election-related message: say,
ELECT ME(y, var), can be received by pi only on the channel connecting to pred(pi ), where
y is some process on the ring that kick-started the election and var is the information carried around during the circum-navigation of ELECT ME from y to pi . The ELECT ME( )
message causes some actions at pi in the form of changes in its local state and/or sending an
ELECT ME( ) along the channel connecting to succ(pi ).
With the above basic structure, give a schema of the ranking-based election algorithm in a
pseudo-code form as executed by the process pi . You should state how pi kick-starts the
election activity, what actions pi performs when an ELECT ME( ) message is received, and
how pi terminates (i.e., decides that the election has completed and knows who the leader is).
Hint: The information var carried in the ELECT ME message can possibly include a process
id x, indicating that the circum-navigation election request started by y has found x as the
highest ranked process thus far.
4.

(25 pts) Consider the processes {pi }i=1,2,,N executing a deterministic program, i.e., the
actions taken by a pi depend only on the initial state of pi and the messages pi receives.
An instant-replay debugger records the message exchanges of an execution E of the program
and permits an exact replay of E. Consider, for instance, processes p1 , p2 , p3 in initial states
init init respectively. In E, p may (say) receive a message m from p and a message m
sinit
3
a
1
b
1 , s2 , s3
from p2 , send a message md to p2 , and then receive a message mc from p1 , with the processing
of these messages transforming the state of p1 , p2 , p3 to sf1 in , sf2 in , sf3 in respectively. Then a
replay of E may involve a controller process, say, installing p3 in the state sinit
while leaving p1
3
and p2 in their states sf1 in and sf2 in respectively, and then presenting the messages ma , mb , mc
in that sequence to p3 and having p3 regenerate md to p2 , to roll it forward to sf3 in (md will be
dropped). After p3 reaches sf3 in , then program proceeds further by exchanging messages me
and mf . See Figure 3.
Give an algorithm for an instant replay debugger in which each pi stores only local information.
Assume that messages channels are FIFO. Be sure to indicate the storage requirements of the
3

p1

p2

p3

s1(init)
ma

s2(init)

s3(init)

mb
Time
mc
md
s1(fin)
s3(fin)
s2(fin)
s3(init)
ma
mb
mc

md

Regenerate
messages

s3(fin)

message
dropped
me
mf
s1

s2

s3

Replay of execution

Figure 3: A sample scenario of roll-forward execution


algorithm.
5.

(15 pts) In the class, we had discussed broadcast primitives with various semantics: atomic,
FIFO, causal, and totally ordered. Explain what type of broadcast suffices for the following
application: a company manager issuing a series of instructions to his/her group of subordinates. Does your choice change when the instructions are sent from multiple managers at
different locations.