Is transactional programming actually easier?

Chip multi-processors (CMPs) have become ubiquitous, while tools that ease concurrent programming have not. The promise of increased performance for all applications through ever more parallel hardware requires good tools for concurrent programming, especially for average programmers. Transactional memory (TM) has enjoyed recent interest as a tool that can help programmers program concurrently. The transactional memory (TM) research community is heavily invested in the claim that programming with transactional memory is easier than alternatives (like locks), but evidence for or against the veracity of this claim is scant. In this paper, we describe a user-study in which 237 undergraduate students in an operating systems course implement the same programs using coarse and fine-grain locks, monitors, and transactions. We surveyed the students after the assignment, and examined their code to determine the types and frequency of programming errors for each synchronization technique. Inexperienced programmers found baroque syntax a barrier to entry for transactional programming. On average, subjective evaluation showed that students found transactions harder to use than coarse-grain locks, but slightly easier to use than fine-grained locks. Detailed examination of synchronization errors in the students' code tells a rather different story. Overwhelmingly, the number and types of programming errors the students made was much lower for transactions than for locks. On a similar programming problem, over 70% of students made errors with fine-grained locking, while less than 10% made errors with transactions.

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

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

[3]  Maurice Herlihy,et al.  Committing conflicting transactions in an STM , 2009, PPoPP '09.

[4]  Kunle Olukotun,et al.  Tradeoffs in transactional memory virtualization , 2006, ASPLOS XII.

[5]  Hany E. Ramadan,et al.  Dependence-Aware Transactional Memory , 2007 .

[6]  Mark Moir,et al.  PhTM: Phased Transactional Memory , 2007 .

[7]  Michael L. Scott,et al.  Flexible Decoupled Transactional Memory Support , 2008, 2008 International Symposium on Computer Architecture.

[8]  Mark Moir,et al.  Early experience with a commercial hardware transactional memory implementation , 2009, ASPLOS.

[9]  Anas N. Al-Rabadi,et al.  A comparison of modified reconstructability analysis and Ashenhurst‐Curtis decomposition of Boolean functions , 2004 .

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

[11]  Maurice Herlihy,et al.  A flexible framework for implementing software transactional memory , 2006, OOPSLA '06.

[12]  Donald E. Porter,et al.  MetaTM/TxLinux: Transactional Memory for an Operating System , 2008, IEEE Micro.

[13]  David A. Wood,et al.  TokenTM: Efficient Execution of Large Transactions with Hardware Transactional Memory , 2008, 2008 International Symposium on Computer Architecture.

[14]  Victor Pankratius,et al.  Does Transactional Memory Keep Its Promises? Results from an Empirical Study. , 2009 .

[15]  Adam Welc,et al.  Design and implementation of transactional constructs for C/C++ , 2008, OOPSLA '08.

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

[17]  Craig B. Zilles,et al.  Using Hardware Memory Protection to Build a High-Performance, Strongly-Atomic Hybrid Transactional Memory , 2008, 2008 International Symposium on Computer Architecture.

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

[19]  David A. Wood,et al.  LogTM-SE: Decoupling Hardware Transactional Memory from Caches , 2007, 2007 IEEE 13th International Symposium on High Performance Computer Architecture.

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

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

[22]  David Eisenstat,et al.  Lowering the Overhead of Nonblocking Software Transactional Memory , 2006 .

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

[24]  David Eisenstat,et al.  Lowering the Overhead of Software Transactional Memory , 2006 .

[25]  Jan-Willem Maessen,et al.  Split hardware transactions: true nesting of transactions using best-effort hardware transactional memory , 2008, PPOPP.

[26]  Kunle Olukotun,et al.  Transactional memory coherence and consistency , 2004, Proceedings. 31st Annual International Symposium on Computer Architecture, 2004..

[27]  Cong Wang,et al.  NZTM: nonblocking zero-indirection transactional memory , 2009, SPAA '09.

[28]  Emmett Witchel,et al.  Maximum benefit from a minimal HTM , 2009, ASPLOS.

[29]  Steve Keckler,et al.  Proceedings of the 36th annual international symposium on Computer architecture , 2009, ISCA 2009.

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

[31]  Virendra J. Marathe,et al.  Capabilities and Limitations of Library-Based Software Transactional Memory in C++ , 2007 .

[32]  Yossi Lev Brown PhTM : Phased Transactional Memory ∗ , 2007 .

[33]  Milo M. K. Martin,et al.  Making the fast case common and the uncommon case simple in unbounded transactional memory , 2007, ISCA '07.

[34]  Maurice Herlihy,et al.  Virtualizing Transactional Memory , 2005, ISCA 2005.