You are on page 1of 7

[CSC3121]

NEWCASTLE UNIVERSITY

Assessment 2

DISTRIBUTED SYSTEMS

Instructions to candidates:
Answer ALL questions
The total marks available for this exam are 100
Marks shown for sub-sections are indicative only

[Turn Over]
[CSC3121]

Question 1.
(Both parts of this question require familiarity with the
implementation of “at most once” RPC system discussed in
lectures – e.g., see #rpc28.)
a) Consider an RPC system in which clients initiate their calls
with call sequence numbers which are also included when
clients retry their calls after a timeout. The server maintains
in its main memory the final results computed for the latest
RPC received from each client and returns the results if a
call is detected to be a retry. Assume that (i) the clients
never crash, (ii) the server can crash and a crashed server
recovers after some time and (iii) no communication failure
occurs. Identify the type of semantics guaranteed by this
RPC system and explain the reasons for your answer.
[5 marks]
b) Suppose that communication failures do not permanently
block inter-process communication and that any crashed
node eventually recovers. Using the principles of the two-
phase commit protocol, describe an RPC implementation
scheme that would guarantee “exactly once” RPC
semantics when both the server and the client nodes are
prone to crashing. [15 marks]
Hints: As in two-phase commit protocol, you can assume
that each node has a recovery manager and maintains in
its crash-proof store a ‘log’ with atomic-write capability. You
can also assume that an RPC involves only one server and
does not lead to making another RPC in another server.

Page 2 of 7
[CSC3121]

Question 2.
(Based on the formative assessment whose model answer was
discussed on Monday of week 15)
a) A total order message delivery service is to be built for a
system of at least 4 distributed processes. The following
five assumptions should be made:
A1) Processes have access to synchronised physical
clocks; for the sake of simplicity, perfect clock
synchronisation can be assumed i.e., the synchronisation
error can be assumed to be zero;
A2) The underlying communication subsystem guarantees
that a sent message is delivered to every destination, with
a minimum delay of d and with a maximum delay being
finite but unknown; thus, if a process sends m at time t1 as
per its local clock, m will be received at some time t 2 as per
the destination process’ local clock and t2 ≥ t1 + d.
A3) For any two processes, say, p1 and p2, messages
sent by p1 to p2 are received in the sent order;
A4) Sending of a given message to one or more
destinations is a single event within the sending process
and a message is stamped with the sending time according
to the sending process’ clock; and,
A5) Processes never crash and their identifiers are
uniquely ranked; this ranking is known to all processes.
The service must satisfy the following three conditions in
delivering the received messages to processes:
(C1) Suppose that messages m and m' are sent to a
process, say p1. If sending of m happens before sending of
m', then m is delivered to p1 before m' is delivered.

[Turn Over]
[CSC3121]

(C2) When multiple messages (say, m and m') are sent to a


common set of destination processes, they are delivered in
the same order to all common destination processes.
(C3) Any message sent to a process is eventually delivered
to that process.
Describe a design for such a service; your description
should explain how conditions C1, C2 and C3 are met.
[15 marks]
b) Let assumption A2 be revised as follows. There is a known
upper bound, denoted as D, on message transmission
delays. That is, if a process sends m at time t1 as per its
local clock, m will be received at some time t2 as per the
destination process’ local clock and t1 + d ≤ t2 ≤ t1 + D.
Explain how your design for part a) can be modified to be
more message efficient while at the same time meeting all
three conditions C1-C3?
[10 marks]
Question 3.
a) T1 and T2 are two transactions involving objects x, y and z.
For 1 ≤ j ≤ 2, Rj(o) and Wj(o) denote Tj reading and writing
object o respectively; bj and ej are begin and end events of
Tj respectively. T1: b1  R1(y)  W1(x)  W1(z)  e1 and
T2: b2  W2(y)  W2(z)  e2, where denotes the
happened before relation between events. Consider the
following two totally-ordered event sequences:
S1: b1R1(y)W1(x)b2W2(y)W1(z)W2(z)e2e1,
S2: b2W2(y)b1R1(y)W1(x)W1(z)W2(z)e2e1.
Assess whether each event sequence is serializable. For
each serializable sequence found,
i) Find the equivalent, serially ordered sequence, and

Page 4 of 7
[CSC3121]

ii) Explain whether the sequence would be permitted


under two phase locking when resolution of lock
conflicts does not risk deadlock among transactions.
[15 marks]
b) This question tests your understanding of the two-phase
transaction commit protocol. The figures below show three
situations during protocol execution that involves four
processes (one co-ordinator, C, and three servers, S1, S2,
S3). For each of the three cases described below, state
the final outcome for the transaction (commit or abort), and
indicate how each server arrives at that outcome. Assume
that a crashed node eventually recovers.

no S1 S1
commit
yes S2 S2
C C commit
yes
S3 S3

(i) (ii)

yes S1

yes S2
C
yes
S3

(iii)

(i) Fig. (i): In phase one, the three servers respond to the co-
ordinator as shown. Then S2 crashes before it receives the
decision from the co-ordinator.

[Turn Over]
[CSC3121]

(ii) Fig. (ii): In phase two, the co-ordinator has decided to


commit, and starts sending the commit decision to the servers;
it crashes before sending it to S3.
(iii) Fig. (iii): In phase one, all the three servers respond as
shown; the co-ordinator however crashes and does not receive
these messages. [15 marks]
Question 4.
a) Consider a system of two processes P and Q that are
regarded to be connected by unidirectional channels c and
c’ as shown in the following figure.

c
P Q
c'

During a computation, P sends messages m1, m2, and m3 to Q


in that order, and Q sends to P messages M1, M2, and M3 in
that order. S1, S2, S3, and S4 are four global states
encountered in that order during the computation and are
depicted only partially in the Table below. For simplicity, the
state of a process in a given global state is expressed as an
ordered sequence of messages it has sent and received in that
global state. For example, P’s state in S1 being <m1, m2, M1>
means that P has sent m1, sent m2, and received M1 in that
order; state of channel c in S2 being < > means that channel c
has no message in S2. Without modifying the global state
components shown in the table, determine the global states,
given that send(m2)  send(M2) and send(M3)  send(m3)
hold during the computation. [25 marks]

Page 6 of 7
[CSC3121]

Global P c c’ Q
State
S1 <m1, m2, ? ? <M1,
M1> m1>
S2 ? <> <M2> ?
S3 <m1, m2, M1, ? <M3> ?
M2>
S4 ? <m3> ? <M1,
m1, m2,
M2, M3>

END

[Turn Over]

You might also like