1. Home
  2. Explore
  3. Computer Science
  4. Paxos Consensus Algorithm

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Paxos Consensus Algorithm

  • 44Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Consensus Foundations

What is Paxos, and what does it mean to describe it as a family of algorithms?

44 questions

  1. 1

    What is Paxos, and what does it mean to describe it as a family of algorithms?

    Model answer

    Paxos is a family of distributed algorithms for reaching consensus; vanilla Paxos is one variant.

    Explanation

    Paxos is a family rather than a single algorithm, and the content focuses on its vanilla variant.

  2. 2

    What does reaching consensus mean in Paxos?

    Model answer

    Consensus is agreement on one result. In Paxos, a proposal is considered chosen when a majority of acceptors accept it.

    Explanation

    Consensus means agreement on one result, not necessarily agreement on each participant's original proposal.

  3. 3

    In the group-decision analogy, why might participants have to change their minds to reach consensus?

    Model answer

    Participants contribute toward choosing a shared result, even if they initially proposed different values; some may need to change their minds.

    Explanation

    Participants may begin with different suggestions, but reaching agreement requires them to converge on one result.

  4. 4

    How does Paxos distinguish reaching consensus from everyone learning the result?

    Model answer

    A majority can reach agreement before everyone knows about it; the result can eventually be learned by everyone.

    Explanation

    Consensus may take time to reach, and the chosen result may take additional time to become known to every participant.

  5. 5

    What communication failure does the content say Paxos must be able to tolerate?

    Model answer

    Messages can be lost, but the algorithm can still reach agreement; participants may not all hear the same proposal initially.

    Explanation

    Paxos is designed to continue working despite unreliable communication, including lost messages.

  6. 6

    Why might a successful service need to move beyond a single computer?

    Model answer

    A single computer cannot be made infinitely powerful or scalable; a heavily used service may need to distribute its work across nodes.

    Explanation

    A single computer has finite resources, so increasing demand eventually requires a distributed approach.

  7. 7

    Compare how proposed writes are coordinated in leader-replicas and peer-to-peer systems.

    Model answer

    A leader-replicas system has one leader order proposals and distribute them, while peer-to-peer nodes have equal roles and coordinate on the next operation.

    Explanation

    In the leader-replicas model, the leader serializes proposed writes and sends them to replicas; in peer-to-peer systems, nodes coordinate as equals.

  8. 8

    Why do both leader-replicas and peer-to-peer systems need consensus?

    Model answer

    Leader-replicas systems need consensus to elect a replacement leader if the current one fails. Peer-to-peer systems need ongoing consensus so operations are applied in the same order.

    Explanation

    The leader-replicas design needs a new leader if its leader fails; peer-to-peer nodes need to coordinate repeatedly to apply operations consistently.

  9. 9

    What are the three Paxos roles, and what does each role do?

    Model answer

    Proposers propose values, acceptors help reach consensus, and learners learn the agreed value.

    Explanation

    Proposers initiate proposals, acceptors participate in choosing a value, and learners find out what was chosen.

  10. 10

    Can one Paxos node perform multiple roles? Explain.

    Model answer

    A single Paxos node can act as proposer, acceptor, and learner, or take any combination of those roles.

    Explanation

    The roles describe functions, not necessarily separate physical machines.

  11. 11

    Why must Paxos nodes know how many acceptors constitute a majority?

    Model answer

    Paxos nodes must know the acceptor majority size because any two majorities overlap in at least one acceptor.

    Explanation

    Any two majorities in the same acceptor set share at least one member, a fact used to prevent conflicting proposals from both succeeding.

  12. 12

    What persistence requirement does vanilla Paxos impose on its nodes?

    Model answer

    Paxos nodes must be persistent and must not forget what they accepted; vanilla Paxos does not handle acceptors forgetting this information.

    Explanation

    Vanilla Paxos relies on acceptors remembering their promises and accepted proposals across failures.

  13. 13

    Why does a system that needs its value to change over time require multiple Paxos runs?

    Model answer

    A Paxos run reaches consensus on only one value. To change that value later, the system must run Paxos again.

    Explanation

    Paxos in this description chooses one value per run; changing the value requires starting another run.

  14. 14

    What is the difference between the value chosen by Paxos and its proposal ID?

    Model answer

    Consensus is on the value, not the proposal ID; the ID is an internal Paxos artifact.

    Explanation

    The proposal identifier coordinates the protocol but is not the result agreed upon by the participants.

  15. 15

    How does the overlap between majorities help Paxos preserve an earlier accepted value?

    Model answer

    Because any two majorities overlap, a later proposer must encounter an acceptor that knows about the earlier accepted value.

    Explanation

    The acceptors' overlapping majorities ensure that a later proposal cannot simply ignore a value already accepted by a majority.

  16. 16

    How does a proposer begin a Paxos attempt, and what happens if it times out?

    Model answer

    A proposer sends PREPARE with a unique ID to a majority or all acceptors. If it times out, it retries with a higher ID.

    Explanation

    The first phase establishes a proposal ID and asks acceptors to promise not to honor lower IDs.

  17. 17

    Why must proposal IDs be unique, and what is one example of assigning them to two proposers?

    Model answer

    Proposal IDs must never be reused. For example, two proposers could use odd and even IDs, respectively.

    Explanation

    Unique IDs let acceptors distinguish proposals and order competing attempts; the content gives interleaved IDs as one possible allocation scheme.

  18. 18

    How does an acceptor respond to a PREPARE message, and what does its promise mean?

    Model answer

    For an eligible PREPARE ID, an acceptor promises to ignore lower IDs and replies with PROMISE. If the ID is already below its promise, it ignores the request.

    Explanation

    An acceptor that makes a promise will not honor lower-numbered requests, while a request below an existing promise is rejected.

  19. 19

    Why can a lower proposal ID not obtain a majority after a higher ID has received a majority of promises?

    Model answer

    Once a majority promises on an ID, a lower ID cannot obtain promises from a majority because the two majorities must overlap.

    Explanation

    A majority promise on a higher ID intersects any competing majority, preventing a lower ID from receiving promises from a majority.

  20. 20

    When does a proposer send an ACCEPT REQUEST, and what does it contain?

    Model answer

    After receiving a majority of PROMISE messages for an ID, the proposer sends ACCEPT REQUEST with that ID and a value.

    Explanation

    The proposer does not proceed to the accept phase until it has received promises from a majority.

  21. 21

    What value may a proposer choose if none of the promises reports a previously accepted value?

    Model answer

    If the promises report no previously accepted value, the proposer may use the value it originally wanted to propose.

    Explanation

    If no acceptor reports an earlier accepted value, there is no earlier value the proposer must preserve.

  22. 22

    How does an acceptor handle an ACCEPT REQUEST?

    Model answer

    An acceptor ignores an ACCEPT REQUEST that its promise requires it to reject. Otherwise, it sends ACCEPT with the ID and value to the proposer and learners.

    Explanation

    The acceptor's promise restricts which requests it may accept; an acceptable request leads it to notify the proposer and learners.

  23. 23

    What event means that consensus has been reached in Paxos?

    Model answer

    Consensus is reached when a majority of acceptors accept the same ID and value; the consensus is on the value.

    Explanation

    The protocol's agreement threshold is a majority of acceptors accepting the same value.

  24. 24

    How can a proposer or learner know that a value has been chosen?

    Model answer

    A proposer or learner that receives a majority of ACCEPT messages for a value knows that consensus was reached on that value.

    Explanation

    A proposer or learner can infer that the value was chosen upon receiving enough ACCEPT messages, even though the ID itself is not the chosen result.

  25. 25

    Describe the three sequential milestones in a Paxos run.

    Model answer

    First, a majority promises on an ID; second, a majority accepts an ID and value; third, a proposer or learner receives a majority of ACCEPT messages and learns the chosen value.

    Explanation

    The three milestones are promise by a majority, acceptance by a majority, and a proposer or learner learning of that majority acceptance.

  26. 26

    What happens when a proposer sends a lower-ID PREPARE after a majority has promised on a higher ID?

    Model answer

    The lower-ID proposer cannot get a majority of promises, because a majority has already promised on the higher ID. It must time out and retry with a higher ID.

    Explanation

    The promise phase can block a lower ID even if a proposer receives an isolated promise from another acceptor.

  27. 27

    How must a proposer choose a value when its promises report previously accepted proposals?

    Model answer

    If any promise reports an accepted value, the proposer must use the value associated with the highest accepted ID it received.

    Explanation

    A proposer receiving a higher-ID promise must preserve the most recently accepted value reported by the promises.

  28. 28

    If a proposer using ID 6 learns from its promises that ID 5 accepted 'cat,' what must it put in its ACCEPT REQUEST?

    Model answer

    It sends an ACCEPT REQUEST with its new ID and the value attached to the highest accepted ID reported in the promises.

    Explanation

    A proposer may use a new ID to continue the protocol, but it carries forward the value required by the earlier acceptance.

  29. 29

    How can message latency affect competing proposals without allowing a lower-ID proposal to defeat a higher-ID majority?

    Model answer

    A lower-ID proposer might receive an isolated promise because messages arrive in different orders, but it cannot obtain a majority once a higher ID has a majority.

    Explanation

    The arrival order of messages can vary with network latency, but the majority-promise rule still prevents a lower ID from succeeding.

  30. 30

    How can a higher-ID proposal interfere with a lower-ID proposal that has already received a majority of promises?

    Model answer

    A higher-ID proposal can obtain a majority of promises after a lower-ID proposal does, preventing the lower-ID request from being accepted by a majority.

    Explanation

    Two proposers may each obtain promises at different moments, causing one proposal to be preempted before it can be accepted.

  31. 31

    Why can several concurrent proposals stall a Paxos run?

    Model answer

    Competing proposals can repeatedly supersede one another, creating contention or hotspots that may stall the Paxos run.

    Explanation

    Repeatedly raising proposal IDs can cause proposers to preempt one another instead of allowing one attempt to finish.

  32. 32

    How can exponential backoff help resolve contention between Paxos proposers?

    Model answer

    Exponential backoff makes proposers wait progressively longer after contention, giving one proposal time to complete.

    Explanation

    The delay reduces the chance that proposers will continually preempt one another and can give one attempt time to finish.

  33. 33

    After a majority has promised on a higher ID, why can a lower-ID ACCEPT REQUEST not win?

    Model answer

    No lower-ID request can be accepted by a majority after a higher ID has secured a majority of promises.

    Explanation

    Once a higher ID has reached a majority of promises, a lower ID cannot obtain a majority of acceptances because it cannot obtain the required majority of promises.

  34. 34

    Why can a higher-ID proposal still succeed after a value has been accepted by a majority, and what value must it use?

    Model answer

    A higher-ID proposal can be accepted only with the value required by the highest accepted ID reported in its promises; therefore, later IDs preserve the chosen value.

    Explanation

    A later proposer must include an earlier accepted value in its request, so changing the ID does not allow the value to change.

  35. 35

    How can a proposer learn a chosen value if it missed the majority of ACCEPT messages when consensus was first reached?

    Model answer

    A later proposer receives the previously accepted value in a promise and is required to propose it, allowing it to learn the consensus even if it missed the earlier ACCEPT messages.

    Explanation

    A later proposer can encounter an acceptor that reports the earlier acceptance, allowing the proposer to carry that value forward and learn it through the protocol.

  36. 36

    Contrast the point at which Paxos consensus is reached with the point at which a learner knows it was reached.

    Model answer

    A majority of acceptors accepting a value establishes consensus; a proposer or learner learns that fact when it receives a majority of ACCEPT messages.

    Explanation

    The protocol separates the moment acceptors reach agreement from the moment a particular proposer or learner learns about it.

  37. 37

    How does a replicated log let a storage system use Paxos to represent changing data?

    Model answer

    The system stores a sequence of log entries and runs a separate consensus for each position, allowing the overall state to change over time.

    Explanation

    A replicated log gives each changing state a separate consensus position rather than asking one Paxos run to choose multiple successive values.

  38. 38

    What does position 0 of the example bank account's replicated log represent?

    Model answer

    Position 0 stores the initial bank-account state at opening; later changes are recorded at subsequent positions.

    Explanation

    Log position zero represents the account's starting state, and subsequent positions record changes.

  39. 39

    How are the example transfer and withdrawal represented in the log, and what balance follows each?

    Model answer

    A transfer of 50 units in can be recorded at position 1, changing the balance to 150 units; a withdrawal of 20 units can be recorded at position 2, leaving 130 units.

    Explanation

    Each update occupies a new position, so the entries preserve an ordered history of account changes.

  40. 40

    What role do replicas A, B, and C play in the example storage system?

    Model answer

    The account is replicated across replicas A, B, and C, which store the user's balance.

    Explanation

    The example uses replicas in different places so the account data is replicated rather than stored on only one server.

  41. 41

    How does a client interact with the storage system, and what Paxos roles can its server perform?

    Model answer

    The client contacts a storage server to read or propose a write; the server acts as a proposer and can also act as an acceptor and learner.

    Explanation

    The storage server can receive client reads or writes and participate in Paxos itself.

  42. 42

    What happens when a client proposes a withdrawal through a Paxos storage server?

    Model answer

    The server proposes the withdrawal to the acceptors. If a majority accept it, consensus is reached and the value can be written and propagated.

    Explanation

    The proposer sends the write to the acceptors, and acceptance by a majority is enough to establish consensus.

  43. 43

    How can a lagging replica learn a log value that it did not write at first?

    Model answer

    It can catch up through a recovery mechanism or learn the missing value during a later proposal when the accepted value is reported and carried forward.

    Explanation

    A replica that did not write an entry immediately can later discover it through a catch-up mechanism or during a later proposal.

  44. 44

    Why does the replicated-log design fit Paxos better than trying to mutate a single consensus value?

    Model answer

    Each log position has its own consensus, so a new position can record a change without requiring one Paxos run to agree on multiple values.

    Explanation

    Paxos reaches consensus for one log position at a time, while the sequence of positions collectively represents the evolving account state.

1 of 44
Question 1 of 44

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent