Hierarchical Queue-Based Locks Using Flat Combining
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing hierarchical locks, such as HBO and HCLH, face inefficiencies in NUMA architectures due to high invalidation traffic and fairness issues, as well as bottlenecks from spinning on shared locations and complex condition checks.
Innovation Solution
A scalable, hierarchical queue-based lock algorithm employing a flat combining synchronization paradigm, which builds local sub-queues efficiently and merges them into a global request queue with minimal interconnection traffic and synchronization operations, using a combiner thread to construct and splice local request queues into a global MCS style queue.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If test-and-test-and-set locks with dynamic back-off adjustment are used, then thread acquisition speed is improved, but invalidation traffic increases and fairness deteriorates
Solution Approach 1:
The patent segments the global lock into hierarchical levels (L1 lock per cluster, L2 lock global). Threads first acquire locks at the L1 level within their local cluster before accessing the L2 global lock. This segmentation reduces invalidation traffic by localizing lock operations to smaller memory domains while maintaining fair access to the global resource through the hierarchical structure.
2Adaptability or versatility
If HCLH algorithm merges local queues into global queue using SWAP operations, then queue merging is achieved, but performance deteriorates due to bottleneck and overhead
Solution Approach 1:
The patent merges local cluster queues into the global queue using a combine operation that atomically appends the local queue to the global queue's tail. This merging mechanism consolidates waiting threads from multiple clusters into a single global ordering, enabling fair sequential access while avoiding the performance penalties of repeated SWAP operations on shared locations.
3Reliability
If HCLH algorithm uses complex condition checks to determine queue merging, then correct queue integration is achieved, but execution time increases
Solution Approach 1:
The patent employs a feedback mechanism where threads spin on a `combining` flag to determine when their local queue has been successfully integrated into the global queue. The combiner thread sets this flag after performing the atomic combine operation, providing reliable feedback to waiting threads without requiring complex condition checks in the critical path.
Data Source
AI summary
The system and methods described herein may be used to implement a scalable, hierarchal, queue-based lock using flat combining. A thread executing on a processor core in a cluster of cores that share a memory may post a request to acquire a shared lock in a node of a publication list for the cluster using a non-atomic operation. A combiner thread may build an ordered (logical) local request queue that includes its own node and nodes of other threads (in the cluster) that include lock requests. The combiner thread may splice the local request queue into a (logical) global request queue for the shared lock as a sub-queue. A thread whose request has been posted in a node that has been combined into a local sub-queue and spliced into the global request queue may spin on a lock ownership indicator in its node until it is granted the shared lock.


