Introduction
As software systems scale toward massive parallelism, data races have emerged as a primary source of "Heisenbugs"—elusive errors that occur when two threads access the same memory location simultaneously without proper synchronization. These bugs are notoriously difficult to reproduce and debug. While dynamic analysis tools offer high precision with zero false alarms, their extreme performance overhead (often 10x to 200x slowdown) makes them impractical for production environments.
FRESA (Frequency-Sensitive Sampling-Based Approach) addresses this challenge by introducing an intelligent, adaptive sampling mechanism that significantly reduces overhead without sacrificing the ability to find unique bugs.
The Frequency-Sensitive Insight
The core innovation of FRESA lies in its observation of memory access patterns. In typical software execution, memory access is highly imbalanced: a small number of "hot" locations are accessed millions of times, while the vast majority of locations are "cold" and accessed infrequently.
Traditional sampling-based detectors like PACER treat all memory locations equally. FRESA's authors argue this is inefficient. In well-tested software, frequently accessed regions are likely already debugged. The rare, elusive races are more likely to hide in the "cold" regions. By focusing sampling effort on these infrequently accessed locations, FRESA achieves a higher "return on investment" for its performance budget.
Methodology
FRESA builds upon the precise FASTTRACK algorithm and the sampling framework of PACER, adding an adaptive dispatch mechanism:
- Frequency Tracking: A hashtable tracks access counts for specific memory locations based on their allocation sites.
- Adaptive Grouping: Accesses are partitioned into five groups ($G_1$ to $G_5$) based on frequency.
- Exponential Decay Sampling: The sampling rate $r$ decreases exponentially as frequency increases ($r = r_0 / 2^j$). This ensures that "hot" spots are sampled less often, while "cold" spots receive more attention.
- Happens-Before Tracking: During sampling periods, FRESA maintains full "happens-before" relationships to ensure reported races are true positives.
Performance and Results
The authors evaluated FRESA using the DaCapo benchmark suite (eclipse, hsqldb, and xalan) on the Jikes RVM. The results demonstrate that FRESA consistently outperforms previous state-of-the-art tools in both speed and memory efficiency.
At a 1% target sampling rate, FRESA incurs a slowdown of less than 3x, compared to the 10x slowdown seen with full 100% detection. As shown in the performance comparison, FRESA maintains a lower slowdown factor than PACER across various sampling rates, particularly for the eclipse benchmark. Furthermore, FRESA's memory footprint at low sampling rates is significantly smaller than PACER's, making it a more viable candidate for deployment in resource-constrained or production environments.
Crucially, this performance gain does not come at the cost of bug detection. Because FRESA avoids wasting samples on redundant "hot" locations, it can detect a higher percentage of distinct races for the same performance budget compared to uniform sampling methods.
Conclusion
FRESA demonstrates that frequency-sensitive sampling is a powerful technique for making dynamic data race detection practical. By aligning sampling intensity with the statistical likelihood of finding new bugs, FRESA slashes overhead and memory usage. Future work aims to optimize the frequency tracking hashtable and extend this approach to other types of concurrency violations, such as atomicity or order violations.
Summary updated