Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exam Like Problems. Problem 1 You are given a software module which implements consensus between a static group of servers in an unreliable network. The.

Similar presentations


Presentation on theme: "Exam Like Problems. Problem 1 You are given a software module which implements consensus between a static group of servers in an unreliable network. The."— Presentation transcript:

1 Exam Like Problems

2 Problem 1 You are given a software module which implements consensus between a static group of servers in an unreliable network. The consensus procedure signature is object Decide(int k, object v) All invocations for the same k are promised to return the same decided value Write a pseudo code for a protocol that implements total ordering based on the given module

3 Problem 1 - Solution Cast(msg)  add msg to pending Periodically do:  k := k+1  ordered := Decide(k, pending)  foreach message m in ordered, deliver m to the application  pending := pending \ ordered K is initialized to zero Pending - a buffer for unordered outgoing messages

4 Problem 1 – Notes What is the problem with the given solution?  Might suffer from starvation How can you overcome the problem given a reliable broadcast module / reliable network?  Now we can broadcast normally (not through the consensus module) and use the consensus only to decide on the ordering  Given that the group is static, if communication is reliable than there is no problem anyway

5 Casual Ordering Reminder Two events a, b are part of the happens before relation, denoted a → b, if:  a occurred before b in the same node  a is a send of a message m and b is the receive of the same message m  There exists an event c such that a → c and c → b An execution obeys casual ordering if every two messages m1, m2 and their corresponding send and receive operations snd1, snd2, rcv1, rcv2 satisfy:  If snd1→snd2 then rcv1→rcv2

6 Problem 2 In the lecture you have seen a vector timestamp protocol for casual ordering broadcast  Why is the protocol not suitable for point to point communication? Describe a protocol that implements casual ordering point to point communication

7 Problem 2 - Solution Each process p Maintains a matrix timestamp M When p i wishes to send a message to p j it increments M i [i, j] and attaches M i to the message When a process p j receives a message from p i attached with a matrix M j  If for each k≠j M j [j,k]≤ M i [j,k] and M j [i,j]≤ M i [i,j] + 1 Deliver the message Update M i [j,k] = MAX(M i [j,k], M j [j,k]) Check if any other buffered message is now deliverable  Else, buffer the message There are no floating messages from any p k that needed to be accounted for There are no floating messages from p j

8 Observation  Every two message sent from the same source to the same target will be delivered in the order they were sent  The only way to increment M[i, j] is for p j to receive a message from p i Lemma 1 (safety – casual ordering)  If send m ij happens before send m kj then m ij is delivered before m kj Lemma 2 (liveness)  Every message sent from p i to p j is eventually delivered by p j The protocol Implements casual ordering Problem 2 – Solution Correctness


Download ppt "Exam Like Problems. Problem 1 You are given a software module which implements consensus between a static group of servers in an unreliable network. The."

Similar presentations


Ads by Google