Download presentation

Presentation is loading. Please wait.

Published byCamron Longyear Modified over 2 years ago

1
Prof. Jennifer Welch 1

2
FIFO Queue Example 2 Sequential specification of a FIFO queue: operation with invocation enq(x) and response ack operation with invocation deq and response return(x) a sequence of operations is allowable iff each deq returns the oldest enqueued value that has not yet been dequeued (returns if queue is empty) For the current discussion, assume that a given implementation of a shared FIFO queue achieves linerizability.

3
The term “register” or “read/write register” is used here to refer to shared memory variables on which only read &write operations may be performed On next slide: Q is a shared FIFO queue Prefer[i] is a shared read/write register 3

4
Consensus Algorithm for n = 2 Using FIFO Queue (i = 0, 1 for the two processes) 4 Initially Q = [0] and Prefer[i] = Prefer[i] := p i 's input val := deq(Q) if val = 0 then decide on p i 's input else temp := Prefer[1 - i] decide temp one shared FIFO queue two shared registers write my input into my register use shared queue to arbitrate between the 2 procs: first one to dequeue the initial 0 wins, decision value is its input loser obtains decision value from other proc's register

5
Extend Algorithm to More Procs? 5 Can we use FIFO queues to solve consensus with more than 2 procs? The ability to atomically dequeue a value was key to the 2-proc alg: one proc. learns it is the winner the other learns it is the loser, therefore the id of the winner is obvious Not clear how to handle 3 procs. Suppose we have a different data type:

6
Compare & Swap Specification 6 compare&swap(X : shared memory address, old: value, new: value) previous := X // previous is a local var. if previous = old then X := new return previous X old new

7
Assume that we have an implementation of a shared compare-and-swap object that satisfies linearizability 7

8
Consensus Algorithm Using Compare-and- Swap 8 Initially First = val := compare&swap(First, , my input) if val = then decide on my input else decide val one shared C&S object simultaneously indicate whether you are the winner and the value to be decided by all the losers if First = then replace with my input

9
Achieves consensus among n processes even if any number of them crash 9

Similar presentations

OK

CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.

CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on total internal reflection fiber Ppt on wireless power transmission system Ppt on animal kingdom classification class 9 Ppt on business entrepreneurship Ppt on seasons in arabic Ppt on image compression using matlab Ppt on different types of computer softwares list Ppt on impact of information technology in banking sector Ppt on transportation in india Ppt on reproductive system of human body