Patent ID: 8533699

Claim:
A method, comprising: performing by a computer: beginning execution of an application that comprises two alternative execution paths for performing a sequence of operations, wherein the sequence of operations comprises one or more operations that access a shared resource; and a thread of the application selecting, at runtime, a given one of the two execution paths; wherein one of the two execution paths comprises one or more operations that facilitate detecting that a result of the sequence of operations has been affected by interference from another executing thread, recovering from interference from another executing thread, or recovering from a failure to complete the sequence of operations in its entirety; wherein on the one of the two execution paths, the sequence of operations is performed non-transactionally; wherein the other one of the two execution paths comprises one or more operations for forcing the sequence of operations to be executed as an atomic transaction; and wherein the other one of the two execution paths omits or optimizes the one or more operations for detecting that a result of the sequence of operations has been affected by interference or for recovering from a failure to complete the sequence of operations in its entirety.