一句话:提出新 freshness 时间戳、专用数据结构与算法,降低采样式 HB 数据竞争检测的时间戳开销,并证明其实例最优。
基于 happens-before 偏序的动态数据竞争检测已成为发现多线程程序数据竞争的主流方法。这类实现通常用时间戳推断事件因果关系,并在每个事件更新 vector clock,导致严重开销。随机采样可望降低开销,但现有时间戳算法未针对采样优化,当采样事件远少于总事件时仍有大量无用工作。本文研究低开销采样式竞争检测中的时间戳任务,提出 freshness 时间戳概念、新的时间戳存储数据结构,以及结合两者的算法。作者证明该算法的 vector clock 遍历次数受采样事件数与线程数约束,并在给定动态执行上接近任何时间戳算法必须完成的工作量,即实例最优。在真实基准上的评估表明,其效果优于此前与采样无关的时间戳算法。
Dynamic race detection based on the happens before (HB) partial order has now become the de facto approach to quickly identify data races in multi-threaded software. Most practical implementations for detecting these races use timestamps to infer causality between events and detect races based on these timestamps. Such an algorithm updates timestamps (stored in vector clocks) at every event in the execution, and is known to induce excessive overhead. Random sampling has emerged as a promising algorithmic paradigm to offset this overhead. It offers the promise of making sound race detection scalable. In this work we consider the task of designing an efficient sampling based race detector with low overhead for timestamping when the number of sampled events is much smaller than the total events in an execution. To solve this problem, we propose (1) a new notion of freshness timestamp , (2) a new data structure to store timestamps, and (3) an algorithm that uses a combination of them to reduce the cost of timestamping in sampling based race detection. Further, we prove that our algorithm is close to optimal — the number of vector clock traversals is bounded by the number of sampled events and number of threads, and further, on any given dynamic execution, the cost of timestamping due to our algorithm is close to the amount of work any timestamping-based algorithm must perform on that execution, that is it is instance optimal. Our evaluation on real world benchmarks demonstrates the effectiveness of our proposed algorithm over prior timestamping algorithms that are agnostic to sampling.
@article{paperbot3071,
title = {Efficient Timestamping for Sampling-Based Race Detection},
author = {Minjian Zhang and Daniel Wee Soong Lim and Mosaad Al Thokair and Umang Mathur and Mahesh Viswanathan},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {PLDI},
year = {2025},
doi = {10.1145/3729252}
}