死锁是并发程序中最为常见的一类错误,直到现在并没有得到很好地解决.本文以Java并发程序为例,重点研究针对资源死锁较为有效的动态检测算法:根据并发程序的动态执行追踪信息,分析出加锁控制依赖关系,再根据死锁所应满足的条件在该依赖关系集上作适量演算便得到潜在死锁关系对.进一步地,结合线程间控制流图所反映的部分静态依赖关系,剔除假性死锁关系对,提高了计算结果的精度.该算法显著的特点是简单易于实现,且无需构造锁树或锁图等图形表示.
Deadlock is one type of errors in most multi-threaded programs, and it hasn't been well settled until today. In this paper, a dynamic detection algorithm for finding resource deadlocks in concurrent Java programs has been proposed. Based on the execution trace information of a concurrent program, it produces locking control dependency relations firstly. Subsequently, the potential deadlocks can be worked out through imposing some relation calculations on the achieved locking control dependency relations. Furthermore, some static information of inter-thread control flow graph (ITCFG) is introduced to increase the precision of results. The presented algorithm is so simple that it can be easily implemented; on the other hand, it doesn't need to construct graphical representation such as lock tree and lock graph in the existing methods.