Multiprocessor Synchronization Algorithms ( )

Slides:



Advertisements
Similar presentations
CS 603 Process Synchronization: The Colored Ticket Algorithm February 13, 2002.
Advertisements

CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Synchronization Algorithms and Concurrent Programming
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Computer Science 425 Distributed Systems CS 425 / ECE 428 Consensus
DISTRIBUTED SYSTEMS II FAULT-TOLERANT AGREEMENT Prof Philippas Tsigas Distributed Computing and Systems Research Group.
1 Lecture 1 Distributed Algorithms Gadi Taubenfeld © 2011 Distributed Algorithms Gadi Taubenfeld Lecture 1 INTRODUCTION.
Distributed systems Module 2 -Distributed algorithms Teaching unit 1 – Basic techniques Ernesto Damiani University of Bozen Lesson 3 – Distributed Systems.
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Systems of Distributed Systems Module 2 -Distributed algorithms Teaching unit 3 – Advanced algorithms Ernesto Damiani University of Bozen Lesson 6 – Two.
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
Concurrency CS 510: Programming Languages David Walker.
Multiprocess Synchronization Algorithms ( ) Lecturer: Danny Hendler.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
1 Lecture 9: Synchronization  concurrency examples and the need for synchronization  definition of mutual exclusion (MX)  programming solutions for.
1 Thread Synchronization: Too Much Milk. 2 Implementing Critical Sections in Software Hard The following example will demonstrate the difficulty of providing.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Distributed Systems II TDA297(CTH), DIT290 (GU) LP hec
Distributed Systems II TDA297(CTH), DIT290 (GU) LP hec
1 Lectures on Parallel and Distributed Algorithms COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski Lectures on Parallel and Distributed.
Distributed Systems II TDA297(CTH), INN290 (GU) LP hec
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
1 Chapter 9 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
1 Chapter 10 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
CS294, Yelick Consensus revisited, p1 CS Consensus Revisited
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion & Leader Election Steve Ko Computer Sciences and Engineering University.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler.
Distributed Transaction Management, Fall 2002Lecture 2 / Distributed Locking Jyrki Nummenmaa
Several sets of slides by Prof. Jennifer Welch will be used in this course. The slides are mostly identical to her slides, with some minor changes. Set.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
CS 425/ECE 428 Distributed Systems Nitin Vaidya. T.A.s – Persia Aziz – Frederick Douglas – Su Du – Yixiao Lin.
1 Lecture #24 Shared Objects and Concurrent Programming This material is not available in the textbook. The online powerpoint presentations contain the.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 9: Fault Tolerant Consensus 1.
CSE 486/586 CSE 486/586 Distributed Systems Global States Steve Ko Computer Sciences and Engineering University at Buffalo.
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
Agenda  Quick Review  Finish Introduction  Java Threads.
Introduction to distributed systems description relation to practice variables and communication primitives instructions states, actions and programs synchrony.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Introduction to Operating Systems
Multiprocessor Synchronization Algorithms ( )
CSE 486/586 Distributed Systems Leader Election
G.Anuradha Reference: William Stallings
COMPSCI210 Recitation 12 Oct 2012 Vamsi Thummala
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Challenges in Concurrent Computing
CGS 3763 Operating Systems Concepts Spring 2013
Distributed Consensus
Agreement Protocols CS60002: Distributed Systems
Parallel and Distributed Algorithms
Distributed Systems, Consensus and Replicated State Machines
Distributed Consensus
Liveness And Performance
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
Distributed Computing:
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Abstraction.
Physical clock synchronization
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
Prof. Leonardo Mostarda University of Camerino
Lecture 11: Coordination and Agreement
Lecture 18: Coherence and Synchronization
CSE 486/586 Distributed Systems Byzantine Fault Tolerance
Don Porter Portions courtesy Emmett Witchel
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

Multiprocessor Synchronization Algorithms (20225241) Lecturer: Danny Hendler

Electronic submissions only!!! Grade structure 3 (theoretic) problem sets Up to 30% of grade Take-home final exam At least 70% of grade Electronic submissions only!!!

Adminstrative details Office: Alon 218 Office hours: Mondays, 2pm-4pm Or make an appointment Course site: http://www.cs.bgu.ac.il/academics/courses/2009/a/220225401 (or simply enter through my home page)

Books Distributed Computing: Fundamentals, Simulations, and Advanced Topics, Hagit Attiya and Jennifer Welch, John Wiley and Sons Synchronization Algorithms and Concurrent Programming, Gadi Taubenfeld, Pearson/Prentice Hall. Book site: http://www.faculty.idc.ac.il/gadi/book.htm

5

Moore’s law Exponential growth in computing power 6

