05~Chapter_05 - The Relative Power of Synchronization...

Info iconThis preview shows pages 1–24. 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: The Relative Power of Synchronization Operations Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Art of Multiprocessor Programmi 2 Last Lecture: Shared-Memory Computability • Mathematical model of concurrent computation • What is (and is not) concurrently computable • Efficiency (mostly) irrelevant 10011 Shared Memory Art of Multiprocessor Programmi 3 Wait-Free I mplementation • Every method call completes in finite number of steps • I mplies no mutual exclusion (2) Art of Multiprocessor Programmi 4 From Weakest Register 1 1 Single reader Single writer Safe Boolean register Art of Multiprocessor Programmi 5 All the way to a Wait-free I mplementation of Atomic Snapshots MRMW MRSW SRSW Safe Regular Atomic M-valued Boolean Snapshot Art of Multiprocessor Programmi 6 Rationale for wait-freedom • We wanted atomic registers to implement mutual exclusion • So we couldn’t use mutual exclusion to implement atomic registers • But wait, there’s more! Why is Mutual Exclusion so wrong? (2) Art of Multiprocessor Programmi 8 Asynchronous I nterrupts S w a p p e d o u t b a c k a t ??? ??? (2) Art of Multiprocessor Programmi 9 Heterogeneous Processors ??? ??? yaw n (1) Pentium Pentium 286 Art of Multiprocessor Programmi 10 Fault-tolerance ??? ??? (2) Art of Multiprocessor Programmi 11 Machine Level I nstruction Granularity Eugene Amdahl (2) Art of Multiprocessor Programmi 12 Basic Questions • Wait-Free synchronization might be a good idea in principle • But how do you do it – Systematically? – Correctly? – Efficiently? Art of Multiprocessor Programmi 13 FI FO Queue: Enqueue Method q.enq ( ) Art of Multiprocessor Programmi 14 FI FO Queue: Dequeue Method q.deq()/ Art of Multiprocessor Programmi 15 Two-Thread Wait-Free Queue public class LockFreeQueue { int head = 0, tail = 0; Item[QSIZE] items; public void enq(Item x) { while (tail- head == QSIZE) {}; items[tail % QSIZE] = x; tail++; } public Item deq() { while (tail- head == 0) {} Item item = items[head % QSIZE]; head++; return item; }} Art of Multiprocessor Programmi 16 What About Multiple Dequeuers? Art of Multiprocessor Programmi 17 Grand Challenge • I mplement a FI FO queue – Wait-free – Linearizable – From atomic read-write registers – Multiple dequeuers Only new aspect (1) Art of Multiprocessor Programmi 18 Consensus • While you are ruminating on the grand challenge… • We will give you another puzzle – Consensus – Will be important … Art of Multiprocessor Programmi 19 Consensus: Each Thread has a Private I nput 32 19 21 Art of Multiprocessor Programmi 20 They Communicate Art of Multiprocessor Programmi 21 They Agree on One Thread’s I nput 19 19 19 Art of Multiprocessor Programmi 22 Formally: Consensus Consistent : all threads decide the same value Valid : the common decision value is some thread's input Art of Multiprocessor Programmi 23 No Wait-Free I mplementation of Consensus using Registers ???...
View Full 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 / 155

05~Chapter_05 - The Relative Power of Synchronization...

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

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