NUMA-Aware Reader-Writer Locks for Cohorting
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In multiprocessor environments with Non-Uniform Memory Access (NUMA) architectures, reader-writer locks face performance issues due to excessive coherence traffic and poor scalability when lock ownership frequently migrates between threads on different nodes, especially with the presence of writer threads, leading to degraded performance in cache-coherent systems.
Innovation Solution
The implementation of NUMA-aware reader-writer locks that utilize a hierarchical lock structure with a synthetic level, allowing writer threads to acquire locks from the same or different nodes, and reader threads to briefly hold locks to promote large groups of readers and reduce lock migration, thereby improving throughput and scalability by leveraging lock cohorting techniques and distributed read indicators.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If lock ownership frequently migrates between threads on different nodes, then reader-writer locks can be acquired by multiple readers, but coherence traffic increases and scalability deteriorates
Solution Approach 1:
The patent segments the lock structure into multiple levels (e.g., node-level locks and global locks) to localize lock operations. By dividing the lock hierarchy, reader threads can acquire locks at their local node without triggering global coherence traffic, while still maintaining reader-reader concurrency across nodes.
Solution Approach 2:
The patent implements local quality by allowing reader threads to operate with local locks at their respective NUMA nodes. This enables readers to access shared resources with minimal coherence traffic by confining lock operations to local memory, while maintaining system-wide coordination when necessary.
2Productivity
If lock ownership frequently migrates between nodes, then reader-writer locks provide parallelism, but performance degrades due to interconnect traffic
Solution Approach 1:
The patent segments the lock acquisition process into local and global phases. Reader threads first acquire local node locks quickly without interconnect traffic, then coordinate globally only when necessary. This segmentation reduces latency by minimizing remote memory accesses while maintaining throughput through coordinated parallelism.
Solution Approach 2:
The patent performs preliminary lock acquisition at the local node level before attempting global lock coordination. By securing local locks first, reader threads establish a foundation for parallel execution without immediately incurring interconnect traffic, thereby reducing latency while preserving throughput potential.
3Device complexity
If a single variable indicates lock ownership, then reader-writer locks are simple to implement, but performance drops with writer threads present
Solution Approach 1:
The patent segments the lock indication into multiple variables organized in a hierarchy (e.g., local reader counts per node, global writer flags). This segmentation allows the system to track reader and writer states independently at different levels, maintaining simple local structures while achieving high performance through coordinated multi-variable state management.
Solution Approach 2:
The patent transitions from a single-dimension lock variable to a multi-dimensional lock state structure. By organizing lock information across multiple dimensions (node level, global level, reader count, writer flag), the system achieves both structural organization and performance optimization through hierarchical state management.
Data Source
AI summary
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.


