Patent ID: 7716645

Claim:
A method for ensuring consistency of data and preventing data races, the method comprising: receiving and examining a computer program written in an object-oriented language; wherein said computer program comprises units of work indicating boundaries of logical operations; receiving definitions of atomic sets of data, wherein the atomic sets of data are sets of data that indicate existence of a consistency property without requiring the consistency property itself and the definitions being specified by a programmer; receiving sequences of accesses to the atomic sets of data that preserve consistency of said atomic sets of data when executed sequentially; inferring which code blocks of the computer program must be synchronized in order to prevent one or more data races in the computer program received and examined, wherein synchronization is inferred by; determining by analysis for each of the units of work, what atomic sets are read and written by the unit of work, wherein the unit of work comprises non-overlapping threads; assuming that each execution is such that every unit of work that writes to some location in the atomic set, writes to every location in that atomic set, wherein dummy writes are added to any unit of work that does not satisfy the assumption; ignoring intricacies of problematic access scenarios; using the analysis to determine the code block surrounding all reads and writes to the atomic set within the unit of work; selecting a smallest code block from among the previously determined code blocks; detecting problematic interleaving scenarios for accesses to the atomic sets of data, wherein the problematic interleaving scenarios are concurrent accesses that are likely to produce a data race; providing a message indicating where synchronization is required to prevent data races; adding synchronization to the smallest code block; and uncovering unnecessary synchronization.