My programming-languages view of TM: Research and Conjectures Dan Grossman University of Washington June 2008.

Slides:



Advertisements
Similar presentations
Tramp Ali-Reza Adl-Tabatabai, Richard L. Hudson, Vijay Menon, Yang Ni, Bratin Saha, Tatiana Shpeisman, Adam Welc.
Advertisements

Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.
Design and Implementation Issues for Atomicity Dan Grossman University of Washington Workshop on Declarative Programming Languages for Multicore Architectures.
The many faces of TM Tim Harris. Granularity Distributed, large-scale atomic actions Composable shared memory data structures Leaf shared memory data.
Memory Models (1) Xinyu Feng University of Science and Technology of China.
CS 162 Memory Consistency Models. Memory operations are reordered to improve performance Hardware (e.g., store buffer, reorder buffer) Compiler (e.g.,
A Rely-Guarantee-Based Simulation for Verifying Concurrent Program Transformations Hongjin Liang, Xinyu Feng & Ming Fu Univ. of Science and Technology.
Programming-Language Approaches to Improving Shared-Memory Multithreading: Work-In-Progress Dan Grossman University of Washington Microsoft Research, RiSE.
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
The Transactional Memory / Garbage Collection Analogy Dan Grossman University of Washington AMD July 26, 2010.
The Transactional Memory / Garbage Collection Analogy Dan Grossman University of Washington Microsoft Programming Languages TCN September 14, 2010.
Teaching Programming Language Design and Implementation: Perspective From Two Roles Dan Grossman PLDI Panel 2011.
We should define semantics for languages, not for TM Tim Harris (MSR Cambridge)
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
Software Transactions: A Programming-Languages Perspective Dan Grossman University of Washington 28 February 2008.
The Transactional Memory / Garbage Collection Analogy Dan Grossman University of Washington OOPSLA 2007.
The Why, What, and How of Software Transactions for More Reliable Concurrency Dan Grossman University of Washington 8 September 2006.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
1 CS 312 – Lecture 28 Continuations –Probably the most confusing thing you’ve seen all semester… Course summary –Life after CS 312.
Atomicity via Source-to-Source Translation Benjamin Hindman Dan Grossman University of Washington 22 October 2006.
STM in Managed Runtimes: High-Level Language Semantics (MICRO 07 Tutorial) Dan Grossman University of Washington 2 December 2007.
[ 1 ] Agenda Overview of transactional memory (now) Two talks on challenges of transactional memory Rebuttals/panel discussion.
Formalisms and Verification for Transactional Memories Vasu Singh EPFL Switzerland.
Software Transactions: A Programming-Languages Perspective Dan Grossman University of Washington 27 March 2008.
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
Programming-Language Motivation, Design, and Semantics for Software Transactions Dan Grossman University of Washington June 2008.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
The Why, What, and How of Software Transactions for More Reliable Concurrency Dan Grossman University of Washington 17 November 2006.
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.
The Why, What, and How of Software Transactions for More Reliable Concurrency Dan Grossman University of Washington 26 May 2006.
STM in Managed Runtimes: High-Level Language Semantics (MICRO 07 Tutorial) Dan Grossman University of Washington 2 December 2007.
Software Transactions: A Programming-Languages Perspective Dan Grossman University of Washington 5 December 2006.
Software Transactions: A Programming-Languages Perspective Dan Grossman University of Washington 29 March 2007.
Why The Grass May Not Be Greener On The Other Side: A Comparison of Locking vs. Transactional Memory Written by: Paul E. McKenney Jonathan Walpole Maged.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
Microsoft Research Faculty Summit Panacea or Pandora’s Box? Software Transactional Memory Panacea or Pandora’s Box? Christos Kozyrakis Assistant.
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
WG5: Applications & Performance Evaluation Pascal Felber
Aritra Sengupta, Swarnendu Biswas, Minjia Zhang, Michael D. Bond and Milind Kulkarni ASPLOS 2015, ISTANBUL, TURKEY Hybrid Static-Dynamic Analysis for Statically.
Low-Overhead Software Transactional Memory with Progress Guarantees and Strong Semantics Minjia Zhang, 1 Jipeng Huang, Man Cao, Michael D. Bond.
Precise Dynamic Data-Race Detection At The Right Abstraction Level Dan Grossman University of Washington Facebook Faculty Summit August 6, 2013.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
Data races, informally [More formal definition to follow] “race condition” means two different things Data race: Two threads read/write, write/read, or.
CS510 Concurrent Systems Why the Grass May Not Be Greener on the Other Side: A Comparison of Locking and Transactional Memory.
Motivation  Parallel programming is difficult  Culprit: Non-determinism Interleaving of parallel threads But required to harness parallelism  Sequential.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
ICFEM 2002, Shanghai Reasoning about Hardware and Software Memory Models Abhik Roychoudhury School of Computing National University of Singapore.
CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution Tom Bergan Owen Anderson, Joe Devietti, Luis Ceze, Dan Grossman To appear.
Detecting Atomicity Violations via Access Interleaving Invariants
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
AtomCaml: First-class Atomicity via Rollback Michael F. Ringenburg and Dan Grossman University of Washington International Conference on Functional Programming.
Aritra Sengupta, Man Cao, Michael D. Bond and Milind Kulkarni PPPJ 2015, Melbourne, Florida, USA Toward Efficient Strong Memory Model Support for the Java.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
4 November 2005 CS 838 Presentation 1 Nested Transactional Memory: Model and Preliminary Sketches J. Eliot B. Moss and Antony L. Hosking Presented by:
R 1 Transactional abstractions: beyond atomic update Tim Harris r.
(Nested) Open Memory Transactions in Haskell
Hongjin Liang, Xinyu Feng & Ming Fu
Threads and Memory Models Hal Perkins Autumn 2011
Enforcing Isolation and Ordering in STM Systems
Dan Grossman University of Washington 18 July 2006
Threads and Memory Models Hal Perkins Autumn 2009
Lecture 22: Consistency Models, TM
Design and Implementation Issues for Atomicity
Computer Science 340 Software Design & Testing
Tim Harris (MSR Cambridge)
Pointer analysis John Rollinson & Kaiyuan Li
Presentation transcript:

My programming-languages view of TM: Research and Conjectures Dan Grossman University of Washington June 2008

Dan Grossman, University of Washington2 Who am I Programming-languages researcher –Formal semantics, type systems, compilers, etc. –UW 2003-present, Cornell Ph.D., Rice undergrad Formerly: Cyclone, a type-safe C –Now portable C-level code TM interest from frustration that data-race prevention was about, “getting to the starting line” –Checking atomicity better –Declaring atomicity even better

June 2008Dan Grossman, University of Washington3 Broad summary In the next 14 minutes: Advertisement for past/present TM work –Motivation for TM in HLLs –Semantics, weak vs. strong –PL design (feature interaction) –Language implementation, optimizations Provocative(?) conjectures for further discussion

June 2008Dan Grossman, University of Washington4 Credit Semantics: Katherine Moore Uniprocessor: Michael Ringenburg, Aaron Kimball Optimizations: Steven Balensiefer, Ben Hindman Implementing multithreaded transactions: Aaron Kimball Memory-model issues: Jeremy Manson, Bill Pugh Weak vs. Strong STM: Tatiana Shpeisman, Vijay Menon, Ali-Reza Adl-Tabatabai, Richard Hudson, Bratin Saha Implementing multithreaded transactions: Tim Harris wasp.cs.washington.edu

June 2008Dan Grossman, University of Washington5 Please read High-Level Small-Step Operational Semantics for Transactions [POPL08] Katherine F. Moore, Dan Grossman The Transactional Memory / Garbage Collection Analogy [OOPSLA07] Dan Grossman Software Transactions Meet First-Class Continuations [SCHEME07] Aaron Kimball, Dan Grossman Enforcing Isolation and Ordering in STM [PLDI07] Tatiana Shpeisman, Vijay Menon, Ali-Reza Adl-Tabatabai, Steve Balensiefer, Dan Grossman, Richard Hudson, Katherine F. Moore, Bratin Saha Atomicity via Source-to-Source Translation [MSPC06] Benjamin Hindman and Dan Grossman What Do High-Level Memory Models Mean for Transactions? [MSPC06] Dan Grossman, Jeremy Manson, William Pugh AtomCaml: First-Class Atomicity via Rollback [ICFP05] Michael F. Ringenburg, Dan Grossman

June 2008Dan Grossman, University of Washington6 Motivation So atomic { … } “sure feels better than locks” But the crisp software-engineering reasons I’ve seen are all (great) examples –Account transfer from Flanagan et al. See also Java’s StringBuffer.append –Double-ended queue from Herlihy –…

June 2008Dan Grossman, University of Washington7 Motivation But what is the essence of the benefit? Transactional Memory (TM) is to shared-memory concurrency as Garbage Collection (GC) is to memory management

June 2008Dan Grossman, University of Washington8 Motivation (see the essay) memory managementconcurrency correctnessdangling pointersraces performancespace exhaustiondeadlock automationgarbage collectiontransactional memory key approximationreachabilitymemory conflicts manual circumventionweak pointersopen nesting complete avoidanceobject poolinglock library uncontrollable approx.conservative collectionfalse memory conflicts eager approachreference-countingupdate-in-place lazy approachtracingupdate-on-commit external dataI/O of pointersI/O in transactions forward progressreal-timeobstruction-free static optimizationsliveness analysisescape analysis

June 2008Dan Grossman, University of Washington9 Motivation GC: established technology; widely accepted benefits Even though it can perform arbitrarily badly in theory Even though you can’t always ignore how it works (at a high-level) Even though an active research area after 40+ years

June 2008Dan Grossman, University of Washington10 Semantics The potential behavior when nontransactional code bypasses TM mechanisms is worse than with locks atomic { if(b) ++x; else ++y; } r = x; s = y; assert(r+s<2); initially b=0, x=0, y=0 atomic { b = 1; } (Note: Other examples don’t even have data races in the corresponding lock-based code.)

June 2008Dan Grossman, University of Washington11 Semantics In a type-safe high-level language: We must know we found all the surprises –And define legal behaviors –Even “bad” code cannot violate security/abstraction Best intellectual tool we have is formal semantics –My work: small-step operational a;H;e1|| … ||en a’;H’;e1’|| … ||en’

June 2008Dan Grossman, University of Washington12 Semantics Different notions of isolation by changing Equivalence proofs under source-code assumptions formalized via type-and-effect systems –Proofs mean no more surprises (in the model) –Structure of proofs reveal the key invariants a;H;e1|| … ||en a’;H’;e1’|| … ||en’ strongweak-1-lockweak-undo strong-undo

June 2008Dan Grossman, University of Washington13 Semantics There is much left to do beyond weak vs. strong Open nesting (in terms of ADTs) Relaxed memory-consistency models …

June 2008Dan Grossman, University of Washington14 Language design Real languages need precise semantics for all feature interactions. For example: Native Calls [ICFP05] Exceptions [ICFP05, SCHEME07] First-class continuations [SCHEME07] Thread-creation [POPL08] Java-style class-loading [MSPC06]

June 2008Dan Grossman, University of Washington15 Implementation If a TM application is (currently) running on one core, use thread-scheduling to ensure atomicity Memory-access overhead Also: initialization writes need not be logged Strong isolation naturally not in atomicin atomic readnone writenonelog (2 more writes)

June 2008Dan Grossman, University of Washington16 Implementation Thread local Immutable Not accessed in transaction Novel: static analysis for not-accessed-in-transaction –Currently whole-program (but scalable) Strong isolation on multicore: remove barriers with compiler/runtime optimization

June 2008Dan Grossman, University of Washington17 Implementation Most implementations (hw or sw) assume code inside a transaction is single-threaded –But isolation and parallelism are orthogonal –Amdahl’s Law will strike with manycore Ongoing work: Multithreaded transactions –Key: Nested transactions for nested isolation –Key: correct logging without sacrificing parallelism

June 2008Dan Grossman, University of Washington18 Discussion starters [Happy to be convinced otherwise, but I conjecture…] 1.Like GC, don’t need hardware support (but it’s nice) 2.Like GC, widespread adoption will take lots of time 3.Like GC, we rarely need “back doors” 4.A high-level language with TM wouldn’t directly use HTM even if available 5.The PL community has ignored memory consistency models for too long and will soon regret it –What ordering guarantees do transactions imply?