摘要 |
Methods and apparatus for detecting data race conditions in message-based multi-threaded programs are disclosed. The disclosed techniques monitor the creation of new threads, intercept message passing between threads and trace memory data access by each thread. When a new thread is created, a new clock vector is initialized and existing clock vectors are updated. Each time a thread sends a message to another thread, a message envelope which includes the original message is assembled and the clock vectors are updated. Each time a thread receives a message envelope from another thread, the message envelope is disassembled. If the message was sent synchronously, a reply envelope is sent. Again, clock vectors are updated. When a thread reads or writes a data location, the system checks if the same data location was accessed by another thread. If so, the clock for the other thread in the clock vector of the current thread and a recorded access time are checked to determine if a data race condition exists.
|