Preventing versus curing: avoiding conflicts in transactional memories

Aleksandar Dragojevic, Rachid Guerraoui, Anmol V. Singh, Vasu Singh

Abstract

Transactional Memory (TM) simplifies parallel programming by providing an atomic block abstraction. However, most TMs rely on speculative execution, "curing" conflicts only after they occur through aborts and restarts. This paper introduces Shrink, a proactive scheduler that prevents conflicts by predicting transaction access patterns. By using temporal locality and serialization affinity, Shrink achieves up to 100x performance improvements in high-contention scenarios.

Introduction: The Cost of Speculation

Transactional Memory is a powerful tool for concurrency, but its standard "speculate-and-restart" model struggles under high contention. When multiple threads compete for the same data, transactions frequently abort, leading to wasted computational effort and potential livelock. Traditional contention managers attempt to "cure" these issues after the fact, but often resort to coarse serialization that unnecessarily limits parallelism.

Figure 1: Transaction interleaving where coarse serialization can hinder parallelism by blocking non-conflicting operations.

The Shrink Scheduler: Proactive Prevention

The authors argue that preventing conflicts is more efficient than curing them. They propose Shrink, a scheduler that predicts the read and write sets of transactions before they execute. Shrink utilizes three primary mechanisms:

  1. Read Set Prediction: Leverages temporal locality via Bloom filters to track frequently accessed addresses. If an address appears often in recent commits, Shrink predicts it will be read again.
  2. Write Set Prediction: Assumes that a restarted transaction will likely target the same addresses that caused its previous abort, as write sets are often small and dynamic.
  3. Serialization Affinity: A probabilistic heuristic that delays transactions based on system contention levels. This prevents over-serialization in low-contention environments while providing a "safety valve" for overloaded systems.

Evaluation and Key Insights

Shrink was evaluated using benchmarks like STMBench7 and STAMP. A critical finding is that memory access patterns are surprisingly predictable despite the dynamic nature of parallel workloads.

Figure 2: Read and write set prediction accuracy on STMBench7, demonstrating consistent performance across different workload types.

As shown in Figure 2, Shrink achieves high prediction accuracy across various workloads. For instance, read set prediction accuracy often exceeds 70-80% in read-dominated scenarios. This accuracy allows the scheduler to make informed decisions about when to delay a transaction rather than allowing it to run and inevitably abort.

Performance Results

Integrating Shrink into existing software TMs yielded dramatic results:

  • SwissTM: Performance gains of up to 120% on STAMP benchmarks in overloaded cases.
  • TinySTM: Throughput increased by up to 100x in high-contention scenarios, effectively preventing the performance collapse typically seen in TinySTM under load.
  • Low Overhead: The prediction logic introduced only a 13% performance hit in single-threaded microbenchmarks, which quickly became negligible as more threads were added.

Conclusion

Shrink demonstrates that proactive conflict prevention is a viable and highly effective strategy for Transactional Memory. By shifting the focus from "curing" aborts to "preventing" them through intelligent scheduling, TMs can maintain high performance even in the most demanding, high-contention environments.

Summary updated

BibTeX
@inproceedings{dragojevic2009preventing,
  author = {Aleksandar Dragojevic and Rachid Guerraoui and Anmol V. Singh and Vasu Singh},
  title = {{Preventing versus curing: avoiding conflicts in transactional memories}},
  booktitle = {PODC},
  year = {2009},
  doi = {10.1145/1582716.1582725},
}
Figure