Hierarchical Queue-Based Locks for Multithreaded Systems

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In multithreaded systems, existing lock mechanisms struggle to efficiently manage concurrent access to shared resources, leading to inefficiencies and unfair access opportunities among threads.

Innovation Solution

A queue-based lock system is implemented using local and global queues, where threads are represented by qnodes, allowing threads to acquire locks through a splicing mechanism that preserves FIFO order and minimizes cache misses and memory usage.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional lock mechanisms are used in multithreaded systems, then concurrent access to shared resources can be managed, but efficiency deteriorates and access fairness among threads deteriorates

Engineering Contradiction:
Improvelock acquisition efficiencyVSAvoidthread waiting time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The queue-based lock divides the waiting threads into multiple segments or levels. Instead of a single linear queue, threads are organized in a hierarchical structure where they can wait at different levels, allowing parallel processing of lock acquisition requests and reducing contention.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent transitions from a traditional single-dimensional lock queue to a multi-dimensional hierarchical queue structure. Threads can wait at different levels (L1, L2, etc.) and different positions within those levels, adding spatial dimensions to the waiting mechanism and enabling more efficient parallelism.

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

2Reliability

If traditional lock mechanisms are used, then shared resources can be protected, but memory usage increases

Engineering Contradiction:
Improveresource access safetyVSAvoidmemory usage
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The hierarchical queue structure allows for efficient recycling of queue nodes. When threads acquire or release locks, queue nodes are dynamically allocated and freed, reducing overall memory consumption compared to static lock structures that reserve memory for all possible waiting threads.

Inventive Principle:
Principle #34Discarding and recovering

Solution Approach 2:

The lock structure uses dynamic memory allocation where queue nodes are created and destroyed based on actual thread contention. This allows the memory usage to adapt to the number of contending threads rather than pre-allocating memory for maximum possible contention scenarios.

Inventive Principle:
Principle #15Dynamics

3Device complexity

If simple queue structures are used, then implementation is simple, but cache misses increase

Engineering Contradiction:
Improvelock structure complexityVSAvoidcache miss rate
Core Design Contradiction:
Device complexityVSLoss of energy

Solution Approach 1:

The hierarchical queue segments threads into different levels, allowing threads at the same level to be processed in parallel. This segmentation improves cache utilization by keeping related queue operations localized and reducing the need for threads to traverse entire queue structures, thereby reducing cache misses.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS7945912B1Hierarchical queue-based locks
Publication Date: 2011.05.17 ORACLE AMERICAN INC
  • US7945912B1 patent drawing
  • US7945912B1 patent drawing
  • US7945912B1 patent drawing

AI summary

In general, in one aspect, the invention relates to a method of establishing a queue-based lock including inserting a first qnode into a local queue, where the first qnode is associated with a first thread, splicing the local queue into the global queue, obtaining a lock for the first thread when the first qnode is at the head of the global queue, and executing a critical section of the first thread after obtaining the lock.