unreadTVar: Extending Haskell Software Transactional Memory for Performance.
Nehir Sönmez, Cristian Perfumo, Srdjan Stipić, Adrián Cristal, Osman Ünsal, Mateo Valero · 2007
Abstract: As new trends in computer architecture lead towards shared-memory chip multiprocessors (CMP), the rules for programming these machines are signif-icantly changing. In the search for alternatives to deadlock-prone lock-based con-currency protocols, Software Transactional Memory (STM) extensions to Haskell have provided an easy-to-use lock-free abstraction mechanism for concurrent pro-gramming, using atomically composed blocks operating on transactional vari-ables. 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 experi-mentations done with linked lists and binary trees show that it can significantly improve execution time and memory usage when traversing transactional linked structures.