


























































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!



























































A safety property is a property that if it is violated, then it cannot be restored, instead a liveness property is a property that cannot be violated in finite time FL2 or At most-7 duplication: It is a safety property, since the property says that if a correct process p sent a message finite times, then a process q has to deliver the message m at most 7 times. It is a safety property, since if we extend it to more than 7 times than the property is violated and cannot be restored.
Mutual Exclusion: it is a safety property since if we have two processes p and q that want to access the same critical section, if they can do it at some moment of time t, then the resource in the critical section cannot be restored anymore since it is been accessed by two proce sses contemporarly.
No-deadlock: a deadlock is a state in which a process is blocked on an infinite loop and cannot continue its execution. No deadlock means that the process is not stuck. It is a liveness property, since it cannot be violated in a finite time. To violate it, the process has to be stuck for an infinite time.
No-Starvation: a process is in starvation if it doesn't receive the resources to continue its execution. No starvation means that the process has the resources to execute. It is a liveness property, since it cannot be violated in a finite time. To violate it, the process has to not have resources for an infinite time, since if it can have the resources at some time, than it can execute.
Fairness of an execution: An execution is fair if a correct process p sends a message m an infinite number of times, than q has to deliver the message m an infinite number of times. It is a liveness property. It cannot be violated in a finite time, since in a finate time q cannot deliver an infinite number of messages.
At most-f failures: it is a safety property, since this property says that a process can reacts good to at most f failures. If f+1 failures happens, than the process cannot be restored anymore and the property is violated.
venerdì 26 gennaio 2024 14:
Show that our stubborn algorithm does not work if we change the first property in: SL1 or Stubborn-delivery: If a process p sends m to q, then q delivers m an infinite number of times. {Pay attention something is missing}.
domenica 28 gennaio 2024 10:
giovedì 1 febbraio 2024 10:
In the real Majority-Ack URB algorithm the line is #(ack[m]) > N/2. Since we are talking about a quorum of process that must be correct, so n/2 + 1 processes have to be correct, in this case if |F| = n/2 + 1, this means that a quorum of processes may fail. For this reason the algorithm doesn't function with the line #(ack[m]) > N/2 + 1, since if n/2 + 1 processes fail, the ack will always be less than n/2 and they are not a majority, so there isn't a majority of correct processes, but a majority of faulty processes. So the validity property will never be satisfy, since the process will never deliver the message m. The strong accuracy property of the perfect failure detector says that if a process p is detected by any process, than p has crashed. If this property is violated, this means that the PFD detects a process q as crashed, but in reality it has not crashed and this is a problem, since when the PFD detects that q has crashed, it deletes the process from the correct processes set. So, if a message m is delivered by some process, the process q that is correct will never deliver it, violating the uniform agreement property which says that if a message m is delivered by any process, than it will be delivered by any correct process.
The strong completeness property of the perfect failure detector says that every process that crashes, is eventually detected by every correct process. If this property is violated, this means that if a process q crashes, than the process p will never detects it, so it means that the process q will remain in the correct set and correct will never be a subset of ack[m] since in correct there will be q that is not in ack[m]. For this reason the candeliver(m) function will return always false, because we are waiting for an ack that will never arrive, and m will not be delivered, violating the uniform agreement property.
Without assuming a majority of correct processes, means that f >= n/2 and in this case we know that the system is asynchronous. This will break the validity property by which a message m delivered by a correct process will be eventually delivered by every correct process. Since we are in an asynchronous system, we can create a partition in which p2 and p3 are slowed down in order to let them crash after the delivery of m on p0 and p1, but when p0 and p1 crash, it will violate the agreement property that says that a message m delivered by some correct process will be delivered by every correct process. This violates the agreement property, since if p2 and p3 deliver m and than crash, p2 and p3 will deliver a message delivered by some crashed processes. The second execution satisfies the FIFO order, since the messages are delivered in the same order by which they are sent in the same process that broadcasted them and moreover the messages broadcasted by the correct processes are delivered in the same order to the other processes
No, it isn't possible since if the sender crashes, that the delivers by any other process cannot be guaranteed
No, it isn't possible since if a process has crashed, it cannot delivered the message after the crash
lunedì 5 febbraio 2024 10:
Read1() = {1} Read2() = {1, 3} Read3() = {1, 3, 2} Read4() = {3, 2} This run is regular, but not sequential This run is sequential, but not regular This run is sequential, but not regular This run is atomic and sequential, but not regular This run is regular and sequential, but not atomic This run is not sequential Part 5 lunedì 5 febbraio 2024 15:
This is regular and atomic Read1() = {1} Read2() = {1} Read3() = {1, 2} Read4() = {1, 2} The only way to violate sequence consistency is that read3() reads 1 and read2() reads 2, but this is impossible since it will violate the local order in the process p
In majority voting algorithm there is no failure detector, in fact it is a fail-silent algorithm in an asynchronous system. The identifier for the WRITE operation is necessary since to every writing message a timestamp wts is associated, in order to save in the local variable (ts, val) the last written value in the register. For the READ operation is necessary in order to make the reader process reads correctly the last written value on the register. For ACK message is necessary, since it is useful to understand to which message the ack corresponds to in order to count the number of acks for the message and returing the write operation when a majority of acks has been received. Instead, for the VALUE message it is useful in order to understand which is the maximum timestamp related to the values in the quorum in order to read correctly and return. In the Read-one Write-all algorithm these identifiers are not necessary, since this algorithm has a perfect failure detector in a synchronous system which deletes the processes that crashes from the correct set. For this reason, this algorithm uses the best effort broadcast to send the write messages and the acks and the write operation returns when all the correct processes delivers the ack. So, the identifiers are useful in a fail-silent model to allow the management of the failures indirectly, instead in the read-one write-all they are not useful since the crashed processes are directly ignored. In a fail-silent algorithm we have a quorum of correct processes which is at least n/2 + 1 where 1 is the intersection between two quorums that is the processes that has to be necessarly correct. In this case this process can be a byzantine process, so we have to change the bound for the quorum to have at least one correct process. If we choose n/2 + 2 than if one is the byzantine process and one is the correct process, we cannot discover the lie, but if we choose n/2 + 3 than if one is the byzantine process and two are the correct processes, we can discover which is the wrong answer given by
but if we choose n/2 + 3 than if one is the byzantine process and two are the correct processes, we can discover which is the wrong answer given by the byzantine process. So the majority voting algorithm becomes: Upon event <pl, Deliver | q, [ACK, ts']> s.t. ts' == wts do Acks = acks + 1 If acks >= n/2 + 3 Acks = 0 Trigger <onrr, WriteReturn> Upon event <pl, Deliver | q, [VALUE, r, ts', v']> s.t. r == rid do Readlist[q] = (ts', v') If #readlist >= n/2 + 3 V = highestval(readlist) Readlist = [null]^n Trigger <onrr, ReadReturn> To build the (1-N)-Atomic Register starting from the (1, N)-Regular Register in fail-silent we have a stack of protocol that in order implements (1, N)-RR, (1, 1)-AR and (1, N)-AR, so we suppose that the implementation of (1, N)-RR has the assumpution on correct majority encapsulated in it. So we suppose that (1, N)-RR is implemented with a fail silent algorithm such as the majority voting. We can modify the majority voting algorithm in fail-silent to build a (1, N)-RR for building a (1, 1)-AA which has 1 writer and 1 reader. Upon event <onar, Init> do Acks = 0 Readlist = [null]^n Wts = 0 Rid = 0 (ts, val) = (0, null) Upon event <onar, WRITE | v> do Wts = wts + 1 Acks = 0 Trigger <beb, Braodcast | [WRITE, wts, v]> Upon event <beb, Deliver | p, [WRITE, ts', v']> do If ts' > ts than (ts, val) = (ts', v') Trigger <pl, Send | p, [ACK, ts]> Upon event <pl, Deliver | q, [ACK, ts']> such that ts' == wts do Acks = acks + 1 If acks > N/ Acks = 0 Trigger <onar, WriteReturn> Upon event <onar, READ> do Rid = rid + 1 Readlist = [null]^n Readlist[self] = (ts, val) Trigger <beb, Broadcast | [READ, rid]> Upon event <beb, Deliver | p, [READ, r]> do
Agreement is violated Integrity is violated Termination is violated Validity is violated Validity is violated, even though decide(0) are decisions of crashed processes If we remove the control r > proposer, the process p that has to decide the value v can decide values that have been proposed by old dead leader, violating the agreement property It is possible that any server in the cluster could accept a different value Y, after accepted proposal 6 with value X since the prepare(num=5) has ts < ts', so if it has received a majority of acks than it can write the value Y on a1, a2 after the propose value X with num= has been accepted by a3, a4, a The safety properties of paxos are validity, integrity and agreement, instead liveness property is termination. If we use the rule (ID', ts') > (ID, ts) if ID' > ID or ID' = ID and ts' > ts we practically say that the value proposed is accepted by the acceptor if the rule is valid. If we suppose that are no crashes the safety properties are satisfied since the value accepted by the acceptors are necessarly proposed by a propser (validity property), only one value is accepted (integrity) and the majority of acceptors accept the same value (agreement). But if we suppose that there are crashes, the liveness property is not satisfied since if a process with the higher ID n proposes a value and than a majority of acceptors promise to the process with ID n that it will not accept proposed values by processes with ID less than n, than if the process n crashes than the acceptor will never accept a value anymore since there are no more process with ID higher than n. So if the acceptors never accept, the algorithm will never decide, so end, violating the termination property. Part 6 mercoledì 7 febbraio 2024 11:
A safety property for the paxos algorithm is that a single value is accepted by a majority of acceptors, instead a liveness property is that a majority of acceptors has to decide a value, so the algorithm terminates. The safety property is satisfied, since when a proposer p proposes a value vval at round number vrnd, then when it receives the ack from an acceptor a (event promise) it adds the pair (vrnd, vval) to the set of promises P that it received from the acceptors. When p receives a majority of acks such that |P| >= n - f, the proposer chooses the value with the maximum round number in the quorum such that the value that has to be accepted is the one with the maximum round number in order to respect the promise, thanks to which the acceptor promises not to accept values with a round number less that vrnd. At this moment the proposer sends the ACCEPT message to the acceptors in order to make them decide the value. The property "a single value is accepted" is satisfied thanks to the instructions at lines 13 and 14 and thanks to the fact that the round number of the proposers are unique and cannot collide. Instead, the liveness property is not always satisfied. In fact, if we suppose that there are two proposers p1 and p2 where p1 proposes <num = 0, v = X> and after p proposes <num = 1, v = Y> and there are 5 acceptors. If they both receives a majority of acks, for example p1 from a1, a2, a3 and p2 from a3, a4, a5, we know that the process a3, a4 and a5 have promised to not accept values with round number less that 1. If the timeout that corresponds to the nack expires and if p1 tries to send the ACCEPT messages to a1, a2 and a3 that it will never reach a majority of process since a3 have promised a round number higher than 1. If p2 never sends its value and if p1 tries continuously to send its value before the timeout expires, the acceptors will never decide and the algorithm will never end. The original algorithm still works, since we can have an execution of this kind: In this execution we have two proposers p1 and p2 and three acceptors a1, a2 and a3. p1 and p2 collides in the same round number 0 and they proposes two different values, in fact p1 proposes <num = 0, v = X> and p2 proposes <num = 0, v = Y>. P1 receives the majority of acks from a1 and a2, instrad p2 receives the promises from a2 and a3, thanks to which the acceptors promise to accept only values with round number higher or equal to 0. After the promises, the proposers can send the ACCEPT messages to the correspondent acceptors, but the value will be decide only when the pair (vrnd, vval), where vrnd is the highest round number and vval is the value proposed, has multiplicity in the set V of the learner correspondent to the majority of processes. This means that the value decided by the learners is the value related to the process that sends faster the ACCEPT messages to the majority of correspondent acceptors. The idea to solve this problem is to give a sequence number to every instance of the consensus problem, so for the first instance seq_num = 1, second instance seq_num = 2 and so on, such that every instance will decide on the value equals to the seq_num.
1. What happens if I have Beb instead of RB? Is the algorithm still correct or not? If we remove the ReliableBroadcast we can have an execution of this type: This doesn't violate safety properties, but it violates the liveness property since M2 will never be decided. In fact if we s uppose that p2 is very slow respect to p1, then M2 will never be decided if p1 decides its proposed values every time, so to respect the safety properties also p2 has t o deliver that values. Instead, with rb the values are broadcasted, so even though p2 is very slow and doesn't decide, the value M2 will be decided by p1 eventually. If we have Beb instead of Rb, the algorithm still works, since messages sent by fault processes will never be delivered becau se the pseudo code is for Total Order algorithm that doesn't assure the delivery of messages sent by fault processes. The idea is using the uToB primitive, such that when multiple values are proposed, than they are ordered and the first value is picked. Since the sorting algorithm in ToB is deterministic, the first value will be the same for every process solving consensus. The pseudo-code for this algorithm can be: Upon event <Consensus, Init> Decided = FALSE Upon event <Consensus, Propose | v> Trigger <uToB, Send | v> Upon event <uToB, Deliver | v> If decided = FALSE Trigger <Consensus, Decide | v> Decided = TRUE The total order broadcast algorithm A is not causal broadcast or FIFO, since the Total Order algorithm is needed to solve the ordered broadcast problem when the casual and FIFO relations are not enough. In fact, if the messages are delivered without following any causal or FIFO relatio ns, if they pass through the total order algorithm than they respect TO, but not causal or FIFO. It is linearizable It is not linearizable, but it is sequential consistent It is linearizable Part 7 venerdì 9 febbraio 2024 10:
This execution is not possible since if in L of p4 there is the value 2, this means that the primary has executred Op(4), but this also means that the pending execution Op(1) has terminated and this is not possible since in L of p3, 1 is not present, so this means that the primary has not concluded Op(1), since it has not received all the ack for Op(1). This violate the consistency of the algorithm. This execution is not possible, since this means that contemporary the primary has requested the executions of Op(1) and Op(4), but we know that an operation can be executed only when the pending one has been completed. This means that the primary is byzantine. This execution is possible, but to elect a new primary the only possibility is to partition the system This execution is possible and to elect a new primary we choose the backup with the maximum number of operation and the minimum id This execution cannot happen, since the term 3 cannot happen before the term 2, because the term is always increased by 1 after the previous one is committed and the entries are monotonical This execution is correct This execution is correct This execution cannot happen, since an entry is committed if and only if the previous ones are committed. So an entry has to be equal to something before going forward with committing other entries If the system has f = n/2 - 1 crash failures, this means that the correct processes have to be necessarly n - (n/2 - 1) = (2n - n + 2)/2 = n/2 + 1 and this means that every process that broadcasts a value, wants to write the value on every register, has to receive a majority of acks, so at least n/2 + 1 acks, to return the write operation. For this reason the control acks > n/2 + 1 is a problem, since in this algorith we need at least n/2 + 2 acks. If n/2 - 1 process crashes, we can have exactly n/2 + 1 correct processes and n/2 + 1 acks, that is strictly less than n/2 + 2 and this is a problem. If we think about the termination property, it is violated since if there are n/2 - 1 crashes and the process p calls the write operation, p will never receive n/2 + 2 acks, so it will never return the write operation and will never terminates. Instead, if we consider the validity property, it is satisfied since the acks needed to return the read operation are #readlist > n/2, so this means that are at least n/2 + 1. So, if we suppose that two writing operations succed and write the value 5 and after 6, because there are f failures < n/2 - 1, so it can receive n/2 + 2 acks and return,