Lecture-7 - Principles of Concurrency and Parallelism...

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

View Full Document Right Arrow Icon
CS390C: Principles of Concurrency and Parallelism Principles of Concurrency and Parallelism Lecture 7: Mutual Exclusion 2/16/12 slides adapted from The Art of Multiprocessor Programming, Herlihy and Shavit Wednesday, February 15, 12
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 2 “Absolute, true and mathematical time, of itself and from its own nature, Fows 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 Wednesday, February 15, 12
Background image of page 2
CS390C: Principles of Concurrency and Parallelism 3 time An event a 0 of thread A is Instantaneous No simultaneous events (break ties) a 0 Events Wednesday, February 15, 12
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 4 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 Wednesday, February 15, 12
Background image of page 4
CS390C: Principles of Concurrency and Parallelism 5 Assign to shared variable Assign to local variable Invoke method Return from method Lots of other things … Example Thread Events Wednesday, February 15, 12
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 6 Threads are State Machines Events are transitions a 0 a 1 a 2 a 3 Wednesday, February 15, 12
Background image of page 6
CS390C: Principles of Concurrency and Parallelism 7 States Thread State Program counter Local variables System state Object felds (shared variables) Union oF thread states Wednesday, February 15, 12
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 8 time time Thread A Thread B Concurrency Wednesday, February 15, 12
Background image of page 8
CS390C: Principles of Concurrency and Parallelism 9 time Interleavings Events of two or more threads Interleaved Not necessarily independent (why?) Wednesday, February 15, 12
Background image of page 9

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 10 time An interval A 0 =(a 0 ,a 1 ) is Time between events a 0 and a 1 a 0 a 1 Intervals A 0 Wednesday, February 15, 12
Background image of page 10
CS390C: Principles of Concurrency and Parallelism 11 time Intervals may Overlap a 0 a 1 A 0 b 0 b 1 B 0 Wednesday, February 15, 12
Background image of page 11

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 12 time Intervals may be Disjoint a 0 a 1 A 0 b 0 b 1 B 0 Wednesday, February 15, 12
Background image of page 12
CS390C: Principles of Concurrency and Parallelism 13 time Precedence a 0 a 1 A 0 b 0 b 1 B 0 Interval A 0 precedes interval B 0 Wednesday, February 15, 12
Background image of page 13

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

View Full DocumentRight Arrow Icon
CS390C: Principles of Concurrency and Parallelism 14 Precedence Notation: A 0 B 0 Formally, End event of A 0 before start event of B 0 Also called “happens before” or “precedes” Wednesday, February 15, 12
Background image of page 14
CS390C: Principles of Concurrency and Parallelism 15 Precedence Ordering Remark: A 0 B 0 is just like saying 1066 AD 1492 AD, Middle Ages Renaissance, Oh wait, what about this week vs this month?
Background image of page 15

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

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview.