J4 ›› 2015, Vol. 42 ›› Issue (2): 167-173+212.doi: 10.3969/j.issn.1001-2400.2015.02.028

• 研究论文 • 上一篇    下一篇

一种多线程软件并发漏洞检测方法

朱承丞1;董利达1,2   

  1. (1. 浙江大学 电子电路与信息系统研究所,浙江 杭州 310027; 2. 杭州师范大学 国际服务工程学院, 浙江 杭州 311121)
  • 收稿日期:2013-12-12 修回日期:2014-03-10 出版日期:2015-04-20 发布日期:2015-04-14
  • 通讯作者: 朱承丞
  • 作者简介:朱承丞(1990-),男,浙江大学硕士研究生,E-mail: zhuchengcheng@live.cn.
  • 基金资助:
    国家自然科学基金资助项目(61071062);浙江省自然科学基金资助项目(Y12F02030)

Concurrency bug test for a class of multithreaded software

ZHU Chengcheng1;DONG Lida1,2   

  1. (1. Institute of Electronic Circuit and Information System, Zhejiang Univ., Hangzhou 310027, China; 2. Hangzhou Institute of Service Engineering, Hangzhou Normal Univ., Hangzhou 311121, China)
  • Received:2013-12-12 Revised:2014-03-10 Online:2015-04-20 Published:2015-04-14
  • Contact: ZHU Chengcheng

摘要: 多线程软件由于进程间共享使用资源而极易发生死锁这一严重的并发漏洞.通过Petri网模型对多线程软件进行建模,并利用混合整数规划技术检测其漏洞.目前,使用互斥锁的多线程软件可通过Gadara网建模和检测.而使用信号量的多线程软件,虽可用S*PR网建模,但是尚未有理论支撑混合整数规划用于其漏洞检测.定义了S*PR网的一个子类——SEM-S*PR网,它允许资源库所初始标志大于1且分支可对称地使用资源,进而可建模一类使用信号量的多线程软件.依据结构特点,证明了该网保持活性的充分必要条件是网运行过程中所有信标始终非空.此结论是混合整数规划用于SEM-S*PR网建模的多线程软件的并发漏洞检测的理论基础.

关键词: 多线程软件, Petri网, S*PR网, 死锁检测, 混合整数规划

Abstract: Due to the sharing of resources, the deadlocks often occur as concurrency bugs in multithreaded software. This paper utilizes the Petri net to model multithreaded software and use the mixed integer programming tool to test the concurrency bugs in it. Currently, multithreaded software using the mutex can be modeled and tested by the Gadara nets. Multithreaded software using semaphores can be modeled by S*PRnets, but there is no theory to support the mixed integer programming-based concurrency bugs test method for them. This paper defines a subclass of S*PRnets, i.e., SEM-S*PRnets. The initial marking of resource places in it can be greater than 1 and branches can use resources symmetrically. Thus, it can model a class of multithreaded software using semaphores. By structural analysis, it can be proved that a SEM-S*PRnet is live if and only if all its siphons are always marked during execution. This result ensures that the mixed integer programming techniques can also be applied for detecting concurrency bugs in multithreaded software modeled by SEM-S*PRnets. Finally, two concurrency bug test examples are introduced, and the results show the validity of this work.

Key words: multithreaded software, petri nets, S*PRnet, deadlock test, mixed integer programming

中图分类号: 

  • TP301.1