1. Home
  2. Explore
  3. Computer Science
  4. Distributed Systems Consensus

Study methods

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

Distributed Systems Consensus

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

What is the fundamental goal of consensus in a distributed system?

85 questions

  1. 1

    What is the fundamental goal of consensus in a distributed system?

    Model answer

    Consensus ensures that multiple processes agree on one value from among several proposed values. The chosen value becomes the shared source of truth for that decision.

    Explanation

    Agreement prevents different machines from using conflicting results for the same operation or piece of data.

  2. 2

    Why is consensus important in a distributed online game?

    Model answer

    Consensus ensures that all servers record the same update for an item or player action. This prevents different servers from showing contradictory game states.

    Explanation

    Without agreement, one server might assign an item to one player while another server assigns it differently.

  3. 3

    How can consensus support shared configuration services?

    Model answer

    Consensus ensures that distributed services agree on the current configuration settings. This prevents different parts of a system from operating under inconsistent or outdated rules.

    Explanation

    Configuration services act as a shared coordination point for applications in large cloud systems.

  4. 4

    What are the three safety requirements of consensus?

    Model answer

    Only proposed values may be chosen, at most one value may be chosen, and a process learns that a value was chosen only if it actually was chosen.

    Explanation

    These requirements prevent fabricated decisions, conflicting decisions, and false reports of agreement.

  5. 5

    What does it mean that only a proposed value may be chosen?

    Model answer

    The system may choose only a value that was submitted by a legitimate proposer. It cannot invent a value independently.

    Explanation

    This prevents unexpected or invalid data from becoming the result of consensus.

  6. 6

    What does the single-value safety requirement prevent?

    Model answer

    It prevents two different values from being chosen for the same consensus decision. Once a value is chosen, it remains the only chosen value for that decision.

    Explanation

    This preserves consistency, such as preventing two different balances or owners from being accepted.

  7. 7

    Why must a process not learn that a value was chosen unless it actually was?

    Model answer

    This prevents a process from acting on a false belief that an operation or transaction was finalized.

    Explanation

    False knowledge of a decision could cause later actions to be based on an outcome that never occurred.

  8. 8

    What are the two liveness requirements described for consensus?

    Model answer

    Eventually some proposed value is chosen, and once a value is chosen, processes eventually learn that value.

    Explanation

    Liveness ensures both that the system makes progress and that its decisions become usable.

  9. 9

    Contrast safety and liveness in a distributed system.

    Model answer

    Safety means the system never makes an incorrect or conflicting decision, whereas liveness means the system eventually makes and communicates a correct decision.

    Explanation

    A system can be safe but fail to make progress, so both properties matter.

  10. 10

    Why does a single central acceptor create a reliability problem?

    Model answer

    The acceptor is a single point of failure. If it crashes or becomes unreachable, no further decisions can be made.

    Explanation

    A centralized decision-maker prevents the system from continuing when that one component fails.

  11. 11

    What distributed-system model does Paxos assume?

    Model answer

    Paxos assumes an asynchronous, non-Byzantine model with arbitrary process speeds, crash failures and restarts, and unreliable message delivery.

    Explanation

    The model focuses on crashes and communication uncertainty rather than malicious behavior.

  12. 12

    What does asynchrony imply about process speeds?

    Model answer

    Processes may run at arbitrary and unpredictable speeds. A process may be fast, slow, or paused for an extended period.

    Explanation

    The system cannot rely on known timing bounds for computation.

  13. 13

    What happens when a process crashes and later restarts in the Paxos model?

    Model answer

    It may lose information that was held only in volatile memory. Information needed for safety must therefore be stored durably.

    Explanation

    A restart can otherwise cause the process to forget promises or accepted proposals.

  14. 14

    Why is stable storage necessary for Paxos?

    Model answer

    Acceptors must preserve critical information across crashes and restarts, especially their promises and accepted proposals.

    Explanation

    Forgetting this information could allow conflicting proposals to be accepted later.

  15. 15

    Give two examples of mechanisms used to provide stable storage.

    Model answer

    Writing data to disk using write-ahead logging or journaling provides stable storage. Persistent memory and durable NVMe storage are other examples.

    Explanation

    These mechanisms preserve important state after power loss or process failure.

  16. 16

    What communication failures are allowed in the asynchronous model?

    Model answer

    Messages may be delayed for an arbitrary amount of time, duplicated, or lost entirely.

    Explanation

    There is no guaranteed upper bound on message delivery time.

  17. 17

    What does non-Byzantine mean in the Paxos model?

    Model answer

    Processes may crash or be slow, and messages may be delayed or lost, but processes do not intentionally lie or behave maliciously, and messages are not corrupted.

    Explanation

    The model assumes benign failures rather than arbitrary or adversarial behavior.

  18. 18

    How do Byzantine faults differ from the faults handled by Paxos?

    Model answer

    Byzantine faults allow nodes to lie or behave arbitrarily, whereas Paxos assumes nodes fail benignly through crashes, pauses, or communication problems.

    Explanation

    Algorithms such as PBFT are designed for malicious or arbitrary faults.

  19. 19

    What is the role of a proposer?

    Model answer

    A proposer introduces a value that it wants the system to choose and initiates the proposal process.

    Explanation

    Proposers generate candidate values such as commands or state updates.

  20. 20

    What is the role of an acceptor?

    Model answer

    Acceptors respond to proposals and accept them while enforcing the rules that preserve agreement and consistency.

    Explanation

    Acceptors function as the voting component of Paxos.

  21. 21

    What is the role of a learner?

    Model answer

    A learner determines which proposal was chosen and uses that information to update its state or take action.

    Explanation

    Learners need not decide the value; they learn the result after acceptors reach agreement.

  22. 22

    Can one physical machine perform multiple Paxos roles?

    Model answer

    Yes. Proposer, acceptor, and learner are logical roles, and one physical computer may perform all three.

    Explanation

    The roles separate responsibilities conceptually rather than requiring separate hardware.

  23. 23

    When is a value considered chosen in majority-based Paxos?

    Model answer

    A proposal is chosen when a majority of the acceptors have accepted that specific proposal.

    Explanation

    Using a group of acceptors avoids dependence on a single machine.

  24. 24

    Why does Paxos use a majority rather than requiring every acceptor?

    Model answer

    Any two majorities overlap in at least one acceptor. This overlap allows the system to preserve safety while tolerating failures.

    Explanation

    Requiring every acceptor would make progress impossible whenever even one acceptor was unavailable.

  25. 25

    Explain why two different values cannot both be chosen if acceptors accept at most one value.

    Model answer

    Two chosen values would each require a majority, and the two majorities must overlap. The shared acceptor would have to accept both values, which is prohibited.

    Explanation

    Majority intersection combined with the one-value acceptance rule guarantees uniqueness.

  26. 26

    Why does the naive rule of accepting the first proposal fail with multiple proposers?

    Model answer

    Competing proposals can divide acceptors so that neither proposal receives a majority. The system remains safe but makes no progress.

    Explanation

    Unpredictable message timing can produce a split vote or hung-jury situation.

  27. 27

    Why must Paxos identify proposals by numbers as well as values?

    Model answer

    Proposal numbers distinguish different attempts or rounds, allowing an acceptor to accept multiple proposals over time without confusing them.

    Explanation

    The safety rule applies to a specific proposal and its number, not simply to an isolated value.

  28. 28

    What properties must Paxos proposal numbers have?

    Model answer

    Each proposal number must be unique and must be a natural, strictly increasing number for successive proposals.

    Explanation

    Ordering proposal numbers lets acceptors identify newer attempts and reject obsolete ones.

  29. 29

    What does it mean for a specific proposal to be chosen?

    Model answer

    A proposal consisting of a unique number and a value is chosen when that exact proposal has been accepted by a majority of acceptors.

    Explanation

    The chosen object is the numbered proposal-value pair, although its value is the result of consensus.

  30. 30

    State the purpose of property P2.

    Model answer

    P2 states that if a proposal with value V is chosen, every higher-numbered proposal that is chosen must also have value V.

    Explanation

    This prevents the system from changing the chosen value in a later round.

  31. 31

    How does P2A strengthen P2?

    Model answer

    P2A requires every higher-numbered proposal accepted by any acceptor, not merely every higher-numbered chosen proposal, to carry the already chosen value.

    Explanation

    It applies the consistency requirement before a later proposal gains a majority.

  32. 32

    Why is P2A still insufficient by itself?

    Model answer

    A proposer that does not know a value was chosen might still issue a conflicting higher-numbered proposal before acceptors can prevent it.

    Explanation

    P2A specifies what must happen after issuance but does not stop proposers from creating conflicting proposals.

  33. 33

    What does P2B require?

    Model answer

    If a proposal with value V is chosen, every higher-numbered proposal issued by any proposer must also have value V.

    Explanation

    P2B moves the safety constraint to the point where proposals are issued.

  34. 34

    What is the purpose of P2C?

    Model answer

    P2C provides a practical condition that proposers must satisfy before issuing a proposal, thereby ensuring the stronger safety property P2B.

    Explanation

    It forces a proposer to consult a majority and preserve any relevant earlier value.

  35. 35

    Describe the two alternatives in P2C.

    Model answer

    A majority set must either contain no acceptor that accepted a proposal numbered below N, or the new proposal must use the value of the highest-numbered earlier proposal accepted by that set.

    Explanation

    The first condition permits a new value; the second propagates an existing value.

  36. 36

    When may a proposer choose its own value under P2C?

    Model answer

    It may choose its own value when none of the acceptors in the selected majority has accepted a proposal with a number lower than the new proposal number.

    Explanation

    This indicates that the majority has no relevant prior accepted value to preserve.

  37. 37

    When must a proposer adopt an earlier value under P2C?

    Model answer

    If any acceptor in the majority has accepted an earlier proposal, the proposer must use the value associated with the highest-numbered such proposal.

    Explanation

    Adopting the latest accepted value prevents a potentially chosen value from being replaced.

  38. 38

    How does P2C prevent a partially accepted value from being overwritten?

    Model answer

    A later proposer queries a majority and is forced to carry forward the value from the highest-numbered proposal previously accepted within that majority.

    Explanation

    This preserves values that may already be on their way to becoming chosen.

  39. 39

    What are the two phases of the Paxos algorithm?

    Model answer

    The phases are prepare, which gathers promises and previously accepted values, and accept, which asks acceptors to accept the selected proposal.

    Explanation

    The two phases implement the information-gathering and future-control requirements of P2C.

  40. 40

    What does a proposer do at the start of the prepare phase?

    Model answer

    It selects a new proposal number higher than any number it previously used for that consensus instance and sends a prepare request to a majority of acceptors.

    Explanation

    A higher number allows the proposer to establish a new round.

  41. 41

    What does an acceptor do when it receives a prepare request with a sufficiently high number?

    Model answer

    It updates and durably records its maximum promised number, promises not to accept lower-numbered proposals, and reports its highest-numbered previously accepted proposal, if any.

    Explanation

    The response both blocks older proposals and supplies the history needed by the proposer.

  42. 42

    What happens when an acceptor receives a prepare request that is not higher than its existing promise?

    Model answer

    The acceptor ignores the request and does not respond.

    Explanation

    Responding positively could violate its earlier promise to reject lower-numbered proposals.

  43. 43

    Why must the acceptor's promise be saved in stable storage?

    Model answer

    The promise must survive a crash and restart so that the acceptor does not later accept an obsolete lower-numbered proposal.

    Explanation

    Durability prevents a restart from weakening the safety guarantees.

  44. 44

    What does a proposer do after receiving prepare responses from a majority?

    Model answer

    It selects the value to propose based on the reported history and then sends an accept request containing the new proposal number and selected value to those acceptors.

    Explanation

    A majority of promises gives the proposer permission to enter phase two.

  45. 45

    How does the proposer select a value when prepare responses report earlier accepted proposals?

    Model answer

    It must use the value associated with the highest-numbered accepted proposal reported in the responses.

    Explanation

    This is the operational form of the value-preservation rule in P2C.

  46. 46

    How does the proposer select a value when no prepare response reports an earlier accepted proposal?

    Model answer

    It may use its own originally intended value.

    Explanation

    With no relevant prior accepted value, the proposer is free to introduce a new value.

  47. 47

    When does an acceptor accept an accept request?

    Model answer

    It accepts the proposal if its proposal number is greater than or equal to the acceptor's current maximum promised number.

    Explanation

    Equality is allowed because the promise rejects only numbers lower than the promised number.

  48. 48

    Why must an acceptor reject an accept request with a number lower than its current promise?

    Model answer

    A higher prepare request may have established a newer promise, so accepting the lower-numbered proposal would violate that promise.

    Explanation

    The check prevents an earlier proposal from succeeding after a later round has begun.

  49. 49

    What does an acceptor record after accepting a proposal?

    Model answer

    It durably records the proposal number and value as its highest accepted proposal and sends an accepted message to the proposer and potentially to learners.

    Explanation

    The durable record allows the acceptor to recover its voting history after failure.

  50. 50

    When does the proposer know that a value has been chosen?

    Model answer

    It knows the value is chosen when the same numbered proposal has been accepted by a majority of acceptors.

    Explanation

    A majority acceptance is the definition of being chosen in Paxos.

  51. 51

    Why may proposers avoid stable storage for safety?

    Model answer

    A proposer may forget a failed proposal attempt and abandon its proposal number, provided that any later attempt uses a new, higher number.

    Explanation

    Acceptors, rather than proposers, maintain the durable promises and accepted values needed for safety.

  52. 52

    What is the simplest method for learners to discover a chosen value?

    Model answer

    Each acceptor sends an accepted message to every learner, and a learner concludes that the value was chosen after observing the same proposal accepted by a majority.

    Explanation

    This method is direct and fast but can generate many messages.

  53. 53

    What is the communication disadvantage of having every acceptor notify every learner?

    Model answer

    The number of messages can grow approximately with the product of the number of acceptors and learners, creating substantial communication overhead.

    Explanation

    Frequent consensus decisions can make direct broadcasting a bottleneck.

  54. 54

    How does a distinguished learner reduce communication overhead?

    Model answer

    Acceptors send accepted messages to one distinguished learner, which determines when a majority has accepted a proposal and informs the other learners.

    Explanation

    This changes communication from broad acceptor-to-learner broadcasting to a funnel-and-notify pattern.

  55. 55

    What is the main trade-off of using one distinguished learner?

    Model answer

    Communication is reduced, but the distinguished learner becomes a potential bottleneck and a single point of failure for learning.

    Explanation

    If it crashes or becomes slow, other learners may not learn the chosen value promptly.

  56. 56

    Why might a system use several distinguished learners instead of one?

    Model answer

    A small group of distinguished learners improves reliability while retaining much of the communication savings of the single-distinguished-learner approach.

    Explanation

    Multiple learners reduce dependence on one component without requiring every acceptor to contact every learner.

  57. 57

    How can a learner recover if it suspects a value was chosen but never learned it?

    Model answer

    It can query acceptors or initiate a new Paxos round with a sufficiently high proposal number.

    Explanation

    A new round either recovers the previously chosen value through P2C or chooses a value if none was chosen.

  58. 58

    What is a deadlock?

    Model answer

    A deadlock occurs when processes stop and no progress is made.

    Explanation

    The processes are unable to continue their work toward a decision.

  59. 59

    What is a livelock?

    Model answer

    A livelock occurs when processes remain active and exchange messages but repeatedly prevent one another from making forward progress.

    Explanation

    Unlike deadlock, the system is busy rather than completely stopped.

  60. 60

    How can competing proposers create livelock in Paxos?

    Model answer

    Each proposer can complete phase one with a higher number just before another proposer completes phase two, causing the earlier accept request to be rejected repeatedly.

    Explanation

    The proposers continually preempt one another without allowing any proposal to receive a majority.

  61. 61

    What does the FLP impossibility result state?

    Model answer

    In a purely asynchronous system with crash failures, no deterministic consensus algorithm can guarantee both safety and termination if even one process may fail.

    Explanation

    The result shows why perfect safety and guaranteed progress cannot both be obtained under those assumptions.

  62. 62

    What must a system add to obtain guaranteed progress despite the FLP result?

    Model answer

    It must add something outside the purely asynchronous model, such as randomness or real-time assumptions through timeouts.

    Explanation

    These mechanisms break the uncertainty or symmetry that can sustain livelock.

  63. 63

    How does a distinguished proposer or leader improve liveness?

    Model answer

    A stable leader prevents multiple proposers from competing and repeatedly preempting one another, allowing proposals to complete.

    Explanation

    If the leader can communicate with a majority and uses increasing numbers, it can eventually succeed.

  64. 64

    Why is leader election not required for Paxos safety?

    Model answer

    Paxos safety holds even if leader election fails, multiple processes temporarily believe they are leaders, or leaders repeatedly crash.

    Explanation

    Faulty leadership may cause livelock or halted progress, but it cannot cause two different values to be chosen.

  65. 65

    What is state machine replication?

    Model answer

    State machine replication runs the same deterministic state machine on multiple servers and ensures that all replicas execute the same commands in the same order.

    Explanation

    Replicas then produce identical states and outputs while tolerating failures.

  66. 66

    What property must a replicated state machine have?

    Model answer

    It must be deterministic: the same initial state and same ordered sequence of commands must produce the same states and outputs.

    Explanation

    Determinism allows replicas to remain identical when their input histories match.

  67. 67

    Why must replicas execute commands in the same order?

    Model answer

    Different command orders can produce different final states even when the same commands are executed.

    Explanation

    For example, applying an update before a withdrawal may differ from applying the withdrawal first.

  68. 68

    How is Paxos used to implement state machine replication?

    Model answer

    A separate Paxos instance chooses the command for each position, or slot, in an ordered command sequence.

    Explanation

    Repeated single-value decisions form a fault-tolerant log.

  69. 69

    What does each Paxos instance represent in a replicated log?

    Model answer

    Each instance represents one slot in the command sequence and chooses the single command that all replicas should execute in that slot.

    Explanation

    Separate instances decide slot one, slot two, slot three, and so on.

  70. 70

    What roles does a replica commonly perform in a replicated state machine system?

    Model answer

    Each replica can act as a proposer, acceptor, and learner for each Paxos instance.

    Explanation

    Combining the roles on each server supports a fully distributed implementation.

  71. 71

    How does a leader normally process a client command in a replicated state machine?

    Model answer

    The leader assigns the command to the next log slot and uses the Paxos instance for that slot to get the command chosen.

    Explanation

    The leader commonly acts as the proposer for successive command slots.

  72. 72

    When may a replica execute a command learned for a log slot?

    Model answer

    It executes the command after learning the chosen value for that slot and processing all preceding slots.

    Explanation

    This preserves the required contiguous order of operations.

  73. 73

    Why do replicas maintain identical states in this approach?

    Model answer

    They start from the same state machine state and execute the same deterministic commands in the same order.

    Explanation

    Identical ordered inputs produce identical state transitions and outputs.

  74. 74

    How does a new leader repair gaps in a replicated log?

    Model answer

    It runs phase one for each missing slot, recovers any previously accepted command, and fills slots with a no-op when no prior command exists.

    Explanation

    The repair process creates the contiguous sequence required by the state machine.

  75. 75

    Why must a new leader preserve a command discovered during phase one for a missing slot?

    Model answer

    P2C requires the leader to propose the previously accepted value when the phase-one responses reveal one.

    Explanation

    This prevents the leader from overwriting a command that may already be close to being chosen.

  76. 76

    What is the purpose of a no-op command in a replicated log?

    Model answer

    A no-op fills a slot for which no earlier command was accepted without changing the state machine's state.

    Explanation

    It makes the log contiguous so later commands can be executed in order.

  77. 77

    Why can a stable leader often skip phase one for ordinary new commands?

    Model answer

    The leader may already have standing promises from acceptors for future slots, allowing it to send phase-two accept requests directly.

    Explanation

    In the normal case, consensus can require only one message round trip.

  78. 78

    What is the practical communication cost of the normal stable-leader case?

    Model answer

    The leader can often send an accept request and receive responses from a majority in a single phase-two round trip.

    Explanation

    This is considered essentially optimal for fault-tolerant agreement under the model.

  79. 79

    What happens to a replicated system if leader election fails and no server acts as leader?

    Model answer

    No new commands are proposed, so progress stops, but the system remains safe and consistent.

    Explanation

    The absence of a leader affects liveness rather than the safety guarantees of Paxos.

  80. 80

    What happens if multiple servers incorrectly believe they are leaders?

    Model answer

    They may propose competing commands and cause livelock, but Paxos prevents two different commands from being chosen for the same slot.

    Explanation

    Multiple leaders can halt progress without violating the single-value safety property.

  81. 81

    How can Paxos change the membership of its own server group?

    Model answer

    The system proposes a configuration-change command, such as adding or removing a server, as part of the replicated state machine log.

    Explanation

    The consensus mechanism is used to agree on changes to the group that performs consensus.

  82. 82

    What happens after a configuration-change command is chosen?

    Model answer

    All replicas execute the command and update their membership view; subsequent consensus decisions may use the new acceptor set.

    Explanation

    This allows the system to manage its own evolution through agreed log entries.

  83. 83

    What foundational techniques does Paxos illustrate for building reliable distributed infrastructure?

    Model answer

    It illustrates majority intersection for fault tolerance, phased commits for uncertainty, proactive promises for safety, and stable storage for durable state.

    Explanation

    Together, these techniques turn unreliable components into a system with provable agreement properties.

  84. 84

    How do Paxos and leader election divide responsibility?

    Model answer

    Paxos itself provides safety, while leader election, timeouts, or similar mechanisms improve liveness by reducing proposer competition.

    Explanation

    The consensus algorithm remains correct even when the mechanism used to select a leader is imperfect.

  85. 85

    What broader systems can be built from Paxos-style consensus?

    Model answer

    Paxos-style techniques support replicated databases, distributed file systems, coordination services, cloud infrastructure, and some blockchain-related systems.

    Explanation

    Repeated consensus decisions provide a foundation for reliable distributed services.

1 of 85
Question 1 of 85

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent