NUMA-Aware Reader-Writer Locks for Scalable Concurrency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In multiprocessor environments with Non-Uniform Memory Access (NUMA) architectures, traditional reader-writer locks suffer from excessive coherence traffic and poor scalability due to frequent lock ownership migration between threads on different nodes, leading to performance degradation, especially when writer threads compete for locks.

Innovation Solution

NUMA-aware reader-writer locks employ lock cohorting techniques to keep writer requests localized within a single NUMA node, relax the scheduling order of reader and writer threads, and use a delayed sleep mechanism to optimize lock acquisition, along with distributed node-local reader counters to manage concurrent access.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional reader-writer locks are used in NUMA environments, then basic lock functionality is provided, but coherence traffic increases and scalability deteriorates due to frequent lock ownership migration between nodes

Engineering Contradiction:
Improvelock functionalityVSAvoidscalability
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies local quality by making the lock implementation NUMA-aware, where lock ownership is preferentially transferred to threads executing on the same NUMA node. The system tracks the NUMA node of the lock and biases ownership transfer to local threads, thereby reducing remote coherence traffic while maintaining lock functionality.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent segments the lock ownership consideration by NUMA nodes, treating each node as a distinct domain for lock management. This segmentation allows the system to optimize coherence traffic by confining lock ownership within nodes rather than allowing arbitrary cross-node transfers.

Inventive Principle:
Principle #1Segmentation

2Adaptability or versatility

If lock ownership migrates frequently between different NUMA nodes, then thread flexibility is maintained, but coherence traffic increases and performance degrades

Engineering Contradiction:
Improvethread flexibilityVSAvoidcoherence traffic
Core Design Contradiction:
Adaptability or versatilityVSLoss of energy

Solution Approach 1:

The system implements local quality by preferentially transferring lock ownership to threads on the same NUMA node as the lock. This reduces the need for remote coherence operations while still allowing cross-node transfers when necessary, thus reducing coherence traffic while maintaining thread flexibility.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system uses feedback by tracking the NUMA node location of the lock and using this information to make informed decisions about lock ownership transfer. The feedback mechanism guides the lock manager to preferentially select local threads for ownership transfer, reducing remote coherence traffic.

Inventive Principle:
Principle #23Feedback

3Productivity

If reader-writer locks allow multiple simultaneous readers, then read parallelism improves, but writer performance deteriorates due to lock contention

Engineering Contradiction:
Improveread parallelismVSAvoidwriter wait time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent applies parameter changes by modifying the lock state representation to include NUMA node information and reader counts per node. This allows the system to track and manage readers and writers more efficiently, making informed decisions about lock ownership transfer that reduce writer wait times while maintaining reader parallelism.

Inventive Principle:
Principle #35Parameter changes

4Device complexity

If a single variable tracks lock state in basic reader-writer locks, then implementation simplicity is maintained, but scalability deteriorates on NUMA architectures

Engineering Contradiction:
Improvelock implementationVSAvoidNUMA scalability
Core Design Contradiction:
Device complexityVSProductivity

Solution Approach 1:

The patent segments the lock state tracking by NUMA node, maintaining separate reader counts for each node rather than a single global counter. This segmentation reduces contention on the lock state variables and improves scalability on NUMA architectures while keeping the implementation relatively simple.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent adds a new dimension to lock state tracking by incorporating NUMA node information into the lock metadata. This dimensional extension allows the system to make NUMA-aware decisions about lock ownership and improves scalability without significantly increasing implementation complexity.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

Data Source

PatentUS9996402B2System and method for implementing scalable adaptive reader-writer locks
Publication Date: 2018.06.12 ORACLE INT CORP
  • US9996402B2 patent drawing
  • US9996402B2 patent drawing
  • US9996402B2 patent drawing

AI summary

NUMA-aware reader-writer locks may leverage lock cohorting techniques and may support reader re-entrancy. They may implement a delayed sleep mechanism by which a thread that fails to acquire a lock spins briefly, hoping the lock will be released soon, before blocking on the lock (sleeping). The maximum spin time may be based on the time needed to put a thread to sleep and wake it up. If a lock holder is not executing on a processor, an acquiring thread may go to sleep without first spinning. Threads put in a sleep state may be placed on a turnstile sleep queue associated with the lock. When a writer thread that holds the lock exits a critical section protected by the lock, it may wake all sleeping reader threads and one sleeping writer thread. Reader threads may increment and decrement node-local reader counters upon arrival and departure, respectively.