15- mutual exclusion

15- mutual exclusion - CSE 486/586 Distributed Systems...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 Recap: Consensus On a synchronous system There’s an algorithm that works. On an asynchronous system It’s been shown (FLP) that it’s impossible to guarantee. Getting around the result Masking faults Using failure detectors Still not perfect Impossibility Result Lemma 1: schedules are commutative Lemma 2: some initial configuration is bivalent Lemma 3: from a bivalent configuration, there is always another bivalent configuration that is reachable. 2
Background image of page 2
CSE 486/586, Spring 2012 Why Mutual Exclusion? Bank’s Servers in the Cloud: Think of two simultaneous deposits of $10,000 into your bank account, each from one ATM. Both ATMs read initial amount of $1000 concurrently from the bank’s cloud server Both ATMs add $10,000 to this amount (locally at the ATM) Both write the final amount to the server What’s wrong? 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 Why Mutual Exclusion? Bank’s Servers in the Cloud: Think of two simultaneous deposits of $10,000 into your bank account, each from one ATM. Both ATMs read initial amount of $1000 concurrently from the bank’s cloud server Both ATMs add $10,000 to this amount (locally at the ATM) Both write the final amount to the server What’s wrong? The ATMs need mutually exclusive access to your account entry at the server (or, to executing the code that modifies the account entry) 4
Background image of page 4
CSE 486/586, Spring 2012 Mutual Exclusion Critical section problem Piece of code (at all clients) for which we need to ensure there is at most one client executing it at any point of time. Solutions: Semaphores, mutexes, etc. in single-node OS Message-passing-based protocols in distributed systems: » enter() the critical section » AccessResource() in the critical section » exit() the critical section Distributed mutual exclusion requirements: Safety – At most one process may execute in CS at any time Liveness – Every request for a CS is eventually granted Ordering (desirable) – Requests are granted in the order they were made 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 Mutexes To synchronize access of multiple threads to common data structures Allows two operations: lock() while true: // each iteration atomic if lock not in use: label lock in use break unlock() label lock not in use 6
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/27/2012.

Page1 / 22

15- mutual exclusion - CSE 486/586 Distributed Systems...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online