Uploaded by epsclppahvxzdlaigb

exam 17022020

advertisement
Distributed Systems (MS Cybersecurity)
Written test - 17/02/2020
First name: ________________ Last name:_______________ Enrollment num.:__________
Email: ______________________________________
Rules: 4 questions that need to be answered in max 120 minutes; no electronic device is allowed during the exam; ask the instructor for paper if you need it.
The list of students with a grade above 17 in the written test will be available in the exam page of the website. Students will be identified by enrollment
numbers. Only students on that list are admitted at the oral examination. The date of the oral examination is the 19th of February (15:30-17:30), address:
Room A6, Via Ariosto 25 (in case of clash with another exam send an email). The full mark (with lode) will be awarded only to students reaching at least 30 in
the written test and correctly answering questions during the oral examination.
#Q1: (Pt. 8) (Algorithm Analysis) Consider the following modified code for Lazy Reliable Broadcast.
<latexit sha1_base64="U7oggy+vLIkCo2+h032WMuaYurw=">AAACH3icbVDLTsJAFJ3iC/EFunQzkZi4Iq2P6JLEjUtI5JFAQ6bDBSdM28nMrYY0/QK3+gF+jTvjlr+xrV0IeFYn59ybc3I8JYVB215YpY3Nre2d8m5lb//g8KhaO+6aMNIcOjyUoe57zIAUAXRQoIS+0sB8T0LPm91nfu8ZtBFh8IhzBa7PpoGYCM4wldpqVK3bDTsHXSdOQeqkQGtUs8rDccgjHwLkkhkzcGyFbsw0Ci4hqQwjA4rxGZvCIKUB88G4cd40oeeRYRhSBZoKSXMR/n7EzDdm7nvppc/wyax6mfifN4hwcufGIlARQsCzIBQS8iDDtUgnADoWGhBZ1hyoCChnmiGCFpRxnopRuslSoB9JFDp8SZbVNNzzQpmk2zmrS62T7mXDuWrctK/rTbtYsUxOyRm5IA65JU3yQFqkQzgB8kreyLv1YX1aX9b372nJKn5OyBKsxQ9AJKMn</latexit>
p
Q1.1) Discuss if the property below holds in a system of N processes where an arbitrary number F (with F<N) of
processes may crash. If it does not hold show a counter-example that violates it.
•
Agreement: If a message m is delivered by some correct process, then any other correct process delivers m.
Q1.2) In case Agreement does not hold for arbitrary values of F, what are the values of F for which the above algorithm
is correct?
#Q2: (PT. 7) (Registers and consistency) Consider the execution depicted in the following figure and answer the
questions:
p0
<latexit sha1_base64="Jbz5wb4zThmd1svibU3vhuGscGs=">AAACIXicbVDLSsNAFJ34rPXV6tLNYBFclUQEXRbduKxoH9CGMpne1qGTmTBzo5SST3CrH+DXuBN34s+YxCxs61kdzrmXczhBJIVF1/1yVlbX1jc2S1vl7Z3dvf1K9aBtdWw4tLiW2nQDZkEKBS0UKKEbGWBhIKETTK4zv/MIxgqt7nEagR+ysRIjwRmm0l00cAeVmlt3c9Bl4hWkRgo0B1Wn1B9qHoegkEtmbc9zI/RnzKDgEpJyP7YQMT5hY+ilVLEQrD/Luyb0JLYMNY3AUCFpLsLfjxkLrZ2GQXoZMnywi14m/uf1Yhxd+jOhohhB8SwIhYQ8yHIj0hGADoUBRJY1ByoU5cwwRDCCMs5TMU5XmQsMY4nC6KdkXk3Dg0DLJN3OW1xqmbTP6p5b927Pa42rYsUSOSLH5JR45II0yA1pkhbhZEyeyQt5dd6cd+fD+fw9XXGKn0MyB+f7B4ZFo9U=</latexit>
<latexit sha1_base64="EaBqMHR9SNkIDU9uxAs0sbuNjOU=">AAACIXicbVDLSsNAFJ34rPXV6tLNYBFclUQEXRbduKxoH9CGMpne1qGTmTBzo5SST3CrH+DXuBN34s+YxCxs61kdzrmXczhBJIVF1/1yVlbX1jc2S1vl7Z3dvf1K9aBtdWw4tLiW2nQDZkEKBS0UKKEbGWBhIKETTK4zv/MIxgqt7nEagR+ysRIjwRmm0l008AaVmlt3c9Bl4hWkRgo0B1Wn1B9qHoegkEtmbc9zI/RnzKDgEpJyP7YQMT5hY+ilVLEQrD/Luyb0JLYMNY3AUCFpLsLfjxkLrZ2GQXoZMnywi14m/uf1Yhxd+jOhohhB8SwIhYQ8yHIj0hGADoUBRJY1ByoU5cwwRDCCMs5TMU5XmQsMY4nC6KdkXk3Dg0DLJN3OW1xqmbTP6p5b927Pa42rYsUSOSLH5JR45II0yA1pkhbhZEyeyQt5dd6cd+fD+fw9XXGKn0MyB+f7B4gAo9Y=</latexit>
Write(5)
Write(1)
Write(0)
p1
<latexit sha1_base64="+cJqp/OAcnvU85SqeC7rtFAjnw8=">AAACIXicbVDLSsNAFJ3UV62vVpduBovgqiRF0GXRjcuK9gFtKJPpbR06SYaZG6WEfIJb/QC/xp24E3/GJGZhW8/qcM69nMPxlBQGbfvLKq2tb2xulbcrO7t7+wfV2mHXhJHm0OGhDHXfYwakCKCDAiX0lQbmexJ63uw683uPoI0Ig3ucK3B9Ng3ERHCGqXSnRs1RtW437Bx0lTgFqZMC7VHNKg/HIY98CJBLZszAsRW6MdMouISkMowMKMZnbAqDlAbMB+PGedeEnkaGYUgVaCokzUX4+xEz35i576WXPsMHs+xl4n/eIMLJpRuLQEUIAc+CUEjIgwzXIh0B6FhoQGRZc6AioJxphghaUMZ5KkbpKguBfiRR6PApWVTTcM8LZZJu5ywvtUq6zYZjN5zb83rrqlixTI7JCTkjDrkgLXJD2qRDOJmSZ/JCXq036936sD5/T0tW8XNEFmB9/wCJu6PX</latexit>
<latexit sha1_base64="Z5x93yVpOk9RrooBOUo57TTPhig=">AAACIXicbVDLSsNAFJ3UV62vVpduBovgqiQq6LLoxmVF+4A2lMn0tg6dTMLMjVJCPsGtfoBf407ciT9jErOwrWd1OOdezuF4oRQGbfvLKq2srq1vlDcrW9s7u3vV2n7HBJHm0OaBDHTPYwakUNBGgRJ6oQbmexK63vQ687uPoI0I1D3OQnB9NlFiLDjDVLoLh2fDat1u2DnoMnEKUicFWsOaVR6MAh75oJBLZkzfsUN0Y6ZRcAlJZRAZCBmfsgn0U6qYD8aN864JPY4Mw4CGoKmQNBfh70fMfGNmvpde+gwfzKKXif95/QjHl24sVBghKJ4FoZCQBxmuRToC0JHQgMiy5kCFopxphghaUMZ5KkbpKnOBfiRR6OApmVfTcM8LZJJu5ywutUw6pw3Hbji35/XmVbFimRySI3JCHHJBmuSGtEibcDIhz+SFvFpv1rv1YX3+npas4ueAzMH6/gGLdqPY</latexit>
p2
p3
R1
R2
R3
1. Define ALL the values that can be returned by read operations (Rx=?) assuming the run refers to a regular
register.
2. Define ALL sequences of values that can be returned by read operations (Rx=?) assuming the run refers to an
atomic register.
#Q3: (Pt. 7) (Broadcast) Consider the following run of a broadcast algorithm.
<latexit sha1_base64="Jbz5wb4zThmd1svibU3vhuGscGs=">AAACIXicbVDLSsNAFJ34rPXV6tLNYBFclUQEXRbduKxoH9CGMpne1qGTmTBzo5SST3CrH+DXuBN34s+YxCxs61kdzrmXczhBJIVF1/1yVlbX1jc2S1vl7Z3dvf1K9aBtdWw4tLiW2nQDZkEKBS0UKKEbGWBhIKETTK4zv/MIxgqt7nEagR+ysRIjwRmm0l00cAeVmlt3c9Bl4hWkRgo0B1Wn1B9qHoegkEtmbc9zI/RnzKDgEpJyP7YQMT5hY+ilVLEQrD/Luyb0JLYMNY3AUCFpLsLfjxkLrZ2GQXoZMnywi14m/uf1Yhxd+jOhohhB8SwIhYQ8yHIj0hGADoUBRJY1ByoU5cwwRDCCMs5TMU5XmQsMY4nC6KdkXk3Dg0DLJN3OW1xqmbTP6p5b927Pa42rYsUSOSLH5JR45II0yA1pkhbhZEyeyQt5dd6cd+fD+fw9XXGKn0MyB+f7B4ZFo9U=</latexit>
<latexit sha1_base64="EaBqMHR9SNkIDU9uxAs0sbuNjOU=">AAACIXicbVDLSsNAFJ34rPXV6tLNYBFclUQEXRbduKxoH9CGMpne1qGTmTBzo5SST3CrH+DXuBN34s+YxCxs61kdzrmXczhBJIVF1/1yVlbX1jc2S1vl7Z3dvf1K9aBtdWw4tLiW2nQDZkEKBS0UKKEbGWBhIKETTK4zv/MIxgqt7nEagR+ysRIjwRmm0l008AaVmlt3c9Bl4hWkRgo0B1Wn1B9qHoegkEtmbc9zI/RnzKDgEpJyP7YQMT5hY+ilVLEQrD/Luyb0JLYMNY3AUCFpLsLfjxkLrZ2GQXoZMnywi14m/uf1Yhxd+jOhohhB8SwIhYQ8yHIj0hGADoUBRJY1ByoU5cwwRDCCMs5TMU5XmQsMY4nC6KdkXk3Dg0DLJN3OW1xqmbTP6p5b927Pa42rYsUSOSLH5JR45II0yA1pkhbhZEyeyQt5dd6cd+fD+fw9XXGKn0MyB+f7B4gAo9Y=</latexit>
p0
Broadcast:
m1
m2
p2
m4
m3
m4
p1
<latexit sha1_base64="+cJqp/OAcnvU85SqeC7rtFAjnw8=">AAACIXicbVDLSsNAFJ3UV62vVpduBovgqiRF0GXRjcuK9gFtKJPpbR06SYaZG6WEfIJb/QC/xp24E3/GJGZhW8/qcM69nMPxlBQGbfvLKq2tb2xulbcrO7t7+wfV2mHXhJHm0OGhDHXfYwakCKCDAiX0lQbmexJ63uw683uPoI0Ig3ucK3B9Ng3ERHCGqXSnRs1RtW437Bx0lTgFqZMC7VHNKg/HIY98CJBLZszAsRW6MdMouISkMowMKMZnbAqDlAbMB+PGedeEnkaGYUgVaCokzUX4+xEz35i576WXPsMHs+xl4n/eIMLJpRuLQEUIAc+CUEjIgwzXIh0B6FhoQGRZc6AioJxphghaUMZ5KkbpKguBfiRR6PApWVTTcM8LZZJu5ywvtUq6zYZjN5zb83rrqlixTI7JCTkjDrkgLXJD2qRDOJmSZ/JCXq036936sD5/T0tW8XNEFmB9/wCJu6PX</latexit>
m1
m1
m3
m2
Delivery:
m4
m3
Q3.1: Writes all the happened-before relationships induced by the above run.
Q3.2: Add the minimal number of broadcast events and the necessary delivery events such that the run satisfies the
properties of regular reliable broadcast but not the properties of uniform reliable broadcast.
#Q4: Pt. 10 (Algorithm Design) Consider processes arranged as a line, in a system where each one has a unique ID
(see Figure). Processes are connected by perfect point2point links. Processes are not always correct, and when they
fail, they fail by crashing. Processes can communicate only with neighbors by exchanging messages.
When a neighbor of a process fails a new neighbor is given: there is an oracle that notifies a process of a new link with
a new-left or new-right neighbor. The only exception is if a process becomes an endpoint of the line (P’ is an endpoint).
In this case the event no-new-left (or no-new-right) is generated.
Suppose that the oracle does not shuffle the line, that is at each reconfiguration the relative order from left to right on
the line is preserved (see figure) below.
P’
X
Time t crash of P
P’
X
Time t+1 crash of P’
X
<No-New-left>
P
<New-Right: y>
Y
Z
T
Y
Z
T
Y
Z
T
Q4.1) Create and write the pseudocode of an algorithm that implements a total order broadcast (TOBcast). A TOBcast
is a regular reliable broadcast with the additional property that all correct processes deliver messages in the exact
same order.
NOTE: you can only use point2point links, you cannot use consensus or other broadcast primitive as black-boxes.
Q4.2) Discuss why in your algorithm is not possible for any two correct process to deliver any two messages in different
order. What happens when we consider any pair of processes? Do they deliver messages in the same order? Discuss
with examples.
Download