计算机应用 ›› 2019, Vol. 39 ›› Issue (1): 61-65.DOI: 10.11772/j.issn.1001-9081.2018071605

• 2018年全国开放式分布与并行计算学术年会(DPCS 2018)论文 • 上一篇    下一篇

并发程序中数据竞争检测方法

张杨, 梁亚楠, 张冬雯, 孙仕欣   

  1. 河北科技大学 信息科学与工程学院, 石家庄 050000
  • 收稿日期:2018-07-19 修回日期:2018-08-13 出版日期:2019-01-10 发布日期:2019-01-21
  • 通讯作者: 张冬雯
  • 作者简介:张杨(1980-),男,河北秦皇岛人,副教授,博士,CCF会员,主要研究方向:并发软件分析;梁亚楠(1991-),女,河北邢台人,硕士研究生,主要研究方向:并发软件分析;张冬雯(1964-),女,河北石家庄人,教授,博士,CCF会员,主要研究方向:并发软件分析;孙仕欣(1994-),女,河北石家庄人,硕士研究生,主要研究方向:并发软件分析。
  • 基金资助:
    国家自然科学基金资助项目(61440012);河北省自然科学基金资助项目(F2016208007);河北省基础研究计划重点基础专项(18960106D)。

Data race detection approach in concurrent programs

ZHANG Yang, LIANG Yanan, ZHANG Dongwen, SUN Shixin   

  1. School of Information Science and Engineering, Hebei University of Science and Technology, Shijiazhuang Hebei 050000, China
  • Received:2018-07-19 Revised:2018-08-13 Online:2019-01-10 Published:2019-01-21
  • Supported by:
    This work is partially supported by the National Natural Science Foundation of China (61440012), the Natural Science Foundation of Hebei Province (F2016208007), the Fundamental Research Program of Hebei Province (18960106D).

摘要: 针对数据竞争检测过程中的误报和漏报问题,提出一种静态数据竞争检测方法。首先,使用控制流分析自动构造线程内和线程间函数调用图;然后,收集线程内变量访问事件信息,定义竞争产生条件并分析检测出所有可能的竞争;其次,为了提高检测的准确率,进行别名变量和别名锁的分析降低漏报和误报;最后,通过控制流分析来抽象访问事件之间的时序关系,并结合程序切片技术对访问事件的发生序关系进行判断,以此避免因忽略线程交互带来的误报。依据该方法,使用Java语言在Soot软件分析框架下实现了一个数据竞争检测工具。在实验中,对JGF和IBM Contest基准测试套件中的raytracer和airline等程序进行数据竞争检测,并与目前已有的数据竞争检测算法和工具(HB算法和RVPredict)进行对比。实验结果表明,与HB算法和RVPredict工具相比,该方法检测到的数据竞争总数分别增加了81%和16%,数据竞争检测的准确率分别提升了约14%和19%,有效地避免了数据竞争检测中的漏报和误报现象。

关键词: 并发程序, 数据竞争, 控制流分析, 别名分析, 程序切片

Abstract: Aiming at the problems of false positive and false negatives in data race detection, a novel static data race detection approach was proposed. Firstly, intra-thread and inter-thread function call graphs were automatically constructed via control flow analysis. Secondly, the information of variable-access events within thread were collected, and possible races were detected based on the defined data race conditions. Then, in order to improve the detection accuracy, alias variables and alias locks were analyzed to reduce false negatives and false positives, respectively. Finally, the sequential relationship between access events was abstracted through control flow analysis, and program slicing was used to determine the happens-before relationship of access events, thereby reducing false positives caused by ignoring thread interactions. A data race detection tool was implemented by Java and Soot framework based on this approach. In the experimentation, several benchmarks from JGF and IBM Contest benchmark suites, such as raytracer and airline, were selected for evaluation, and the results were compared with existing data race detection algorithm and tool (HB (Happens-Before) and RVPredict). The experimental results show that, compared with algorithm HB and tool RVPredict, total number of data races detected by the proposed approach are increased by 81% and 16% respectively, the accuracy of this approach for data race detection are respectively increased by 14% and 19%, which effectively avoids false negatives and false positives.

Key words: concurrent program, data race, control flow analysis, alias analysis, program slicing

中图分类号: