Efficient Timestamping for Sampling-based Race Detection

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Minjian, Lim, Daniel Wee Soong, Thokair, Mosaad Al, Mathur, Umang, Viswanathan, Mahesh
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916681119432704
author Zhang, Minjian
Lim, Daniel Wee Soong
Thokair, Mosaad Al
Mathur, Umang
Viswanathan, Mahesh
author_facet Zhang, Minjian
Lim, Daniel Wee Soong
Thokair, Mosaad Al
Mathur, Umang
Viswanathan, Mahesh
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2504_06688
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Efficient Timestamping for Sampling-based Race Detection
Zhang, Minjian
Lim, Daniel Wee Soong
Thokair, Mosaad Al
Mathur, Umang
Viswanathan, Mahesh
Programming Languages
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.
title Efficient Timestamping for Sampling-based Race Detection
topic Programming Languages
url https://arxiv.org/abs/2504.06688