810 likes | 952 Views
Sweet Sixteen: How well is Transactional Memory Aging? . Maurice Herlihy Brown University. Remember 1993?. Citation Count. TM Today. 93,300. Second Opinion. 2,210,000. Third Opinion. zero. Language Support. Clojure. Language Support. Clojure. Scala. Language Support. Haskell.
E N D
Sweet Sixteen: How well is Transactional Memory Aging? Maurice Herlihy Brown University
Remember 1993? Damon June 2009
Citation Count Damon June 2009
TM Today 93,300 Damon June 2009
Second Opinion 2,210,000 Damon June 2009
Third Opinion zero Damon June 2009
Language Support Clojure Damon June 2009
Language Support Clojure Scala Damon June 2009
Language Support Haskell Clojure Scala Damon June 2009
Language Support Perl Haskell Clojure Scala Damon June 2009
Language Support Phython Perl Haskell Clojure Scala Damon June 2009
Language Support Phython Perl Haskell CaML Clojure Scala Damon June 2009
Language Support Phython Perl Java Haskell CaML Clojure Scala Damon June 2009
Language Support Phython Perl Java Haskell C++ CaML Clojure Scala Damon June 2009
Hatin’ on TM STM is too inefficient Damon June 2009
Hatin’ on TM Requires radical change in programming style Damon June 2009
Hatin’ on TM Erlang-style shared nothing only true path to salvation Damon June 2009
Hatin’ on TM There is nothing wrong with what we do today. Damon June 2009
Gartner Hype Cycle Hat tip: Jeremy Kemp Damon June 2009
Outline • What and why • Hardware TM • Software TM • Lock Elision • Conversion • User studies • Energy Damon June 2009
What is TM? • Hardware (HTM) Damon June 2009
What is TM? • Hardware (HTM) • Software (STM) atomic { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
What is TM? • Hardware (HTM) • Software (STM) • Lock Elision synchronized { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
Why TM? • Better lock-free data structures? a d b c Damon June 2009
Why TM? • Better lock-free data structures? • Better software engineering? Damon June 2009
Why TM? • Better lock-free data structures? • Better software engineering? • Better scalability? Damon June 2009
Why TM? • Better lock-free data structures? • Better software engineering? • Better scalability? • Better power? Damon June 2009
Outline • What and why • Hardware TM • Software TM • Lock Elision • Conversion • User studies • Energy Damon June 2009
HTM Original proposal Damon June 2009
HTM Stanford TCC Damon June 2009
HTM Wisconsin LogTM Damon June 2009
HTM Sun “Rock” Damon June 2009
HTM AMD Advanced Synchronization Facility Damon June 2009
HTM Strengths & Weaknesses • Ideal for lock-free data structures Damon June 2009
HTM Strengths & Weaknesses • Ideal for lock-free data structures • Practical proposals have limits on • Transaction size and length • Bounded HW resources • Guarantees vs best-effort Damon June 2009
HTM Strengths & Weaknesses • Ideal for lock-free data structures • Practical proposals have limits on • Transaction size and length • Bounded HW resources • Guarantees vs best-effort • On fail • Diagnostics essential • Retry in software? Damon June 2009
Composition Locks don’t compose, transactions do. Composition necessary for Software Engineering. But practical HTM doesn’treallysupport composition! Why we need STM Damon June 2009
Outline • What and why • Hardware TM • Software TM • Lock Elision • Conversion • User studies • Energy atomic { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
STM • Code appears to execute atomically atomic { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
STM • Code appears to execute atomically • Typically executed speculatively atomic { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
Some I/O revocable Provide transaction-safe libraries Undoable file system/DB calls Some not Dispensing cash Firing missile I/O & System Calls? Damon June 2009
How do transactional & non-transactional threads synchronize? Easy in HTM Not in STM Strong vs Weak Isolation Damon June 2009
Transactions act as if they acquire SGL Good: Intuitively appealing Bad: What about aborted transactions? Conditional synchronization? Single Global Lock Semantics? Damon June 2009
Outline • What and why • Hardware TM • Software TM • Lock Elision • Conversion • User studies • Energy lock(x) { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Damon June 2009
Lock Elision Transparently replace critical sections with transactions Damon June 2009
Lock Elision • Execute critical section speculatively Synchronize on data, not locks lock(x) { node.next = succ; node.prev = pred; succ.pred = node; pred.next = node; } Fall back to locking on repeated FAIL Damon June 2009
Benefits • Transparent • No need to retrain programmers Damon June 2009
Benefits • Transparent • No need to retrain programmers • Works on much legacy code • Not all, see Azul report below Damon June 2009
Benefits • Transparent • No need to retrain programmers • Works on much legacy code • Not all • Ideal for managed run-times Damon June 2009
Applied Lock Elision Lock Elision for contended Java synchronized blocks Good on some, modest on many, bad on few Gratuitous conflicts limit gains Rewriting helps, but tedious Damon June 2009