U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Grace: Safe Multithreaded Programming for C/C++ Emery Berger University of Massachusetts,

Slides:



Advertisements
Similar presentations
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 Three Challenges for Transactional Computing J. Eliot B. Moss Associate Professor,
Advertisements

© 2009 Charles E. Leiserson and Pablo Halpern1 Introduction to Cilk++ Programming PADTAD July 20, 2009 Cilk, Cilk++, Cilkview, and Cilkscreen, are trademarks.
Introductions to Parallel Programming Using OpenMP
Scalable and Precise Dynamic Datarace Detection for Structured Parallelism Raghavan RamanJisheng ZhaoVivek Sarkar Rice University June 13, 2012 Martin.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Rich Transactions on Reasonable Hardware J. Eliot B. Moss Univ. of Massachusetts,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Solving POMDPs Using Quadratically Constrained Linear Programs Christopher Amato.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Deadlock Emery Berger and Mark Corner University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science X10: IBM’s bid into parallel languages Paul B Kohler Kevin S Grimaldi University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST – Department of Computer Science The Implementation of the Cilk-5 Multithreaded Language (Frigo, Leiserson, and.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Dynamic Memory Management Emery Berger and Mark Corner.
U NIVERSITY OF M ASSACHUSETTS – Department of Computer Science Emery Berger Scalable Memory Management for Multithreaded Applications CMPSCI 691P Fall.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science 2007 Exterminator: Automatically Correcting Memory Errors with High Probability Gene.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Chapel: The Cascade High Productivity Language Ting Yang University of Massachusetts.
1 U NIVERSITY OF M ASSACHUSETTS, A MHERST School of Computer Science P REDATOR : Predictive False Sharing Detection Tongping Liu*, Chen Tian, Ziang Hu,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Leveraging Interleaved Signal Edges for Concurrent Backscatter by Pan Hu, Pengyu.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science CRAMM: Virtual Memory Support for Garbage-Collected Applications Ting Yang, Emery.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 River Sensor Network Application: Monitor river dynamics (e.g: seasonal, flood.
Operating Systems CMPSCI 377 Lecture 11: Memory Management
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science pH: A Parallel Dialect of Haskell Jim Cipar & Jacob Sorber University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Virtualization in Data Centers Prashant Shenoy
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Optimal Fixed-Size Controllers for Decentralized POMDPs Christopher Amato Daniel.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science PLDI 2006 DieHard: Probabilistic Memory Safety for Unsafe Programming Languages Emery.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
DTHREADS: Efficient Deterministic Multithreading
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Multilisp: Concurrent Functional Programming Ed Walters and Tim Richards University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science 2006 Exterminator: Automatically Correcting Memory Errors Gene Novark, Emery Berger.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Parallel & Concurrent Programming: Occam Vitaliy Lvin University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science 2007 Eon: A language and runtime for perpetual systems Jacob Sorber, Alexander Kostadinov,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Processes & Threads Emery Berger and Mark Corner University.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Concurrency Patterns Emery Berger and Mark Corner University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Advanced Compilers CMPSCI 710 Spring 2004 Lecture 1 Emery Berger University of Massachusetts,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science S HERIFF : Precise Detection & Automatic Mitigation of False Sharing Tongping Liu,
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Emery Berger and Mark Corner University of Massachusetts Amherst Computer Systems.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 Automatic Heap Sizing: Taking Real Memory into Account Ting Yang, Emery Berger,
U NIVERSITY OF M ASSACHUSETTS, A MHERST – Department of Computer Science Performance of Work Stealing in Multiprogrammed Environments Matthew Hertz Department.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Fortress John Burgess and Richard Chang CS691W University of Massachusetts Amherst.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Yi Feng & Emery Berger University of Massachusetts Amherst A Locality-Improving.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Software Systems Advanced Synchronization Emery Berger and Mark Corner University.
Tongping Liu, Charlie Curtsinger, Emery Berger D THREADS : Efficient Deterministic Multithreading Insanity: Doing the same thing over and over again and.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Sensor Networks and Platforms for Advancing Water Research Prashant Shenoy University.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Virtual Memory & Paging Emery Berger and Mark Corner.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Vision: A Robust Architecture for a Diverse Mobile Wireless Internet.
Pattern Parallel Programming
Changing thread semantics
Atomicity in Multithreaded Software
Presentation transcript:

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Grace: Safe Multithreaded Programming for C/C++ Emery Berger University of Massachusetts, UPC/BSC

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science

“”

race condition

atomicity violation

deadlock

order violation

sequential

race conditions

atomicity violations

race conditions atomicity violations deadlock

race conditions atomicity violations deadlock order violations

Grace race conditions atomicity violations deadlock order violations

race conditions atomicity violations deadlock order violations Grace

race conditions atomicity violations deadlock order violations sequential Grace

% g++ myprog.cpp –lpthread –o myprog

Grace % g++ myprog.cpp –lgrace –o myprog

Grace % g++ myprog.cpp –lgrace –o myprog sequential

Grace % g++ myprog.cpp –lgrace –o myprog sequential race conditions atomicity violations deadlock order violations

Grace % g++ myprog.cpp –lgrace –o myprog sequential race conditions atomicity violations deadlock order violations

Safe and (usually) fast…

benign race

Grace sequential +?1.

Grace sequential +?1. 2.

Grace sequential +?

sequential +?1.

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync;

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; spawn f(x)

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) spawn f(x)

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) spawn f(x) spawn g(y)

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y) spawn f(x) spawn g(y)

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y) spawn f(x) spawn g(y) sync

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y) spawn f(x) spawn g(y) sync

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y) spawn f(x) spawn g(y) sync left-to-right, depth-first ordering

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y)

sequential +?1. t1 = spawn f(x); t2 = spawn g(y); sync; f(x) g(y) “”

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “” race conditions atomicity violations deadlock order violations

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “”

sequential +?1. f(x) g(y) “” Fork-join (e.g., map-reduce, Cilk, TBB…)

? 2. What’s under the hood?

? 2. “Magic!”

? 2. +

?

? t1 = spawn f(x); t2 = spawn g(y); sync;

? 2. t1 = spawn f(x); t2 = spawn g(y); sync; if (!fork()) f(x); if (!fork()) g(y); // check;

? 2. if (!fork()) f(x); if (!fork()) g(y); // check; f(x) g(y) spawn f(x) spawn g(y) sync

? 2. if (!fork()) f(x); if (!fork()) g(y); // check; f(x) g(y) spawn f(x) spawn g(y) sync

? 2. if (!fork()) f(x); if (!fork()) g(y); // check; f(x) g(y) spawn f(x) spawn g(y) sync Note: Nested threads ok

? 2. f(x) g(y) spawn f(x) spawn g(y) sync mmap

? 2. f(x) g(y) spawn f(x) spawn g(y) sync mmap

? 2. f(x) g(y) spawn f(x) spawn g(y) sync mmap

? 2. f(x) g(y) spawn f(x) spawn g(y) sync

? 2. f(x) g(y) spawn f(x) spawn g(y) sync 1

? 2. f(x) g(y) spawn f(x) spawn g(y) sync 1 2

? 2. scalable heap + aligned globals I/O (buffering + ordering)

3. More detailed results…

Grace sequential race conditions atomicity violations deadlock order violations

Grace sequential race conditions atomicity violations deadlock order violations

Grace sequential race conditions atomicity violations deadlock order violations

Grace sequential race conditions atomicity violations deadlock order violations % g++ myprog.cpp –lgrace –o myprog

“Moltes gràcies”

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science ? 2.

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science ? 2.

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science ? 2. +

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science ? 2. ++