Systems and methods for adaptive integration of hardware and software lock elision techniques
First Claim
1. A method, comprising:
- performing by a computer;
beginning instrumentation of code of a multithreaded application,wherein the application comprises at least one critical section of code that is associated with a lock, and wherein when the lock is held by a thread, other threads are prevented from accessing resources that are protected by the lock;
declaring, for one or more respective locks of the at least one critical section, metadata for use by an adaptive lock elision library, wherein the metadata for a given lock comprises a respective label corresponding to the given lock;
selecting one of a plurality of mechanisms for executing the critical section without acquiring the lock; and
instrumenting the critical section for execution using the selected one of the plurality of mechanisms, wherein the instrumenting the critical section comprises replacing a call for the lock with a call to the adaptive lock elision library.
0 Assignments
0 Petitions
Accused Products
Abstract
Particular techniques for improving the scalability of concurrent programs (e.g., lock-based applications) may be effective in some environments and for some workloads, but not others. The systems described herein may automatically choose appropriate ones of these techniques to apply when executing lock-based applications at runtime, based on observations of the application in the current environment and with the current workload. In one example, two techniques for improving lock scalability (e.g., transactional lock elision using hardware transactional memory, and optimistic software techniques) may be integrated together. A lightweight runtime library built for this purpose may adapt its approach to managing concurrency by dynamically selecting one or more of these techniques (at different times) during execution of a given application. In this Adaptive Lock Elision approach, the techniques may be selected (based on pluggable policies) at runtime to achieve good performance on different platforms and for different workloads.
28 Citations
20 Claims
-
1. A method, comprising:
performing by a computer; beginning instrumentation of code of a multithreaded application, wherein the application comprises at least one critical section of code that is associated with a lock, and wherein when the lock is held by a thread, other threads are prevented from accessing resources that are protected by the lock; declaring, for one or more respective locks of the at least one critical section, metadata for use by an adaptive lock elision library, wherein the metadata for a given lock comprises a respective label corresponding to the given lock; selecting one of a plurality of mechanisms for executing the critical section without acquiring the lock; and instrumenting the critical section for execution using the selected one of the plurality of mechanisms, wherein the instrumenting the critical section comprises replacing a call for the lock with a call to the adaptive lock elision library. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
8. A system, comprising:
-
one or more processor cores; and a memory coupled to the one or more processor cores and storing program instructions that when executed on the one or more processor cores cause the one or more processor cores to; begin instrumentation of code of a multithreaded application, wherein the application comprises at least one critical section of code that is associated with a lock, and wherein when the lock is held by a thread, other threads are prevented from accessing resources that are protected by the lock; declare, for one or more respective locks of the at least one critical section, metadata for use by an adaptive lock elision library, wherein the metadata for a given lock comprises a respective label corresponding to the given lock; select one of a plurality of mechanisms for executing the critical section without acquiring the lock; and instrumenting the critical section for execution using the selected one of the plurality of mechanisms, wherein the instrumenting the critical section comprises replacing a call for the lock with a call to the adaptive lock elision library. - View Dependent Claims (9, 10, 11, 12, 13, 14)
-
-
15. A non-transitory, computer-readable storage medium storing program instructions that when executed on one or more computers cause the one or more computers to perform:
-
beginning instrumentation of a multithreaded application, wherein the application comprises at least one critical section of code that is associated with a lock, and wherein when the lock is held by a thread, other threads are prevented from accessing resources that are protected by the lock; declaring, for one or more respective locks of the at least one critical section, metadata for use by an adaptive lock elision library, wherein the metadata for a given lock comprises a respective label corresponding to the given lock; selecting one of a plurality of mechanisms for executing the critical section without acquiring the lock; and instrumenting the critical section for execution using the selected one of the plurality of mechanisms, wherein the instrumenting the critical section comprises replacing a call for the lock with a call to the adaptive lock elision library. - View Dependent Claims (16, 17, 18, 19, 20)
-
Specification