Nested locks to avoid mutex parking
First Claim
1. A method of controlling access to a resource, comprising:
- acquiring a spinlock on the resource, acquiring a native mutex lock on the resource, accessing the resource, releasing the native mutex lock, and releasing the spinlock.
1 Assignment
0 Petitions
Accused Products
Abstract
A native mutex lock of an operating system is embedded within an application-controlled spinlock. Each of these locks are applied to the same resource, in such a manner that, in select applications, and particularly in parallel processed applications, the adverse side-effects of the inner native mutex lock are avoided. In a preferred embodiment, each call to a system routine that is known to invoke a native mutex is replaced by a call to a corresponding routine that spinlocks the resource before calling the system routine that invokes the native mutex, then releases the spinlock when the system call is completed. By locking the resource before the native mutex is invoked, the calling task is assured that the resource is currently available to the task when the native mutex is invoked, and therefore the task will not be parked/deactivated by the native mutex.
12 Citations
20 Claims
-
1. A method of controlling access to a resource, comprising:
-
acquiring a spinlock on the resource, acquiring a native mutex lock on the resource, accessing the resource, releasing the native mutex lock, and releasing the spinlock. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A method of improving performance of an application program, comprising:
-
creating an encapsulating function that includes a target function within a spinlock for a resource, and replacing each reference to the target function in the application program with a reference to the encapsulating function, so that the application program invokes the spinlock before invoking the target function, wherein the target function is configured to invoke a native mutex lock for the resource. - View Dependent Claims (11, 12, 13, 14, 15, 16)
-
-
17. An application program, comprising:
-
an encapsulating routine that encapsulates a target routine within a spinlock for a resource, and a plurality of calls to the encapsulating routine, wherein the target routine is configured to invoke a native mutex lock for the resource. - View Dependent Claims (18, 19, 20)
-
Specification