Download presentation

Presentation is loading. Please wait.

Published byCamron Longyear Modified over 3 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

Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are: Resource sharing Avoiding concurrent update on shared data Controlling the.

Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are: Resource sharing Avoiding concurrent update on shared data Controlling the.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

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