1. A system for dynamically detecting potential race conditions in a program having at least one thread and one or more shared memory locations, the system comprising: a processor, wherein the processor is adapted to: initialize a virtual clock (C_t) respectively for each of the at least one thread; initialize a set of candidate locks for each of at least one shared memory location (S_x); initialize a set of locks (S_t) held for each of at least one thread; initialize a set of concurrent thread segments (T_x) accessing each of the at least one shared memory location; initialize an ordered set of thread segments (B_t) below a current thread, wherein the ordering is achieved using the virtual clock associated with each thread; upon detection of a fork of a new concurrent thread (t 1 ) by a prior thread (t): increment the virtual clock associated with the prior thread (t); initialize the virtual clock associated with the new concurrent thread (t 1 ); update the ordered set of thread segments (B_t) before the prior thread (t) by forming a union of a current ordered set for the prior thread (t) and a singleton set having a thread segment <t, C_t>comprising a tuple of a thread identifier and a virtual clock time; upon detection of a join call by the prior thread (t): update the ordered set of thread segments (B_t) by forming a union of the ordered set of thread segments (B_t), a second ordered set of thread segments (B_t 1 ) before thread (t 1 ) that do not belong to the prior thread (t), and a singleton set containing a current thread segment associated with the current thread (t 1 ); and upon detection of a read or write to a memory location (x), determining upon detection of a read or write to a memory location (x), determing whether a potential race condition exists by updating a set of concurrent thread segments concurrently accessing the memory location (T_x) after the read or write using the updated ordered set of thread segments (B_t) from the detection of the fork or join call.