A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Paxos Consensus Algorithm

Research Depth 95 in the knowledge graph I know this Set as goal
6topics build on this
410prerequisites beneath it
See this on the map →
The Consensus ProblemFLP Impossibility Theorem+2 moreRaft Consensus AlgorithmState Machine Replication
paxos consensus fault-tolerance

Core Idea

Paxos is a consensus algorithm tolerating crash failures in asynchronous systems through multiple rounds: proposers prepare proposals with increasing ballot numbers, acceptors promise not to accept lower-numbered proposals, and learners track accepted values. A value is decided when a majority of acceptors accepts it, ensuring agreement and termination under normal conditions.

How It's Best Learned

Implement single-decree Paxos from scratch, tracing through scenarios with message loss and node crashes.

Common Misconceptions

Paxos requires synchrony; Paxos is simple to implement; Paxos provides strong leader guarantees.

Explainer

You already know from the consensus problem that getting distributed nodes to agree on a single value is deceptively hard — any protocol must handle crashes, message loss, and reordering. Paxos solves this by splitting nodes into three roles: proposers (who suggest values), acceptors (who vote on proposals), and learners (who observe the outcome). A single node can play multiple roles, but the separation clarifies the protocol's logic. The key insight is that agreement emerges not from a single round of voting, but from a two-phase protocol that prevents conflicting decisions even when messages are lost or delayed.

In Phase 1 (Prepare), a proposer picks a unique, monotonically increasing ballot number and sends a Prepare(n) message to a majority of acceptors. Each acceptor compares n to the highest ballot it has seen. If n is higher, the acceptor promises not to accept any proposal with a lower ballot number and replies with whatever value it has already accepted (if any). Think of this like calling ahead to reserve a meeting slot — you are not yet proposing an agenda, just securing the right to propose one. If a majority of acceptors respond with promises, the proposer knows it has a "lock" that no lower-numbered proposal can break.

In Phase 2 (Accept), the proposer sends an Accept(n, v) message to the same majority, where v is either the value from the highest-numbered previously accepted proposal (if any acceptor reported one) or the proposer's own chosen value. This constraint is the heart of Paxos's safety: if a value was already accepted by some majority in an earlier round, every future proposer will discover it during Phase 1 and re-propose it, ensuring the system converges rather than oscillating. An acceptor accepts the proposal if it has not since promised a higher ballot number. Once a majority of acceptors accept, the value is decided and learners can be notified.

The elegance of Paxos is that safety — no two nodes decide different values — holds regardless of timing, crashes, or message loss. However, liveness (eventually deciding) requires that proposers do not endlessly compete with increasing ballot numbers, each invalidating the other's Phase 1. In practice, systems use a distinguished proposer (leader) to avoid dueling proposals, but this is an optimization, not a requirement of the protocol. Understanding this distinction matters: Paxos the algorithm guarantees safety always and progress eventually, while real implementations layer leader election on top to make progress practical. The leap from single-decree Paxos (agreeing on one value) to Multi-Paxos (agreeing on a sequence of values for state machine replication) is where the protocol moves from elegant theory to complex engineering.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockLogical Clocks and Event OrderingPaxos Consensus Algorithm

Longest path: 96 steps · 410 total prerequisite topics

Prerequisites (4)

Leads To (2)