Scalable Reader-Writer Lock Using Hierarchical C-SNZI Structure
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing reader-writer locks in computer systems face contention issues, particularly under heavy loads, as multiple requesters vie for access to shared resources, leading to performance bottlenecks and potential system panics due to thread timeouts, especially when writers attempt to acquire the lock during read-only workloads.
Innovation Solution
The implementation of a scalable reader-writer lock using a hierarchical Conditioned Scalable Non-Zero Indicator (C-SNZI) structure allows multiple readers to concurrently acquire the lock without contending on a single location, such as a counter or tail pointer, and is disabled by a writer, ensuring efficient operation even under heavy access.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If a single lockword or central counter is used to control reader-writer access, then the lock structure is simple, but contention increases under heavy loads leading to performance bottlenecks
Solution Approach 1:
The patent divides the single centralized lock structure into multiple distributed lockwords, each capable of being independently held by readers. This segmentation eliminates the single point of contention by allowing multiple readers to concurrently hold different lockwords, thereby maintaining simple individual lock structures while improving overall system performance under heavy loads.
2Ease of operation
If a queue is implemented to order requesters, then access ordering is improved, but the tail pointer becomes a new point of contention
Solution Approach 1:
The patent extracts the contention-prone tail pointer operations from the queue structure by allowing readers to directly acquire lockwords without queuing. This eliminates the tail pointer as a contention point while maintaining access ordering through the lockword acquisition mechanism, where readers naturally queue up by attempting to acquire available lockwords.
3Reliability
If mutex locks are used to protect queue operations, then queue integrity is maintained, but additional contention points are introduced
Solution Approach 1:
The patent implements self-service by allowing readers to directly acquire and release lockwords without requiring mutex protection. Each reader independently manages its own access to lockwords through atomic operations, eliminating the need for additional mutex locks while maintaining queue integrity through the inherent ordering provided by the lockword acquisition sequence.
4Device complexity
If a central lockword counts active readers, then reader tracking is simplified, but the lockword becomes a bottleneck under read-only workloads
Solution Approach 1:
The patent segments the centralized reader count mechanism into multiple distributed lockwords, where each lockword serves as an independent indicator of active readers. This eliminates the bottleneck by allowing multiple readers to concurrently increment different lockwords without contention, maintaining simplified tracking through atomic increment operations on each lockword while improving read-only workload performance.
Data Source
AI summary
A reader-writer lock is provided that scales to accommodate multiple readers without contention. The lock comprises a hierarchical C-SNZI (Conditioned Scalable Non-Zero Indicator) structure that scales with the number readers seeking simultaneous acquisition of the lock. All readers that have joined the C-SNZI structure share concurrent acquisition, and additional readers may continue to join until the structure is disabled. The lock may be disabled by a writer, at which time subsequent readers will wait (e.g., in a wait queue) until the lock is again available. The C-SNZI structure may be implemented in a lockword or in reader entries within a wait queue. If implemented in reader entries of a wait queue, the lockword may be omitted, and new readers arriving at the queue may be able join an existing reader entry even if the reader entry is not at the tail of the queue.


