文摘
Synchronization mechanisms provide flexibility for concurrent programming. However, they also increase the difficulty of deadlock detection, since detection methods have to consider deadlocks caused by different mechanisms and their attributes. Traditional deadlock detection techniques are for deadlocks that involve a few types of synchronization mechanisms, typically mutex only. This paper introduces extensions of Petri nets, called Attribute Petri nets (APNs), which focus on modelling most kinds of synchronization mechanisms and their attributes. APNs are constructed in a modular way; therefore, new synchronization mechanisms can be easily hooked to APNs, each of which is developed as an independent APNs plugin. A tool called SniperX has been developed to analyse C/C++ threaded programs that use the Pthreads (POSIX threads, a POSIX standard for threads), containing plugins for mutual exclusions, semaphores, barriers, condition variables, etc. We have applied it to some open source multithreaded systems and a large commercial system, finding several previously unknown deadlocks that involve multiple synchronization mechanisms.