Fair Spinlock Queue Skipping for Preempted Thread Contention

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Fair spinlocks in high-contention systems with shared CPU cores are prone to thread preemption, leading to thread starvation and inefficient CPU usage due to threads repeatedly spinning and waiting for a released lock, especially when the next thread in the FIFO queue is preempted.

Innovation Solution

A fair spinlock implementation that detects thread preemption in the FIFO queue and allows the next thread to acquire the spinlock, saving the preempted thread's position in the queue, enabling it to restart from the tail end, thus preventing thread starvation and reducing CPU waste.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a fair spinlock with FIFO ordering is used to ensure fair lock acquisition, then thread starvation is prevented, but thread preemption causes the next thread in queue to miss the lock release, leading to CPU waste and reduced efficiency

Engineering Contradiction:
Improvefairness of lock acquisitionVSAvoidCPU utilization efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies preliminary action by having the current lock holder proactively check the execution status of the next thread in the FIFO queue before releasing the spinlock. If the next thread is detected as preempted (inactive), the current holder cancels its queue position and releases the lock immediately, allowing the thread after the preempted one to acquire the lock. This prevents the preempted thread from missing the lock release and eliminates wasted CPU spinning cycles.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If threads repeatedly spin and wait for a released lock in a FIFO queue, then fairness is maintained, but CPU cycles are wasted when the next thread is preempted

Engineering Contradiction:
ImproveFIFO ordering fairnessVSAvoidCPU cycle waste
Core Design Contradiction:
ReliabilityVSLoss of energy

Solution Approach 1:

The patent implements feedback by continuously monitoring the execution status of the next thread in the FIFO queue. The current lock holder checks whether the next thread is active or preempted, and based on this feedback, dynamically adjusts the lock release strategy. When the next thread is preempted, the holder cancels its position and releases the lock to the following thread, preventing wasted spinning cycles while maintaining fairness for active threads.

Inventive Principle:
Principle #23Feedback

3Adaptability or versatility

If the next thread in the FIFO queue is preempted, then thread diversity and responsiveness are improved, but the spinlock acquisition mechanism breaks down causing thread starvation

Engineering Contradiction:
Improvethread preemption handlingVSAvoidlock acquisition guarantee
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent applies dynamics by making the spinlock acquisition mechanism adaptive to thread preemption events. Instead of a static FIFO queue where the next thread always acquires the lock, the system dynamically detects preemption and reassigns the lock to an alternative thread. The queue structure remains dynamic, allowing threads to be skipped when preempted, ensuring that at least one active thread can acquire the lock and preventing starvation.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS20260056807A1Fair spinlock with protection against thread preemption
Publication Date: 2026.02.26 DELL PROD LP
  • US20260056807A1 patent drawing
  • US20260056807A1 patent drawing
  • US20260056807A1 patent drawing

AI summary

Techniques can include: thread TH1 acquiring a spinlock; while TH1 holds the spinlock, adding threads TH2 and TH3 to a wait queue based on a FIFO (first in first out) ordering in which threads attempt to acquire the spinlock, where TH1, TH2 and TH3 respectively have positions P1, P2 and P3 in the FIFO ordering; while TH1 holds the spinlock, pre-empting TH2; while TH2 is inactive and waiting at P2 in the FIFO ordering of the queue, TH1 releasing the spinlock; detecting that the spinlock is free and that TH3 is waiting in the queue at P3, where TH2 is next, in the FIFO ordering of threads in the queue, to acquire the spinlock after released by TH1; and responsive to said detecting, performing first processing including: cancelling the second position or index P2 of TH2 in the FIFO ordering; and TH3 acquiring the spinlock.