Concurrent execution of critical sections by eliding ownership of locks
First Claim
1. A method for avoiding locks used to control simultaneous access of a critical section by multiple processes by speculatively executing critical sections of code, comprising:
- (a) allowing different processes to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section;
for at least some executions where a process completes the critical section without encountering an interfering data access from another process, the method further comprises;
committing changes made during the speculative execution, and resuming normal non-speculative execution of the program past the critical section;
for at least some executions where an interfering data access from another process is encountered during execution of the critical section, the method further comprises at least one of the following steps of;
(i) discarding changes made during the speculative execution, and attempting to re-execute the critical section at least one time wherein attempting to re-execute the critical section involves speculatively re-executing the critical section; and
(ii) acquiring a lock associated with the critical section, non-speculatively executing the critical section, and releasing the lock associated with the critical section.
1 Assignment
0 Petitions
Accused Products
Abstract
One embodiment of the present invention provides a system that facilitates avoiding locks by speculatively executing critical sections of code. During operation, the system allows a process to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section. If the process subsequently completes the critical section without encountering an interfering data access from another process, the system commits changes made during the speculative execution, and resumes normal non-speculative execution of the program past the critical section. Otherwise, if an interfering data access from another process is encountered during execution of the critical section, the system discards changes made during the speculative execution, and attempts to re-execute the critical section.
38 Citations
28 Claims
-
1. A method for avoiding locks used to control simultaneous access of a critical section by multiple processes by speculatively executing critical sections of code, comprising:
-
(a) allowing different processes to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; for at least some executions where a process completes the critical section without encountering an interfering data access from another process, the method further comprises; committing changes made during the speculative execution, and resuming normal non-speculative execution of the program past the critical section; for at least some executions where an interfering data access from another process is encountered during execution of the critical section, the method further comprises at least one of the following steps of; (i) discarding changes made during the speculative execution, and attempting to re-execute the critical section at least one time wherein attempting to re-execute the critical section involves speculatively re-executing the critical section; and (ii) acquiring a lock associated with the critical section, non-speculatively executing the critical section, and releasing the lock associated with the critical section. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 10, 11, 14)
-
-
9. A method for avoiding locks by speculatively executing critical sections of code, comprising:
-
allowing a process to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; wherein if the process completes the critical section without encountering an interfering data access from another process, the method further comprises; committing changes made during the speculative execution, and resuming normal non-speculative execution of the program past the critical section; and wherein if an interfering data access from another process is encountered during execution of the critical section, the method further comprises; discarding changes made during the speculative execution, and attempting to re-execute the critical section zero or more times;
wherein attempting to re-execute the critical section involves speculatively re-executing the critical section,wherein if the critical section is not successfully completed after a number of attempts at speculative execution, the method further comprises; (ii) acquiring a lock associated with the critical section, non-speculatively executing the critical section, and releasing the lock associated with the critical section; wherein the changes made during the speculative execution are further committed at a non-cacheable operation limiting further speculation.
-
-
12. A method for avoiding locks by speculatively executing critical sections of code, comprising:
-
allowing a process to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; wherein if the process completes the critical section without encountering an interfering data access from another process, the method further comprises; committing changes made during the speculative execution, and resuming normal non-speculative execution of the program past the critical section; and wherein if an interfering data access from another process is encountered during execution of the critical section, the method further comprises; discarding changes made during the speculative execution, and attempting to re-execute the critical section zero or more times;
wherein attempting to re-execute the critical section involves speculatively re-executing the critical section,wherein if the critical section is not successfully completed after a number of attempts at speculative execution, the method further comprises; (ii) acquiring a lock associated with the critical section, non-speculatively executing the critical section, and releasing the lock associated with the critical section; wherein the critical section is speculatively executed while eliding write instructions that do not change a value of memory location being written to. - View Dependent Claims (13)
-
-
15. An apparatus that avoids locks used to control simultaneous access of a critical section by multiple processes by speculatively executing critical sections of code, comprising:
-
a speculative execution mechanism configured to allow different processes to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; a commit mechanism, wherein when the process completes the critical section without encountering an interfering data access from another process, the commit mechanism is configured to; commit changes made during the speculative execution, and to resume normal non-speculative execution of the program past the critical section; and a re-execution mechanism, wherein when an interfering data access from another process is encountered during execution of the critical section, the re-execution mechanism is configured to perform at least one of the following steps; (a) discard changes made during the speculative execution, and to attempt to re-execute the critical section at least one time wherein the re-execution mechanism is configured to speculatively re-execute the critical section, (b) acquire a lock associated with the critical section, non-speculatively execute the critical section, and to release the lock associated with the critical section. - View Dependent Claims (16, 17, 18, 19, 20, 21, 22, 24, 25, 28)
-
-
23. An apparatus that avoids locks by speculatively executing critical sections of code, comprising:
-
a speculative execution mechanism configured to allow a process to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; a commit mechanism, wherein if the process completes the critical section without encountering an interfering data access from another process, the commit mechanism is configured to; commit changes made during the speculative execution, and to resume normal non-speculative execution of the program past the critical section; and a re-execution mechanism, wherein if an interfering data access from another process is encountered during execution of the critical section, the re-execution mechanism is configured to; discard changes made during the speculative execution, and to attempt to re-execute the critical section zero or more times;
wherein the re-execution mechanism is configured to speculatively re-execute the critical section, wherein if the critical section is not successfully completed after a number of attempts at speculative execution, the re-execution mechanism is configured to;acquire a lock associated with the critical section, non-speculatively execute the critical section, and to release the lock associated with the critical section; wherein the changes made during the speculative execution are further committed at a non-cacheable operation limiting further speculation.
-
-
26. An apparatus that avoids locks by speculatively executing critical sections of code, comprising:
-
a speculative execution mechanism configured to allow a process to speculatively execute a critical section of code within a program without first acquiring a lock associated with the critical section; a commit mechanism, wherein if the process completes the critical section without encountering an interfering data access from another process, the commit mechanism is configured to; commit changes made during the speculative execution, and to resume normal non-speculative execution of the program past the critical section; and a re-execution mechanism, wherein if an interfering data access from another process is encountered during execution of the critical section, the re-execution mechanism is configured to; discard changes made during the speculative execution, and to attempt to re-execute the critical section zero or more times;
wherein the re-execution mechanism is configured to speculatively re-execute the critical section, wherein if the critical section is not successfully completed after a number of attempts at speculative execution, the re-execution mechanism is configured to;acquire a lock associated with the critical section, non-speculatively execute the critical section, and to release the lock associated with the critical section; wherein the critical section is speculatively executed while eliding write instructions that do not change a value of memory location being written to. - View Dependent Claims (27)
-
Specification