From lock to correct and efficient software transactional memory

Transactional memory solves many problems in lock-based parallel programs. Unfortunately, the semantics of transactions are different from those of critical sections defined by locks. The semantic differences make it difficult to correctly port existing lock-based programs to transaction-based programs. Experienced programmers accustomed to lock-based programming can easily make mistakes in transaction-based programming as parallel programs running correctly using locks can run incorrectly when converted to using transactions. This problem becomes even more severe in the efficient software transactional memory implementing weak isolation, optimistic read concurrency management and eager version management. In this paper, we first identify three necessary properties in a program for the program execution using transactions to be equivalent to the program execution using locks. Assuming that the input lock-based program satisfies the necessary properties (i.e. well-behaved parallel programs), we next present a correctness condition for the program execution using transactions to be equivalent to the program execution using locks. Finally, we develop a correct and efficient software transactional memory implementation that satisfies the correctness condition so that locks in the well behaved parallel programs can be converted to use efficient software transactional memory easily and correctly.

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

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

[3]  Bratin Saha,et al.  McRT-STM: a high performance software transactional memory system for a multi-core runtime , 2006, PPoPP '06.

[4]  Paul Petersen,et al.  Unraveling Data Race Detection in the Intel ® Thread Checker , 2006 .

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

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

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

[8]  Mark Moir,et al.  Hybrid transactional memory , 2006, ASPLOS XII.

[9]  David Eisenstat,et al.  Hardware Acceleration of Software Transactional Memory , 2005 .

[10]  Adam Welc,et al.  Single global lock semantics in a weakly atomic STM , 2008, SIGP.

[11]  Nir Shavit,et al.  Transactional Locking II , 2006, DISC.

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

[13]  Kunle Olukotun,et al.  Architectural Semantics for Practical Transactional Memory , 2006, 33rd International Symposium on Computer Architecture (ISCA'06).

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

[15]  Bradley C. Kuszmaul,et al.  Unbounded Transactional Memory , 2005, HPCA.

[16]  Ali-Reza Adl-Tabatabai,et al.  McRT-Malloc: a scalable transactional memory allocator , 2006, ISMM '06.

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

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

[19]  Bratin Saha,et al.  Code Generation and Optimization for Transactional Memory Constructs in an Unmanaged Language , 2007, International Symposium on Code Generation and Optimization (CGO'07).

[20]  Maurice Herlihy,et al.  Software transactional memory for dynamic-sized data structures , 2003, PODC '03.

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

[22]  David A. Wood,et al.  LogTM: log-based transactional memory , 2006, The Twelfth International Symposium on High-Performance Computer Architecture, 2006..

[23]  Torvald Riegel,et al.  A Lazy Snapshot Algorithm with Eager Validation , 2006, DISC.