1. A system for dynamically detecting potential race conditions in a program having a plurality of threads and one or more shared memory locations, the system comprising: with respect to each shared memory location, (i) a mechanism for maintaining a set of concurrent thread segments that access the location, and (ii) a mechanism for maintaining a first set of locks associated with the location; with respect to each thread, (i) a mechanism for maintaining a set of thread segments that are ordered before the current thread segment of the thread, and (ii) a mechanism for maintaining a second set of locks that are acquired and released by the thread; and a mechanism for reporting a warning when a potential race condition is detected.