How can we write correct and efficient algorithms for multiprocessors? The Future of Computing Speeding up uni-processors is harder and harder Intel, Sun, AMD, IBM now focusing on “multi- core” architectures Soon, most computers will be multiprocessors How can we write correct and efficient algorithms for multiprocessors? 7

Distributed Systems The Internet A distributed system is a collection of individual computing devices that communicate with one another. E.g.: VLSI chips Shared-memory multiprocessor Local-area network The Internet

One sequential model, MANY distributed models Shared-memory / Message-passing Which operations are allowed (read, write, read-modify-write)? Synchronous, timing-conditions, asynchronous Are failures allowed? Fail-stop, Byzantine failures, message omission Is the number of processes known?

Types of distributed systems Multi-core computers The Internet Peer-to-peer systems Grid computers Wireless networks Sensor networks Ad-hoc networks …

Motivating examples of Synchronization

The Too-Much-Milk Problem Time Alice Bob 5:00 Arrive Home 5:05 Look in fridge; no milk 5:10 Leave for grocery 5:15 Arrive home 5:20 Arrive at grocery 5:25 Buy milk 5:30 Arrive home; put milk in fridge 5:40 5:45 Arrive home; too much milk! Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solving the Too-Much-Milk Problem Required properties Mutual Exclusion: Only one person buys milk “at a time” Progress: Someone always buys milk if it is needed Communication primitives Leave a note (set a flag) Remove a note (reset a flag) Read a note (test the flag) Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Important Distinction Safety Property Nothing bad ever happens Example: mutual exclusion Liveness Property Something good happens eventually Example: progress Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 1 Alice if (no milk) { if (no note) { leave Note buy milk remove note } Bob Does it work? No, may end up with “two milk”. mutual exclusion progress Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 2 Using labeled notes Alice leave note A if (no note B) { if (no milk) {buy milk} } remove note A Bob leave note B if (no note A) { remove note B No, may end up with no milk. mutual exclusion progress Does it work? Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 3 Alice leave note A while (note B) {skip} if (no milk) {buy milk} remove note A Bob leave note B if (no note A) { } remove note B Does it work? mutual exclusion progress Only if we make a timing assumption! Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 4 Using 4 labeled notes A1 A2 B2 B1 the fridge’s door Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 4 A correct, fair, symmetric algorithm! Alice leave A1 if B2 {leave A2} else {remove A2} while B1 and ((A2 and B2) or (no A2 and no B2)) {skip} if (no milk) {buy milk} remove A1 Bob leave B1 if (no A2) {leave B2} else {remove B2} while A1 and ((A2 and no B2) or (no A2 and B2)) remove B1 A correct, fair, symmetric algorithm! Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

Solution 4 A1 A2 X B2 X B2 A1 A2 B2 B1 A1 A2 B2 B1 Alice’s turn These should be interpreted as follows: if the participant (Alice/Bob) evaluates the waiting condition and finds out that the condition depicted in the box is met – it can safely buy milk if there is none. Bob’s turn Bob’s turn Bob’s turn Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

A variant of Solution 4 The order of the first two statements is replaced Is it correct ? Alice if B2 {leave A2} else {remove A2} leave A1 while B1 and ((A2 and B2) or (no A2 and no B2)) {skip} if (no milk) {buy milk} remove A1 Bob if (no A2) {leave B2} else {remove B2} leave B1 while A1 and ((A2 and no B2) or (no A2 and B2)) remove B1 No, may end up with two milk. B2 A1 B2 B2 B2 B2 B1 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

A variant of Solution 4 The order of the first two statements is replaced Is it correct ? Alice if B2 {leave A2} else {remove A2} leave A1 while B1 and ((A2 and B2) or (no A2 and no B2)) {skip} if (no milk) {buy milk} remove A1 Bob if (no A2) {leave B2} else {remove B2} leave B1 while A1 and ((A2 and no B2) or (no A2 and B2)) remove B1 MILK No, may end up with two milk. B2 A1 B2 B2 B2 B1 B2 mutual exclusion progress Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

The coordinated attack problem Blue army wins if both blue camps attack simultaneously Design an algorithm to ensure that both blue camps attack simultaneously Enemy 1 2 The problem is due to by Jim Gray (1977) Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

The coordinated attack problem Communication is done by sending messengers across valley Messengers may be lost or captured by the enemy  Enemy 1 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006

The coordinated attack problem Theorem: There is no algorithm that solves this problem ! Proof: Assume to the contrary that such an algorithm exits. Let P be an algorithm that solves it with the fewest # of messages, when no message is lost. P should work even when the last messenger is captured. So P should work even if the last messenger is never sent. But this is a new algorithm with one less message. A contradiction.  The model is too weak! Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006