Patent ID: 7398355

Claim:
A method for modifying a program to avoid locks by transactionally executing critical sections, comprising: receiving a program which includes one or more critical sections which are protected by locks; modifying the program so that the critical sections which are protected by locks are executed transactionally without acquiring locks associated with the critical sections; wherein the program is modified so that, a start transactional execution (STE) instruction is executed before entering the critical section; during transactional execution of a critical section, the program first determines if a lock associated with the critical section is held by another process and if so aborts the transactional execution; if the transactional execution of the critical section completes without encountering an interfering data access from another process, the program commits changes made during the transactional execution and optionally resumes normal non-transactional execution of the program past the critical section; and if an interfering data access from another process is encountered during transactional execution of the critical section, the program discards changes made during the transactional execution, and attempts to re-execute the critical section zero or more times; wherein the program executes in normal execution mode an alternate block of code that is specified by the STE instruction if the program does not attempt to re-execute the critical section or all attempts to re-execute the critical section fail.