NUMA-aware reader-writer locks reduce coherence traffic
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current locking mechanisms in multiprocessor environments, particularly in NUMA and CC-NUMA architectures, face issues with excessive coherence traffic and poor scalability due to frequent lock migration and contention, leading to performance degradation.
Innovation Solution
The implementation of NUMA-aware reader-writer locks using lock cohorting techniques, where writer threads hand off locks to local threads and reader threads can acquire locks in read mode simultaneously across nodes, reducing lock migration and coherence traffic by relaxing the FIFO ordering and promoting parallelism.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If traditional mutual exclusion locks are used in NUMA architectures, then lock ownership can be transferred between threads, but coherence traffic increases and scalability deteriorates
Solution Approach 1:
The patent segments the single global lock into multiple node-local locks, one for each NUMA node. Threads acquire locks locally on their node rather than contending for a global lock, which reduces coherence traffic across the interconnect. Each node maintains its own lock state independently, allowing parallel lock acquisitions on different nodes while preventing unnecessary remote cache invalidations.
Solution Approach 2:
The patent makes lock acquisition local to each NUMA node by having threads acquire locks on their home node rather than accessing a remote global lock. This localizes the critical section to each node's memory hierarchy, ensuring that lock operations primarily access local cache and memory, thereby reducing remote memory access latency and coherence protocol traffic.
2Ease of operation
If lock ownership migrates frequently between NUMA nodes, then thread flexibility increases, but coherence traffic and latency increase
Solution Approach 1:
The patent performs preliminary binding of threads to NUMA nodes before lock acquisition. Each thread is assigned a home node in advance, and lock acquisition occurs locally on that node. This preliminary arrangement eliminates the need for dynamic lock migration decisions during runtime, ensuring that lock operations always occur on local memory without incurring remote access latency.
3Reliability
If FIFO ordering is enforced for lock acquisition, then fairness is improved, but parallelism and throughput decrease
Solution Approach 1:
The patent transitions from a single-dimensional global FIFO queue to a multi-dimensional structure where each NUMA node has its own independent lock queue. Threads on different nodes can acquire locks in parallel without interfering with each other's fairness guarantees. Each node maintains FIFO ordering locally, while the system as a whole achieves higher throughput through parallel lock acquisitions across multiple nodes.
Data Source
AI summary
NUMA-aware reader-writer locks may leverage lock cohorting techniques to band together writer requests from a single NUMA node. The locks may relax the order in which the lock schedules the execution of critical sections of code by reader threads and writer threads, allowing lock ownership to remain resident on a single NUMA node for long periods, while also taking advantage of parallelism between reader threads. Threads may contend on node-level structures to get permission to acquire a globally shared reader-writer lock. Writer threads may follow a lock cohorting strategy of passing ownership of the lock in write mode from one thread to a cohort writer thread without releasing the shared lock, while reader threads from multiple NUMA nodes may simultaneously acquire the shared lock in read mode. The reader-writer lock may follow a writer-preference policy, a reader-preference policy or a hybrid policy.


