Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Introduction
  2. The aim of these two lab sessions was to learn the Paxos algorithm for gaining consensus in a distributed system. We had to have a general view of how the algorithm works and after filling some missing pieces we had to make it work in Erlang.
  3.  
  4. Main issues and solutions
  5.  
  6. Paxos algorithm wasn’t so easy to understand. Anyway, after running the code, doing some tests with it and discussing with others I think I have a general idea of how Paxos work.
  7.  
  8. How Paxos work:
  9.  
  10. Processes are classified as proposers, acceptors (there are even the learners, but we won’t consider them in our implementation). A proposer attempts to ratify a proposed decision value by collecting acceptances from a majority of the acceptors. An acceptor responds to this with a promise never to accept any proposal with a number less than n together with the highest-numbered proposal that the acceptor has accepted (so that the proposer can substitute this value for its own, in case the previous value was in fact ratified). If the proposer receives a response from a majority of the acceptors, the proposer then does a second phase of voting where it sends an accept(n, v) to all acceptors and wins if receives a majority of votes.
  11.  
  12. So for each proposal, the algorithm proceeds as follows:
  13. 1. The proposer sends a message prepare(n) to all acceptors.
  14. 2. Each acceptor compares n to the highest-numbered proposal for which it has responded to a prepare message. If n is greater, it responds with ack(n, v, nv) where v is the highest-numbered proposal it has accepted and nv is the number of that proposal.
  15. 3. The proposer waits to receive ack from a majority of acceptors. If any ack contained a value, it sets v to the most recent (in proposal number ordering) value that it received. It then sends accept(n, v) to all acceptors
  16. 4. Upon receiving accept(n, v), an acceptor accepts v unless it has already received prepare(n') for some n' > n. If a majority of acceptors accept the value of a given proposal, that value becomes the decision value of the protocol.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement