Composite Abortable Locks for Multithreaded Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing lock implementations in multithreaded systems, such as backoff locks and queue locks, face challenges in scalability and memory efficiency, particularly in high-scale multiprocessor systems, leading to thread starvation and increased memory overhead.
Innovation Solution
A composite lock implementation that uses a fixed-size collection of nodes with preallocated resources, allowing threads to select and insert nodes into a wait-queue, supporting non-blocking aborts and efficient ordering, while maintaining a constant space requirement independent of the number of threads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If typical abortable queue locks are implemented to support thread abortion, then thread management flexibility is improved, but memory overhead increases to O(L*T) space
Solution Approach 1:
The patent segments the wait-queue into a fixed-size collection of preallocated nodes rather than allowing dynamic growth. Each lock maintains a predetermined number of nodes that are reused across multiple thread acquisition attempts, preventing unbounded memory allocation while still supporting multiple threads.
Solution Approach 2:
The patent performs preliminary allocation of a fixed number of nodes for each lock before threads arrive. These preallocated nodes are ready for immediate use and are reused across different thread acquisition attempts, eliminating the need for dynamic memory allocation during runtime and bounding memory usage.
2Loss of energy
If backoff locks are implemented to reduce memory traffic, then memory contention is reduced, but thread handover time increases significantly
Solution Approach 1:
The patent implements periodic probing of the wait-queue nodes rather than continuous spinning or long backoff delays. Threads periodically check the status of preallocated nodes in a round-robin fashion, allowing for brief intervals of activity followed by waiting, which reduces memory traffic while maintaining relatively quick lock handover when nodes become available.
3Device complexity
If typical backoff locks are implemented to simplify lock management, then implementation complexity is reduced, but thread starvation occurs due to inability to impose ordering
Solution Approach 1:
The patent preliminarily establishes an ordering mechanism through the fixed-size node array structure. Nodes are arranged in a predetermined sequence, and threads acquire nodes in a systematic order (e.g., round-robin or sequential), which imposes a natural ordering on thread access without requiring complex arbitration logic, thereby preventing starvation while maintaining simplicity.
Data Source
AI summary
A lock implementation has properties of both backoff locks and queue locks. Such a “composite” lock is abortable and is provided with a constant number of preallocated nodes. A thread requesting the lock selects one of the nodes, attempts to acquire the selected node, and, if successful, inserts the selected node in a wait-queue for the lock. Because there is only a constant number of nodes for the wait-queue, all requesting threads may not be queued. Requesting threads unable to successfully acquire a selected node may backoff and retry selecting and acquiring a node. A node at the front of the wait-queue holds the lock.


