计算机科学 ›› 2020, Vol. 47 ›› Issue (10): 315-321.doi: 10.11896/jsjkx.190700079
李梦珂, 郑秋生, 王磊
LI Meng-ke, ZHENG Qiu-sheng, WANG Lei
摘要: 数据竞争是多线程程序并发错误的主要来源,目前已有许多静态和动态程序分析技术用于检测数据竞争,但这些检测器或者会产生巨大的检测开销,或者会漏掉许多真实的数据竞争错误。文中提出了一种基于优化的FastTrack算法和锁模式的动态混合数据竞争检测算法AsampleLock。该算法利用采样技术,监控同一时刻同时运行的来自并发线程的函数对,通过预竞争检测获得真正涉及数据竞争的内存访问对,从而减小竞争检测分析开销;为了减弱线程调度对算法相关性能的影响,AsampleLock算法采用nolock-hb关系来判断访问事件的并发关系;采用map记录所有共享变量的读写信息,并采用锁模式进行动态数据竞争检测,降低漏报率和误报率。基于上述方法实现了原型系统AsampleLock,选择基准测试集Parsec对该系统进行评估,并与FastTrack算法、LiteRace算法和Multilock-HB算法进行对比。实验结果表明,AsampleLock算法与FastTrack算法相比整体时间开销平均降低了8%;AsampleLock算法的数据竞争检测率与LiteRace算法和FastTrack算法相比分别增加了39%和27%。
中图分类号:
[1]LU S W,ZHOU Y.A study of interleaving co-verage criteria[C]//The 6th Joint Meeting on European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering:Companion Papers.ACM,2007:533-536. [2]LU S.How to deal with concurrent bugs in multithreaded programs[J].Communication of China Computer Society,2013,9(2):20-27. [3]LU S,PARK E,SEO,et al.Learning from mistake-s:A compre-hensive study on real world concurrency bug characteristics[C]//Proc. ASPLOS.2008:329-339. [4]JACKSON J.Nasdaq’s Facebook glitch came from ‘RaceConditions’[EB/OL].[2012-03-24].https://www.computerworld.com/article/2504676/nasdaq-s-facebook-glitch-came-from--race-conditions-.html. [5]JIMENEZ M,PAPADAKIS M,LE TRAON Y.Vulnerabilityprediction models:A case study on the Linux kernel[C]//2016 IEEE 16th International Working Conference on Source Code Analysis and Manipulation(SCAM).2016:1-10. [6]ENGLER D,ASHCRAFT K.RacerX:effective,static detection of race conditions and deadlocks[J].ACM SIGOPS Operating Systems Review,2003,37(5):237-252. [7]VOUNG J,JHALA R,LERNER S.RELAY:Static Race Detection on Millions of Lines of Code[C]//Joint Meeting of the European Software Engineering Conference & the ACM Sigsoft Symposium on the Foundations of Software Engineering.ACM,2007:205-214. [8]POZNIANSKI E,SCHUSTER A.Efficient On-the-Fly DataRace Detection in Multithreaded C++ Programs[C]//International Parallel & Distributed Processing Symposium.IEEE,2003:179-190. [9]CORMAC F S N F.FastTrack:Efficient and precise dynamicrace detection[J].ACM SIGPLAN Notices,2009,44(6):121-133. [10]CAI Y,CHANW K.LOFT:Redundant Synchronization Event Removal for Data Race Detection[C]//IEEE International Symposium on Software Reliability Engineering.IEEE,2011:160-169. [11]YANG Z,YU Z,SU X,et al.RaceTracker:Effec-tive and efficient detection of data races[C]//2016 17th IEEE/ACIS International Conference on Software Engineering,Artificial Intelligence,Networking and Parallel/Distributed Computing (SNPD).IEEE Computer Society,2016:293-300. [12]XIE X,XUE J,ZHANG J.Acculock:Accurate and Efficient Detection of Data Races[C]//IEEE/ACM International Sympos-ium on Code Generation & Optimization.IEEE,2011:201-212. [13]XIE X,XUE J,ZHANG J.Acculock:accurate and efficient de-tection of data races[J].Software:Practice and Experience,2013,43(5):543-576. [14]YU M,YOO S K,BAED H.SimpleLock:Fast and Accurate Hybrid Data Race Detector[C]//International Conference onPa-rallel & Distributed Computing.IEEE,2014:50-56. [15]YU M,LEE J,BAE D,et al.AdaptiveLock:Efficient Hybrid Data Race Detection Based on Real-World Locking Patterns[J].International Journal of Parallel Programming,2019,47(7):805-837. [16]BIENIA C.Thesis:Benchmarking modern multiprocessors[D].Princeton University,2011. [17]LAMPORT L.Time,clocks,and the orde-ring of events in a distributed system[J].Communications of the ACM,1978,21(7):558-565. [18]GUO Y,CAI Y,YANG Z.AtexRace:across thread and execution sampling for in house race detection[C]//Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering.ACM,2017:315-325. [19]MARINO D,MUSUVATHI M,NARAYANASAMY S.LiteRace:effective sampling for lightweight data race detection[C]//ACM Sigplan Notices.ACM,2009:134-143. [20]BOND M D,COONS K E,MCKINLEY K S.PACER:proportional detection of data races[C]//ACM Sigplan Notices.ACM,2010:255-268. [21]YU M,BAE D H.SimpleLock+:fast and accurate hybrid data race detection[J].The Computer Journal,2016,59(6):793-809. [22]LUK C K,COHN R S,MUTH R,et al.Pin:Building Customized Program Analysis Tools with Dynamic Instrumentation[C]//ACM Sigplan Notices.ACM,2005:190-200. [23]ZHANG Y,LIANG Y N,ZHANG D W,et al.An Effective Approach of Detecting Data Race in Concurrent Programs[J].Journal of Computer Applications,2019,39(1):67-71. [24]WANG X F.Research on Dynamic Data Race Detection[D].Wuhan:Huazhong University of Science And Technology,2016. [25]YU J,NARAYANASAMY S,PEREIRA C,et al.Maple:ACoverage-Driven Testing Tool for Multithreaded Programs[C]//Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications.ACM,2012:485-502. [26]YU M,PARK S M,CHUN I,et al.Experimen-tal Performance Comparison of Dynamic Dat-a RaceDetectionTechniques[J].ETRI Journal,2017,39(1):124-134. |
[1] | 杨璐,余守文,严建峰. 基于二型模糊逻辑的多线程数据竞争检测方法研究 Type-2 Fuzzy Logic Based Multi-threaded Data Race Detection 计算机科学, 2017, 44(12): 135-143. https://doi.org/10.11896/j.issn.1002-137X.2017.12.027 |
[2] | 闫洁,徐恒阳,安虹,刘玉,王耀彬. Pview:一种基于PMU的支持并行程序性能分析的新方法 Pview: A Novel Implementation of Fundamental Supports for Parallel Programs Performance Monitoring Based on PMU 计算机科学, 2011, 38(2): 288-292. |
|