System and method for promoting reader groups for lock cohorting
First Claim
1. A method, comprising:
- performing, by one or more computers;
acquiring, by a writer thread of a plurality of concurrently executing threads executing on respective ones of a plurality of processor cores of a plurality of nodes that share access to a memory, a reader-writer lock having a multiple-level lock hierarchy, wherein said acquiring comprises;
acquiring a node-level writer lock for the respective node for the writer thread at a lowest level in the multiple-level lock hierarchy, wherein the node-level writer lock is one of a plurality of node-level writer locks at the lowest level in the multiple-level lock hierarchy, each of which is a writer lock for a respective one of the plurality of nodes, and wherein at most one writer thread executing on the respective node holds the node-level writer lock at a time;
acquiring a global writer lock at a different level in the multiple-level lock hierarchy, wherein the different level comprises the global writer lock and a global reader lock, and wherein at most one writer thread holds the global writer lock at a time; and
acquiring a top-level lock in the lock hierarchy, wherein at most one writer thread or one reader thread holds the top-level lock at a time.
0 Assignments
0 Petitions
Accused Products
Abstract
NUMA-aware reader-writer locks may leverage lock cohorting techniques that introduce a synthetic level into the lock hierarchy (e.g., one whose nodes do not correspond to the system topology). The synthetic level may include a global reader lock and a global writer lock. A writer thread may acquire a node-level writer lock, then the global writer lock, and then the top-level lock, after which it may access a critical section protected by the lock. The writer may release the lock (if an upper bound on consecutive writers has been met), or may pass the lock to another writer (on the same node or a different node, according to a fairness policy). A reader may acquire the global reader lock (whether or not node-level reader locks are present), and then the top-level lock. However, readers may only hold these locks long enough to increment reader counts associated with them.
-
Citations
20 Claims
-
1. A method, comprising:
performing, by one or more computers; acquiring, by a writer thread of a plurality of concurrently executing threads executing on respective ones of a plurality of processor cores of a plurality of nodes that share access to a memory, a reader-writer lock having a multiple-level lock hierarchy, wherein said acquiring comprises; acquiring a node-level writer lock for the respective node for the writer thread at a lowest level in the multiple-level lock hierarchy, wherein the node-level writer lock is one of a plurality of node-level writer locks at the lowest level in the multiple-level lock hierarchy, each of which is a writer lock for a respective one of the plurality of nodes, and wherein at most one writer thread executing on the respective node holds the node-level writer lock at a time; acquiring a global writer lock at a different level in the multiple-level lock hierarchy, wherein the different level comprises the global writer lock and a global reader lock, and wherein at most one writer thread holds the global writer lock at a time; and acquiring a top-level lock in the lock hierarchy, wherein at most one writer thread or one reader thread holds the top-level lock at a time. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
-
15. A system, comprising:
-
a plurality of nodes, each of which comprises two or more processor cores that support multithreading and that share a local memory; a system memory coupled to the plurality of nodes; wherein the system memory stores program instructions that when executed on one or more processor cores in the plurality of nodes cause the one or more processor cores to perform; acquiring, by a writer thread executing on a given one of the plurality of nodes, a reader-writer lock having a multiple-level lock hierarchy, wherein said acquiring comprises; acquiring a node-level writer lock for the given node at a lowest level in the multiple-level lock hierarchy, wherein the node-level writer lock is one of a plurality of node-level writer locks at the lowest level in the multiple-level lock hierarchy, each of which is a writer lock for a respective one of the plurality of nodes, and wherein at most one writer thread executing on the given node holds the node-level writer lock at a time; acquiring a global writer lock at a different level in the multiple-level lock hierarchy, wherein the different level comprises the global writer lock and a global reader lock, and wherein at most one writer thread holds the global writer lock at a time; and acquiring a top-level lock in the lock hierarchy, wherein at most one writer thread or one reader thread holds the top-level lock at a time. - View Dependent Claims (16, 17)
-
-
18. 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:
acquiring, by a writer thread executing on a given node of a plurality of nodes sharing a memory, a reader-writer lock having a multiple-level lock hierarchy, wherein said acquiring comprises; acquiring a node-level writer lock for the given node at a lowest level in the multiple-level lock hierarchy, wherein the node-level writer lock is one of a plurality of node-level writer locks at the lowest level in the multiple-level lock hierarchy, each of which is a writer lock for a respective one of the plurality of nodes, and wherein at most one writer thread executing on the given node holds the node-level writer lock at a time; acquiring a global writer lock at a different level in the multiple-level lock hierarchy, wherein the different level comprises the global writer lock and a global reader lock, and wherein at most one writer thread of a plurality of concurrently executing threads holds the global writer lock at a time; and acquiring a top-level lock in the lock hierarchy, wherein at most one writer thread of the concurrently executing threads or one reader thread of the concurrent executing threads holds the top-level lock at a time. - View Dependent Claims (19, 20)
Specification