02~Chapter_02 - Mutual Exclusion C panion slide for om s...

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

View Full Document Right Arrow Icon
Mutual Exclusion Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit
Background image of page 1

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 2 Mutual Exclusion Today we will try to formalize our understanding of mutual exclusion We will also use the opportunity to show you how to argue about and prove various properties in an asynchronous concurrent setting
Background image of page 2
Mutual Exclusion In his 1965 paper E. W. Dijkstra wrote: "Given in this paper is a solution to a problem which, to the knowledge of the author, has been an open question since at least 1962, irrespective of the solvability. [. ..] Although the setting of the problem might seem somewhat academic at first, the author trusts that anyone familiar with the logical problems that arise in computer coupling will appreciate the significance of the fact that this problem indeed can be solved." Art of Multiprocessor Programming 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
Art of Multiprocessor Programming 4 Mutual Exclusion Formal problem definitions Solutions for 2 threads n Fair solutions Inherent costs
Background image of page 4
Art of Multiprocessor Programming 5 Warning You will never use these protocols Get over it You are advised to understand them The same issues show up everywhere Except hidden and more complex
Background image of page 5

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 6 Why is Concurrent Programming so Hard? Try preparing a seven-course banquet By yourself With one friend With twenty-seven friends … Before we can talk about programs Need a language Describing time and concurrency
Background image of page 6
Art of Multiprocessor Programming 7 “Absolute, true and mathematical time, of itself and from its own nature, flows equably without relation to anything external.” (I. Newton, 1689) “Time is, like, Nature’s way of making sure that everything doesn’t happen all at once.” (Anonymous, circa 1968) Time time
Background image of page 7

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 8 time An event a 0 of thread A is Instantaneous No simultaneous events (break ties) a 0 Events
Background image of page 8
Art of Multiprocessor Programming 9 time A thread A is (formally) a sequence a 0 , a 1 , . .. of events “Trace” model Notation: a 0 a 1 indicates order a 0 Threads a 1 a 2
Background image of page 9

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 10 Assign to shared variable Assign to local variable Invoke method Return from method Lots of other things … Example Thread Events
Background image of page 10
Art of Multiprocessor Programming 11 Threads are State Machines Events are transitions a 0 a 1 a 2 a 3
Background image of page 11

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 12 States Thread State Program counter Local variables System state Object fields (shared variables) Union of thread states
Background image of page 12
Art of Multiprocessor Programming 13 time Thread A Concurrency
Background image of page 13

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 14 time Thread A B Concurrency
Background image of page 14
Art of Multiprocessor Programming 15 time Interleavings Events of two or more threads Interleaved Not necessarily independent (why?)
Background image of page 15

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 16 time An interval A 0 =(a 0 ,a 1 ) is Time between events a and a 1 a 0 a 1 Intervals A 0
Background image of page 16
Art of Multiprocessor Programming 17 time Intervals may Overlap a 0 a 1 A 0 b 0 b 1 B 0
Background image of page 17

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

View Full DocumentRight Arrow Icon
Art of Multiprocessor Programming 18 time Intervals may be Disjoint a 0 a 1 A 0 b 0 b 1 B 0
Background image of page 18
Art of Multiprocessor Programming 19 time Precedence a 0 a 1 A 0 b 0 b 1 B 0 Interval A 0 precedes interval B 0
Background image of page 19

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

View Full DocumentRight Arrow Icon
Image of page 20
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/11/2010 for the course COS COS226 taught by Professor Klazar during the Spring '10 term at University of Pretoria.

Page1 / 158

02~Chapter_02 - Mutual Exclusion C panion slide for om s...

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

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