HAVE: Integrated Dynamic and Static Analysis for Atomicity Violations

Qichang Chen, Liqiang Wang, Zijiang Yang, and Scott D. Stoller

The reality of multi-core hardware has made concurrent programs pervasive. Unfortunately, writing correct concurrent programs is difficult. Atomicity violation, which is caused by concurrent executions unexpectedly violating the atomicity of a certain code region, is one of the most common concurrency errors. However, atomicity violation bugs are hard to find using traditional testing and debugging techniques.

In this paper we present a hybrid approach that integrates static and dynamic analyses to attack this problem. We first perform static analysis to obtain summaries of synchronizations and accesses to shared variables. The static summaries are then instantiated with runtime values during dynamic executions to speculatively approximate the behaviors of the branches that are not taken. Compared to dynamic analysis, the hybrid approach is able to detect atomicity violations in unexecuted parts of the code. Compared to static analysis, the hybrid approach produces fewer false alarms. We have implemented this hybrid analysis in a tool called HAVE to detect atomicity violations in multi-threaded Java programs. The experiments on several benchmarks and real-world applications demonstrate promising results.