Preventing versus curing: avoiding conflicts in transactional memories

Transactional memories are typically speculative and rely on contention managers to cure conflicts. This paper explores a complementary approach that prevents conflicts by scheduling transactions according to predictions on their access sets. We first explore the theoretical boundaries of this approach and prove that (1) a TM scheduler with an accurate prediction can be 2-competitive with an optimal offline TM scheduler, but (2) even a slight inaccuracy in prediction makes the competitive ratio of the TM scheduler in the order of the number of transactions. We then show that, in practice, there is room for a pragmatic approach with good average case performance. We present Shrink, a scheduler that (1) bases its prediction of transactional accesses on the access patterns of the past transactions from the same thread, and (2) uses a novel heuristic, which we call serialization affinity, to schedule transactions with a probability proportional to the current amount of contention. Shrink obtains roughly 70% accurate read and write access predictions on STMBench7 and STAMP. In our experimental evaluation, Shrink significantly improves STM performance in cases the number of executing threads is higher than the number of available CPU cores. For SwissTM, Shrink improves the performance by up to 55% on STMBench7, and up to 120% on STAMP. For TinySTM, Shrink drastically improves the performance on STMBench7 and STAMP benchmarks.

[1]  K. Kavi Cache Memories Cache Memories in Uniprocessors. Reading versus Writing. Improving Performance , 2022 .

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

[3]  Donald E. Porter,et al.  TxLinux: using and managing hardware transactional memory in an operating system , 2007, SOSP.

[4]  Hsien-Hsin S. Lee,et al.  Adaptive transaction scheduling for transactional memory systems , 2008, SPAA '08.

[5]  Virgílio A. F. Almeida,et al.  Characterizing reference locality in the WWW , 1996, Fourth International Conference on Parallel and Distributed Information Systems.

[6]  Danny Hendler,et al.  CAR-STM: scheduling-based collision avoidance and resolution for software transactional memory , 2008, PODC '08.

[7]  Torvald Riegel,et al.  Time-based transactional memory with scalable time bases , 2007, SPAA '07.

[8]  Kunle Olukotun,et al.  STAMP: Stanford Transactional Applications for Multi-Processing , 2008, 2008 IEEE International Symposium on Workload Characterization.

[9]  Mikel Luján,et al.  Steal-on-Abort: Improving Transactional Memory Performance through Dynamic Transaction Reordering , 2008, HiPEAC.

[10]  Anmol Tomar Dynamic Prediction based Scheduling for TM , 2008 .

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

[12]  Per Stenström,et al.  Intermediate checkpointing with conflicting access prediction in transactional memory systems , 2008, 2008 IEEE International Symposium on Parallel and Distributed Processing.

[13]  Kevin E. Moore,et al.  Log-based transactional memory , 2007 .

[14]  William N. Scherer,et al.  Advanced contention management for dynamic software transactional memory , 2005, PODC '05.

[15]  Rajeev Motwani,et al.  Non-clairvoyant scheduling , 1994, SODA '93.

[16]  Jan Vitek,et al.  STMBench7: a benchmark for software transactional memory , 2007, EuroSys '07.

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

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

[19]  Hagit Attiya,et al.  Transactional Contention Management as a Non-Clairvoyant Scheduling Problem , 2010, Algorithmica.

[20]  Rachid Guerraoui,et al.  Stretching transactional memory , 2009, PLDI '09.

[21]  Rachid Guerraoui,et al.  Polymorphic Contention Management , 2005, DISC.