unreadTVar: Extending Haskell Software Transactional Memory for Performance

As new trends in computer architecture lead towards shared-memory chip multiprocessors (CMP), the rules for programming these machines are significantly changing. In the search for alternatives to deadlock-prone lock-based concurrency protocols, Software Transactional Memory (STM) extensions to Haskell have provided an easy-to-use lock-free abstraction mechanism for concurrent programming, using atomically composed blocks operating on transactional variables. However, as in the case for linked structures, the composition of these atomic blocks require extra attention, as the transactional management might act overconservatively by keeping track of more variables than necessary, causing an overall decrease in performance. To remedy this situation, we have extended the Transactional Memory module of the Glasgow Haskell Compiler (GHC) 6.6 to support a construct that allows the removal of a transactional variable from the readset. Although this construct that we term unreadTVar, when not applied carefully, might put the strong atomicity guarantees of STM at risk, the experimentations done with linked lists and binary trees show that it can significantly improve execution time and memory usage when traversing transactional linked structures. 1Barcelona Supercomputing Center, Barcelona/Spain; Email:{nehir.sonmez,cristian.perfumo,srdjan.stipic,adrian.cristal, osman.unsal,mateo.valero}@bsc.es 2Computer Architecture Department – Universitat Politecnica de Catalunya

[1]  Frank Huch,et al.  Composable Memory Transactions in Concurrent Haskell , 2006 .

[2]  C. Kozyrakis,et al.  Early Release : Friend or Foe ? , 2006 .

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

[4]  Simon L. Peyton Jones,et al.  Lock Free Data Structures Using STM in Haskell , 2006, FLOPS.

[5]  Eduard Ayguadé,et al.  Transactional Memory: An Overview , 2007, IEEE Micro.

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

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

[8]  Martin Sulzmann,et al.  A concurrent constraint handling rules implementation in Haskell with software transactional memory , 2007, DAMP '07.

[9]  Mateo Valero,et al.  Dissecting Transactional Executions in Haskell , 2007 .

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

[11]  Simon Peyton Jones,et al.  Transactional memory with data invariants , 2006 .

[12]  Simon L. Peyton Jones,et al.  Concurrent Haskell , 1996, POPL '96.

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

[14]  Keir Fraser,et al.  Practical lock-freedom , 2003 .

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

[16]  Håkan Sundell,et al.  Efficient and Practical Non-Blocking Data Structures , 2004 .