Sei sulla pagina 1di 4

!

"#$%"&'$() +,#$(-#
./(%0"#(#

1%2- (/3- 24 56565778 9:;<
A uistiibuteu system is composeu by N piocesses that want to access to K iesouices (k>u).
Each piocess tiies to access to h iesouices (k ! h > u) thiough a REQ0EST(h) opeiation anu,
once it has acquiieu the iesouices, it can ielease them by a RELEASE (h') opeiation (the
iesouices ieleaseu may be a subset of those acquiieu).
Each piocess cannot iequiie fuithei iesouices until it has not ieleaseu the acquiieu ones.
Wiiting the pseuuo-coue of the algoiithm implementing the REQ0EST(h) anu the REPLY(h')
opeiations having at uisposal a T0(0A, S0T0) communication piimitives anu a peifect failuie
uetectoi.
1%2- (/3- 24 56565778 9:=<
With iefeience to the pievious question, uiscuss the coiiectness of youi solution in teims of
safety:
1) at each time the numbei of allocateu iesouices is lessei equal than k
anu in teims of liveness. In paiticulai, uiscuss if youi solution satisfy at least one of the
following piopeities:
2) each iequest is eventually satisfieu
S) the system assigns iesouices to piocesses but theie exists some iequests that aie
nevei satisfieu (it suffeis fiom staivation).

1%2- (/3- 24 >>6?65778 9:;<
A communication system is saiu "logically instantaneous" if all the messages containeu in an
execution can be viitually sent instantaneous (i.e. without latency).
Consiuei, foi example, the execution uepicteu in Figuie. It is not logically instantaneous uue to
mS that cannot be iepiesenteu as viitually instantaneous (i.e. as a veitical aiiow) uue to the
piesence of the event of senu anu ieceive of messages m1, mS anu mS, m2.



Is the following sentence tiue oi false.
!"# % &'(()*+&%,+'* +- .'/+&%..0 +*-,%*,%*1')- ,21* +, +- %.-' &%)-%..0 '3413145 621 7+&1 713-% +-
*', %.8%0- ,3)19. Pioviue a uetaileu motivation.


1%2- (/3- 24 >>6?65778 9:=<

Let us consiuei a uistiibuteu system composeu of n piocesses. The k-mutual exclusion
piesciibes that at each time unit, at most k-1 piocesses aie in theii ciitical sections.
Let us assume that each piocess pi is associateu to a set of piocesses Qi, calleu quoium, anu
executes the following coue to access the ciitical section

Piocess Pi: While (not uet(Qi));
< Ciitical Section>;
Release(Qi)

wheie uet(Qi) is a piimitive that ietuins tiue only if the piocess pi is able to lock eveiy othei
piocess in Qi. A piocess pi can lock a piocess pj only if pj in not yet lockeu by any othei
piocess. Release(Qi) iemove the lock fiom any piocess belonging to the quoium Qi.
Biscuss the weakest piopeity that the Quoiums Q1, Q2. Qn have to satisfy to ensuie the k-
mutual exclusion.

1%2- (/3- 24 >>6?65778 9:@<
Consiuei the following algoiithm wheie a geneiic piocess has iuentifiei myIu:

'A2B (C(B$ <Init> )2
state = NCS
penuing =
waiting = false
vicino = (myIB+1) mou N

'A2B (C(B$ <Request CS>D)2
waiting = tiue
$%"EE(% <::;:<1*4 | vicino, |REQ0EST, myIuj>

'A2B (C(B$ <Exit CS> )2
waiting= false
state =NCS
42% 3FF (iu " penuing) )2
penuing = penuing / {iu}
$%"EE(% <::;:<1*4 | vicino, |REQ0EST, iuj>



'A2B (C(B$ <::;:=1.+713 | Pj, |REQ0EST, iuj > )2
"4 (iu = myIu) $G(B
state = CS * enteiing CS *
(F#(
"4 (waiting=false) $G(B
$%"EE(% <::;:<1*4 | vicino, |REQ0EST, iuj>
(F#(
9H< "4 (state=NCS ! iu<myIu) $G(B
$%"EE(% <::;:<1*4 | vicino, |REQ0EST, iuj>
(F#(
penuing = penuing " {iu}



The system is composeu by N piocesses, with iuentifiei compiiseu between u anu N-1
connecteu thiough a iing. The stuuent answei to the following questions:
1. Which piopeities (Nutual Exclusion, No Beaulock, No Staivation) aie
satisfieu by the algoiithm. Pioviue a motivation foi the answei.
2. Foi the piopeities not satisfieu, pioviue an execution that shows the
violation.
S. Besciibe what coulu happen if the line (*) is substituteu by "4 (state=NCS)
$G(B
1%2- (/3- 24 >;6I65778 9:;<
Let us consiuei a system foimeu by one client anu N piocesses implementing active
ieplication. 4 of such ieplicas pioviue a uiffeient output when stimulateu by the same input
(i.e., 4 ieplicas aie non-ueteiministic).
Each of the ieplicas communicate with the client thiough a peifect point-to-point channel.
Consiueiing that at most # ieplicas can ciash, finu out how many ieplies shoulu wait a client
befoie unblocking in oiuei that the client be ceitain to obtain the iesult computeu fiom
ueteiministic ieplicas.

1%2- (/3- 24 >;6I65778 9:=<
Wiite the pseuuo-coue of a peifect point-to-point link avoiuingthe infinite ietiansmission of
any message. Also uiscuss if it is possible to avoiu the infinite giowing of buffeis at the
iecipient siue. In the affiimative, wiite the pseuuo-coue. In the negative, explain why it is
impossible.

1%2- (/3- 24 I6865778 9:=<
Let consiuei the following leauei election algoiithm executeu by a coiiect piocess baseu on
Reliable Bioaucast anu Consensus. Also the system is foimeu by > piocesses, at most # can fail
by ciashing anu at most ? piocesses can misexecute line (*) by senuing any value uiffeient
fiom the outcome of the consensus. Answei to the following questions:
1. wiite the pieuicate C0NB in oiuei that the algoiithm satisfies leauei election
specification
2. the ielation among >, # e ?.

J2)( 24 $G( A%20(## K!

KLKM
canuiuate|jj= # foi each j;
leauei = #;
piopose (IB);

NA2B )(0")( 9/<
RBsenu (x) to all; (*)

NA2B OP%(0("C( 9,< 4%2- QR
canuiuate|jj :=y;

SG(B 9JTL!<
leauei := select most fiequent IB fiom canuiuate;






1%2- (/3- 24 I6865778 9:=<
A local checkpoint is a state of a piocess saveu onto stable stoiage. A global checkpoint of a
uistiibuteu computation Cu is a set of local checkpoints one foi each piocess.

Cu is consistent if theie not exists a message m such that
(a) m is sent aftei a local checkpoint belonging to Cu anu
(b) m is ieceiveu befoie anothei local checkpoint belonging to Cu
As an example Cua anu Cub aie not consistent. In the same pictuie it can be noticeu that the
local checkpoint c is useless because it cannot belong to any consistent global checkpoint.


Assume that any piocess takes local checkpoints accoiuing to one of the following giammai
iules:
Rule 1: (checkpoint (ieceive)*(senu)*)*
Rule 2: (checkpoint (senu)*(ieceive)*)*

Which iule might geneiate useless checkpoints. Show with an example.

Let us note that the following execution at a geneiic piocess satisfies iule 2 anu it uoes not
satisfy iule 1.




1%2- (/3- 24 576>>65778 9:@<
The stuuent consiuei a system composeu of n piocesses $ = {p
1
, p
2
, . p
n
}.
Each piocess can access a peifect failuie uetectoi P anu a iegistei value
i
of type (1,N).
uiven the consensus piotocol of in the figuie the stuuent answei to the following questions:
1. Is the consensus implementeu unifoim oi not.
2. Which is the weakest specification foi the iegistei that makes the piotocol coiiect.

Pioviueu a uetaileu motivation, even using example if neeueu.

Potrebbero piacerti anche