PAXOS Made Simple Karthik and Steve Managing Concurrency

  • Slides: 10
Download presentation
PAXOS Made Simple Karthik and Steve

PAXOS Made Simple Karthik and Steve

Managing Concurrency • Locks: Mechanism to manage concurrency • Mutex/Semaphores • Managed by the

Managing Concurrency • Locks: Mechanism to manage concurrency • Mutex/Semaphores • Managed by the system • Distributed System • Central server to manage locks • Failure

Consensus Problem How can you reach consensus in a distributed system while tolerating non-malicious

Consensus Problem How can you reach consensus in a distributed system while tolerating non-malicious failures? Requirements • Safety • Only a value that has been proposed can be chosen • Only a single value is chosen • A process never learns that a value has been chosen unless it actually has been • Liveness • Some proposed value is eventually chosen • If a value is chosen, all processes eventually learn its value

Definitions Agent roles • Proposers, Acceptors, and Learners • A process can be one

Definitions Agent roles • Proposers, Acceptors, and Learners • A process can be one or more agents Assumptions • Agents operate at arbitrary speed, may fail by stopping, and may restart. Only requirement is agents remember some information when they restart • Messages can take arbitrarily long to be delivered, can be duplicated, and can be lost, but not corrupted • A proposed value is chosen if a majority of the set of acceptors accept that value • Multiple proposals may be chosen

PAXOS: P 1: An acceptor must accept the first proposal it receives P 2:

PAXOS: P 1: An acceptor must accept the first proposal it receives P 2: If a proposal with value v is chosen, then every highernumbered proposal chosen should have value v P 2 a: If a proposal with value v is chosen, then every highernumbered proposal accepted by any acceptor has value v P 2 b: If a proposal with value v is chosen, then every highernumbered proposal issued by any proposer has value v P 2 c: For any v and n, if a proposal with value v and number n is issued, then there is a set S consisting of a majority of acceptors such that either (a) no acceptor in S has accepted any proposal numbered less than n, or (b) v is the value of the highest-numbered proposal among all proposals numbered less than n accepted by the acceptors in S

PAXOS Algorithm: Phase I (Prepare) • A Proposer selects a proposal number n and

PAXOS Algorithm: Phase I (Prepare) • A Proposer selects a proposal number n and sends a prepare request with number n to majority of acceptors • If acceptor receives the prepare request with number n greater than that of any prepare request it saw, it responds with a YES to that request with a promise not to accept any proposals numbered less than n and include the highest-numbered proposal (if any) that it accepted

PAXOS Algorithm: Phase II (Accept) • If the proposer receives a response YES to

PAXOS Algorithm: Phase II (Accept) • If the proposer receives a response YES to its prepare requests from a majority of acceptors, it sends an accept request to each of those acceptors for a proposal numbered n with value v which is the value of the highest-numbered proposal among the responses • If an acceptor receives an accept request for a proposal numbered n, it accepts the proposal unless it has already responded to a prepare request having a number greater than n • A value is chosen at proposal number n iff a majority of acceptors accept that proposal in Phase II

Acceptor • Can ignore any requests without compromising safety • Can always respond to

Acceptor • Can ignore any requests without compromising safety • Can always respond to a prepare request • Can respond to an accept request if • An acceptor can accept a proposal numbered n iff it has not responded to a prepare request having a number greater than n

Learner • Each acceptor responds to all learners when it accepts a proposal •

Learner • Each acceptor responds to all learners when it accepts a proposal • Non-byzantine systems could have a distinguished learner that informs all other learners • Distinguished learner failure: use a set of distinguished learners

Liveness • Oscillations with two proposers • Choose one distinguished proposer • Electing a

Liveness • Oscillations with two proposers • Choose one distinguished proposer • Electing a distinguished proposer could be done using real -time or randomness