Coordination and Agreement 1 Failure model z Assumptions

  • Slides: 25
Download presentation
Coordination and Agreement 1

Coordination and Agreement 1

Failure model z Assumptions: Independent processes, reliable channels, no Byzantine errors. z Failure detector:

Failure model z Assumptions: Independent processes, reliable channels, no Byzantine errors. z Failure detector: y. May be unreliable (yield “Unsupected” or “Suspected”). y. May be reliable (yield “Unsuspected” or “Failed”). 3

Distributed mutual exclusion z Situation: A number of processes want to access some shared

Distributed mutual exclusion z Situation: A number of processes want to access some shared resource. z Problem: Prevent interference, maintain consistency; critical section. z Examples: y. Shared files. y. Car park monitoring. 4

Distributed mutual exclusion – central server algorithm 5

Distributed mutual exclusion – central server algorithm 5

Distributed mutual exclusion – ring-based algorithm 6

Distributed mutual exclusion – ring-based algorithm 6

Distributed mutual exclusion – time-stamp based algorithm On initialization state : = RELEASED; To

Distributed mutual exclusion – time-stamp based algorithm On initialization state : = RELEASED; To enter the section state : = WANTED; Multicast request to all processes; request processing deferred here T : = request’s timestamp; Wait until (number of replies received = (N – 1)); state : = HELD; On receipt of a request <Ti, pi> at pj (i ≠ j) if (state = HELD or (state = WANTED and (T, pj) < (Ti, pi))) then queue request from pi without replying; else reply immediately to pi; end if To exit the critical section state : = RELEASED; reply to any queued requests; 7

Distributed mutual exclusion – time-stamp based algorithm example 41 p 3 Reply 1 34

Distributed mutual exclusion – time-stamp based algorithm example 41 p 3 Reply 1 34 Reply 41 34 p Reply 34 2 8

Maekawa’s voting algorithm -Candidate ? ? -Candidate – must collect Sufficient votes to enter

Maekawa’s voting algorithm -Candidate ? ? -Candidate – must collect Sufficient votes to enter - Casting their votes to only one Candidate. 9

10

10

Elections z Situation: A unique process to play a particular role among a set

Elections z Situation: A unique process to play a particular role among a set of processes must be chosen. z Problem: All processes must agree on the choice. z Examples: y. Central server algorithm for mutual exclusion. y. Coordinator process in Berkeley algorithm for internal clock synchronization. 11

Elections – basics z Protocol: y A process may call an election. y Any

Elections – basics z Protocol: y A process may call an election. y Any process is either participant or non-participant in an election. y The elected process should be chosen as the one with largest identifier. z Correctness criteria: y Safety. y Liveness. z Performance measures: y Bandwidth. y Turn-around time. 12

Elections – ring-based election algorithm z N processes arranged in a ring; a coordinator

Elections – ring-based election algorithm z N processes arranged in a ring; a coordinator must be elected; no failures occur. z Initially, each process is non-participant. z Some process pi sends an election message, elctn(i). z When a process pr receives a message elctn(i): y If r<i then forward elctn(i); participant(pr) : = true; endif; y If (r>i and not(participant(pr))) then x forward (elctn(r)); participant(pr) : = true; endif; y If (r>i and participant(pr)) then skip (* do not forward *); endif; y If r=i then participant(pr) : = false; send(elctd(r)); endif; z When a process pr receives an elected message, elctd(c): y participant(pr) : = false; elected(r) : = c; y if r=c then skip (* do not forward *) else forward (elctd(c)); endif; 13

Elections – ring-based election algorithm example Note: The election was started by process 17.

Elections – ring-based election algorithm example Note: The election was started by process 17. The highest process identifier encountered so far is 24. Participant processes are shown darkened 14

Elections – bully election algorithm example 15

Elections – bully election algorithm example 15

Multicast communication z The aim is for each of a group of processes to

Multicast communication z The aim is for each of a group of processes to receive copies of the messages sent to the group. z A process issues only one multicast operation to send a message to a group of processes instead of issuing multiple send operations. z Multicast operations may provide: y. Delivery guarantees. y. Efficiency. 16

Multicast communication – basics z Failure model: Reliable channels, processes may crash. z Processes

Multicast communication – basics z Failure model: Reliable channels, processes may crash. z Processes are member of groups (open or closed). z Operations: ymulticast(g, m). ydeliver(m). 17

Multicast communication – basic multicast z B-multicast based on a reliable one-to-one send operation:

Multicast communication – basic multicast z B-multicast based on a reliable one-to-one send operation: y. To B-multicast(g, m), for each p in g, send(p, m). y. On receive(m) at p, B-deliver(m) at p. z May be implemented using threads to perform the send operations concurrently. z May suffer from the ack-implosion problem. 18

Multicast communication – reliable multicast z Integrity: A correct process p delivers a message

Multicast communication – reliable multicast z Integrity: A correct process p delivers a message m at most once. Furthermore p in group(m) and m was supplied to a multicast operation by sender(m). z Validity: If a correct process multicasts message m, then it will eventually deliver m (assumption: closed groups). z Agreement: If a correct process delivers message m, then all other correct processes in group(m) will eventually deliver(m). 19

Multicast communication – reliable multicast algorithm 20

Multicast communication – reliable multicast algorithm 20

Multicast communication – orderings; bulletin board example (self study) Bulletin board: os. interesting Item

Multicast communication – orderings; bulletin board example (self study) Bulletin board: os. interesting Item From Subject 23 A. Hanlon Mach 24 G. Joseph Microkernels 25 A. Hanlon Re: Microkernels 26 T. L’Heureux RPC performance 27 M. Walker Re: Mach end 21

Multicast communication – ordering relations (self study) z FIFO ordering: If a correct process

Multicast communication – ordering relations (self study) z FIFO ordering: If a correct process issues multicast(g, m) and then multicast(g, m’), then every correct process that delivers m’ will deliver m before m’. z Causal ordering: If multicast(g, m) -> multicast(g, m’), then any correct process that delivers m’ will deliver m before m’. z Total ordering: If a correct process delivers m before it delivers m’, then any other correct process that delivers m’ will deliver m before m’. z Hybrid ordering relations exist. 22

Multicast communication – ordering examples (self study) Notice the consistent ordering of totally ordered

Multicast communication – ordering examples (self study) Notice the consistent ordering of totally ordered messages T 1 and T 2, the FIFO-related messages F 1 and F 2 and the causally related messages C 1 and C 3 – and the otherwise arbitrary delivery ordering of messages. 23

Multicast communication – bulletin board example revisited (self study) Bulletin board: os. interesting Item

Multicast communication – bulletin board example revisited (self study) Bulletin board: os. interesting Item From Subject 23 A. Hanlon Mach 24 G. Joseph Microkernels 25 A. Hanlon Re: Microkernels 26 T. L’Heureux RPC performance 27 M. Walker Re: Mach end 24

Summary z Failures and failure detection. z Distributed mutual exclusion: y. Central-server algorithm. y.

Summary z Failures and failure detection. z Distributed mutual exclusion: y. Central-server algorithm. y. Ring-based algorithm. y. Time-stamp based algorithm. z Elections: y. Ring-based algorithm. z Multicast communication y. Basic multicast. y. Reliable multicast. y. Ordering semantics. 25