Lock Try or Spin Mechanism for Parallel Task Scheduling

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In parallel computing environments, existing locking mechanisms for multiple threads often lead to inefficiencies due to busy waiting and context switches, particularly when the lock-hold time is long, resulting in wasted CPU cycles and potential system crashes or hangs.

Innovation Solution

Implementing a Lock_Try_or_Spin mechanism that allows a new task to spin on a locking mechanism only if the number of tasks spinning is less than a predetermined threshold, using a combination of ticket-based and queue-based locks to determine and manage the number of waiting tasks, thereby preventing unnecessary spinning and re-dispatching tasks when the threshold is exceeded.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If tasks are allowed to spin on the locking mechanism indefinitely, then tasks can eventually acquire the lock, but CPU cycles are wasted due to busy waiting and the system may crash or hang

Engineering Contradiction:
Improvesystem stabilityVSAvoidCPU cycle waste
Core Design Contradiction:
ReliabilityVSLoss of energy

Solution Approach 1:

The system performs preliminary action by checking the number of spinning tasks before allowing a new task to spin. This prevents the system from entering a state where excessive tasks spin simultaneously, which would waste CPU cycles and potentially cause crashes. The threshold check is performed in advance to maintain system stability.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements feedback by continuously monitoring the number of tasks spinning on the locking mechanism and using this information to control whether new tasks are allowed to spin. When the threshold is exceeded, the system provides feedback by preventing new tasks from spinning, thereby reducing CPU waste and maintaining reliability.

Inventive Principle:
Principle #23Feedback

2Productivity

If a threshold is imposed on the number of spinning tasks, then CPU cycle waste is reduced, but tasks may be prevented from acquiring the lock

Engineering Contradiction:
Improvecomputing efficiencyVSAvoidtask waiting time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system applies dynamics by making the locking mechanism adaptive rather than static. The threshold for allowing tasks to spin is dynamically adjusted based on system conditions. When the number of spinning tasks approaches the threshold, the system dynamically prevents new tasks from spinning, thereby optimizing CPU usage while managing task waiting time.

Inventive Principle:
Principle #15Dynamics

3Reliability

If traditional locking mechanisms are used without thresholds, then tasks can acquire locks reliably, but busy waiting causes system hangs and crashes

Engineering Contradiction:
Improvelock acquisition reliabilityVSAvoidsystem crashes and hangs
Core Design Contradiction:
ReliabilityVSObject-generated harmful factors

Solution Approach 1:

The system applies preliminary anti-action by proactively preventing the condition that leads to system crashes and hangs. Before allowing tasks to spin, the system checks whether the number of spinning tasks would exceed the threshold. By preventing excessive spinning in advance, the system counteracts the harmful effect of busy waiting before it can cause crashes or hangs.

Inventive Principle:
Principle #9Preliminary anti-action

Data Source

PatentUS10579413B2Efficient task scheduling using a locking mechanism
Publication Date: 2020.03.03 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10579413B2 patent drawing
  • US10579413B2 patent drawing
  • US10579413B2 patent drawing

AI summary

For efficient task scheduling using a locking mechanism, a new task is allowed to spin on the locking mechanism if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between the multiple threads.