Dynamic optimization for efficient strong atomicity

Transactional memory (TM) is a promising concurrency control alternative to locks. Recent work has highlighted important memory model issues regarding TM semantics and exposed problems in existing TM implementations. For safe, managed languages such as Java, there is a growing consensus towards strong atomicity semantics as a sound, scalable solution. Strong atomicity has presented a challenge to implement efficiently because it requires instrumentation of non-transactional memory accesses, incurring significant overhead even when a program makes minimal or no use of transactions. To minimize overhead, existing solutions require either a sophisticated type system, specialized hardware, or static whole-program analysis. These techniques do not translate easily into a production setting on existing hardware. In this paper, we present novel dynamic optimizations that significantly reduce strong atomicity overheads and make strong atomicity practical for dynamic language environments. We introduce analyses that optimistically track which non-transactional memory accesses can avoid strong atomicity instrumentation, and we describe a lightweight speculation and recovery mechanism that applies these analyses to generate speculatively-optimized but safe code for strong atomicity in a dynamically-loaded environment. We show how to implement these mechanisms efficiently by leveraging existing dynamic optimization infrastructure in a Java system. Measurements on a set of transactional and non-transactional Java workloads demonstrate that our techniques substantially reduce the overhead of strong atomicity from a factor of 5x down to 10% or less over an efficient weak atomicity baseline.

[1]  Adam Welc,et al.  Practical weak-atomicity semantics for java stm , 2008, SPAA '08.

[2]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[3]  Jong-Deok Choi,et al.  Efficient and precise datarace detection for multithreaded object-oriented programs , 2002, PLDI '02.

[4]  Keir Fraser,et al.  Language support for lightweight transactions , 2003, SIGP.

[5]  No License,et al.  Intel ® 64 and IA-32 Architectures Software Developer ’ s Manual Volume 3 A : System Programming Guide , Part 1 , 2006 .

[6]  Thomas R. Gross,et al.  Object race detection , 2001, OOPSLA '01.

[7]  Hanspeter Mössenböck,et al.  Escape analysis in the context of dynamic compilation and deoptimization , 2005, VEE '05.

[8]  Jan Vitek,et al.  Confined types , 1999, OOPSLA '99.

[9]  Ondrej Lhoták,et al.  Run‐time evaluation of opportunities for object inlining in Java , 2005, Concurr. Pract. Exp..

[10]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multi-threaded programs , 1997, TOCS.

[11]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[12]  Nikita Borisov,et al.  Fixing Races for Fun and Profit: How to Abuse atime , 2005, USENIX Security Symposium.

[13]  Thomas R. Gross,et al.  Static conflict analysis for multi-threaded object-oriented programs , 2003, PLDI '03.

[14]  Hanspeter Mössenböck,et al.  Automatic feedback-directed object inlining in the java hotspot™ virtual machine , 2007, VEE '07.

[15]  Alexander Aiken,et al.  Effective static race detection for Java , 2006, PLDI '06.

[16]  Benjamin Hindman,et al.  Strong Atomicity for Java Without Virtual-Machine Support , 2006 .

[17]  Ondrej Lhoták,et al.  Run-time evaluation of opportunities for object inlining in Java , 2002, JGI '02.

[18]  Maurice Herlihy,et al.  Transactional Memory: Architectural Support For Lock-free Data Structures , 1993, Proceedings of the 20th Annual International Symposium on Computer Architecture.

[19]  Benjamin Hindman,et al.  Atomicity via source-to-source translation , 2006, MSPC '06.

[20]  Simon L. Peyton Jones,et al.  Composable memory transactions , 2005, CACM.

[21]  Dan Grossman,et al.  High-level small-step operational semantics for transactions , 2008, POPL '08.

[22]  Andrew A. Chien,et al.  An automatic object inlining optimization and its evaluation , 2000, PLDI '00.

[23]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[24]  Vivek Sarkar,et al.  Dynamic optimistic interprocedural analysis: a framework and an application , 2001, OOPSLA '01.

[25]  James Noble,et al.  Saving the world from bad beans: deployment-time confinement checking , 2003, OOPSLA 2003.

[26]  Jong-Deok Choi,et al.  Stack allocation and synchronization optimizations for Java using escape analysis , 2003, TOPL.

[27]  Milo M. K. Martin,et al.  Subtleties of transactional memory atomicity semantics , 2006, IEEE Computer Architecture Letters.

[28]  James Noble,et al.  Saving the world from bad beans: deployment-time confinement checking , 2003, OOPSLA '03.

[29]  Brian T. Lewis,et al.  Compiler and runtime support for efficient software transactional memory , 2006, PLDI '06.

[30]  Martín Abadi,et al.  Semantics of transactional memory and automatic mutual exclusion , 2008, POPL '08.

[31]  Mark Plesko,et al.  Optimizing memory transactions , 2006, PLDI '06.

[32]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[33]  Dan Grossman,et al.  What do high-level memory models mean for transactions? , 2006, MSPC '06.

[34]  Martin C. Rinard,et al.  Ownership types for safe region-based memory management in real-time Java , 2003, PLDI '03.

[35]  Dan Grossman,et al.  Enforcing isolation and ordering in STM , 2007, PLDI '07.

[36]  Frédéric Vivien,et al.  Incrementalized pointer and escape analysis , 2001, PLDI '01.

[37]  Toshiaki Yasue,et al.  A study of devirtualization techniques for a Java Just-In-Time compiler , 2000, OOPSLA '00.

[38]  Monica S. Lam,et al.  A practical flow-sensitive and context-sensitive C and C++ memory leak detector , 2003, PLDI '03.