10~Chapter_12 - Shared Counters and Parallelism Companion...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Shared Counters and Parallelism Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Art of Multiprocessor Programming 2 A Shared Pool Put Inserts object blocks if full Remove Removes & returns an object blocks if empty public interface Pool { public void put(Object x); public Object remove(); } Unordered set of objects Art of Multiprocessor Programming 3 put Simple Locking Implementation put Art of Multiprocessor Programming 4 put Simple Locking Implementation put Problem: hot-spot contention Art of Multiprocessor Programming 5 put Simple Locking Implementation Problem: hot-spot contention Problem: sequential bottleneck put Art of Multiprocessor Programming 6 put Simple Locking Implementation Problem: hot-spot contention Problem: sequential bottleneck put Solution: Queue Lock Art of Multiprocessor Programming 7 put Simple Locking Implementation Problem: hot-spot contention Problem: sequential bottleneck put Solution: Queue Lock Solution?? ? Art of Multiprocessor Programming 8 Counting Implementation 19 20 21 remove put 19 20 21 Art of Multiprocessor Programming 9 Counting Implementation 19 20 21 Only the counters are sequential remove put 19 20 21 Art of Multiprocessor Programming 10 Shared Counter 3 2 1 1 2 3 Art of Multiprocessor Programming 11 Shared Counter 3 2 1 1 2 3 No duplication Art of Multiprocessor Programming 12 Shared Counter 3 2 1 1 2 3 No duplication No Omission Art of Multiprocessor Programming 13 Shared Counter 3 2 1 1 2 3 Not necessarily linearizable No duplication No Omission Art of Multiprocessor Programming 14 Shared Counters Can we build a shared counter with Low memory contention, and Real parallelism? Locking Can use queue locks to reduce contention No help with parallelism issue Art of Multiprocessor Programming 15 Software Combining Tree 4 Contention: All spinning local Parallelism: Potential n/log n speedup Art of Multiprocessor Programming 16 Combining Trees Art of Multiprocessor Programming 17 Combining Trees +3 Art of Multiprocessor Programming 18 Combining Trees +3 +2 Art of Multiprocessor Programming 19 Combining Trees +3 +2 Two threads meet, combine sums Art of Multiprocessor Programming 20 Combining Trees +3 +2 Two threads meet, combine sums +5 Art of Multiprocessor Programming 21 Combining Trees 5 +3 +2 +5 Combined sum added to root Art of Multiprocessor Programming 22 Combining Trees 5 +3 +2 Result returned to children Art of Multiprocessor Programming 23 Combining Trees 5 3 Results returned to threads Art of Multiprocessor Programming 24 Devil in the Details What if threads dont arrive at the same time?...
View Full Document

Page1 / 221

10~Chapter_12 - Shared Counters and Parallelism Companion...

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

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