{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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 TheArt of Multiprocessor Programming by MauriceHerlihy & Nir Shavit
Background image of page 1

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

View Full Document Right 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 knowledgeof the author, has been an open question since at least 1962, irrespectiveof thesolvability. [...] Although thesetting of the problem might seem somewhat academic at first, theauthor trusts that anyonefamiliar with the logical problems that arisein computer coupling will appreciatethe significanceof 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 Document Right Arrow Icon
Art of Multiprocessor Programming 4 Mutual Exclusion Formal problem definitions Solutions for 2 threads Solutions for n threads 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 Thesameissues show up everywhere Except hidden and morecomplex
Background image of page 5

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

View Full Document Right Arrow Icon
Art of Multiprocessor Programming 6 Why is Concurrent Programming so Hard? Try preparing a seven-course banquet By yourself With onefriend With twenty-seven friends … Before we can talk about programs Need a language Describing timeand 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 Document Right 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 Document Right 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 Document Right Arrow Icon
Art of Multiprocessor Programming 12 States Thread State Programcounter 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 Document Right Arrow Icon
Art of Multiprocessor Programming 14 time time Thread A Thread 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 Document Right Arrow Icon
Art of Multiprocessor Programming 16 time An interval A 0 =(a 0 ,a 1 ) is Timebetween events a 0 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 Document Right 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 Document Right Arrow Icon
Image of page 20
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}