Strong Atomicity for Java Without Virtual-Machine Support

We present an implementation and evaluation of atomicity (also known as software transactions) for a dialect of Java. Our implementation is fundamentally different from prior work in three respects: (1) It is entirely a source-tosource transformation, producing Java source code that can be compiled by any Java compiler and run on any Java Virtual Machine. (2) It can enforce “strong” atomicity without assuming special hardware or a uniprocessor. (3) The implementation uses locks rather than software-transactionalmemory, but it cannot deadlock and requires inter-thread communication only when there is data contention. We evaluate our approach by qualitatively considering its overhead, quantitatively measuring the performance impact on benchmarks, and considering several difficult interactions with other language features. We conclude that it is possible to support “strong” atomicity and separate compilation, but simple whole-program optimizations improve performance significantly. In particular, a simple and effective analysis can identify fields that are never accessed in an atomic block.

[1]  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 .

[2]  Dan Grossman,et al.  AtomCaml: first-class atomicity via rollback , 2005, ICFP '05.

[3]  Victor Luchangco,et al.  The Fortress Language Specification Version 1.0 , 2007 .

[4]  Bjarne Steensgaard,et al.  Integrating support for undo with exception handling , 2004 .

[5]  Antony L. Hosking,et al.  Nested Transactional Memory: Model and Preliminary Architecture Sketches , 2005 .

[6]  Timothy L. Harris,et al.  Exceptions and side-effects in atomic blocks , 2005, Sci. Comput. Program..

[7]  Martín Abadi,et al.  Types for safe locking: Static race detection for Java , 2006, TOPL.

[8]  Maurice Herlihy,et al.  Virtualizing transactional memory , 2005, 32nd International Symposium on Computer Architecture (ISCA'05).

[9]  Jeremy Manson,et al.  The Java memory model , 2005, POPL '05.

[10]  Urs Hölzle,et al.  Removing unnecessary synchronization in Java , 1999, OOPSLA '99.

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

[12]  Bradley C. Kuszmaul,et al.  Unbounded transactional memory , 2005, 11th International Symposium on High-Performance Computer Architecture.

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

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

[15]  Stephen N. Freund,et al.  Type inference for atomicity , 2005, TLDI '05.

[16]  David Gay,et al.  Autolocker: synchronization inference for atomic sections , 2006, POPL '06.

[17]  Suresh Jagannathan,et al.  Transactional Monitors for Concurrent Objects , 2004, ECOOP.

[18]  Bruno Blanchet,et al.  Escape analysis for object-oriented languages: application to Java , 1999, OOPSLA '99.

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

[20]  Vivek Sarkar,et al.  X10: an object-oriented approach to non-uniform cluster computing , 2005, OOPSLA '05.

[21]  Nir Shavit,et al.  Software transactional memory , 1995, PODC '95.

[22]  Simon L. Peyton Jones,et al.  Haskell on a shared-memory multiprocessor , 2005, Haskell '05.

[23]  Kunle Olukotun,et al.  The Atomos transactional programming language , 2006, PLDI '06.

[24]  Kunle Olukotun,et al.  Programming with transactional coherence and consistency (TCC) , 2004, ASPLOS XI.

[25]  Michael R. Clarkson,et al.  Polyglot: An Extensible Compiler Framework for Java , 2003, CC.

[26]  Jan Vitek,et al.  Preemptible atomic regions for real-time Java , 2005, 26th IEEE International Real-Time Systems Symposium (RTSS'05).

[27]  Jong-Deok Choi,et al.  Escape analysis for Java , 1999, OOPSLA '99.

[28]  Milo M. K. Martin,et al.  Deconstructing transactions: The subtleties of atomicity , 2005 .

[29]  Emin Gün Sirer,et al.  Comprehensive synchronization elimination for Java , 2003, Sci. Comput. Program..

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