Resilient Adaptive Biased Locking for Java Concurrency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing adaptive biased locking mechanisms incur significant overhead due to reservation cancellations and learning states, particularly in scenarios where locks are predominantly accessed by a single thread or short-lived objects, leading to inefficient throughput and performance penalties.

Innovation Solution

Implementing a resilient adaptive biased locking scheme with a per-class counter that transitions objects directly from a learning state to a flatlock state or reserved state, bypassing biased states, and utilizing special bit patterns in the lock word to optimize lock acquisition sequences, thereby reducing reservation cancellations and computational costs.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If lock reservation is implemented to optimize single-threaded locking performance, then lock acquisition cost is reduced for the reserving thread, but reservation cancellation cost increases significantly when another thread acquires the lock

Engineering Contradiction:
Improvelock acquisition performanceVSAvoidcomputational overhead
Core Design Contradiction:
ProductivityVSLoss of energy

Solution Approach 1:

The system performs preliminary actions by introducing a learning state between the clear state and biased state. When a lock is first acquired, the system enters a learning phase where it observes acquisition patterns before committing to a biased state. This preliminary observation period allows the system to detect multi-threaded access patterns early, preventing premature biasing that would cause costly reservation cancellations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The lock state transitions are made dynamic and adaptive rather than static. The system continuously monitors acquisition patterns and adjusts the lock state accordingly: clearing the lock after a threshold number of cancellations, transitioning to biased state only after confirming single-threaded usage, and allowing flexible transitions between states. This dynamic adaptation resolves the contradiction by avoiding premature commitment to biased locking.

Inventive Principle:
Principle #15Dynamics

2Reliability

If a learning state is added to reduce reservation cancellations, then multi-threaded lock access is detected more accurately, but lock acquisition overhead increases due to additional state transitions

Engineering Contradiction:
Improvelock state accuracyVSAvoidlock state machine
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent merges the learning state functionality into the existing biased locking mechanism rather than creating a completely separate system. The learning state shares the same lock word representation and transition mechanisms as the biased and clear states, combining multiple functions into a unified state machine. This merging approach reduces overall system complexity compared to having entirely separate learning and biased locking systems.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The system uses parameter changes in the lock word to represent different states (clear, learning, biased, flatlock). By encoding state information within the existing lock word parameters and using threshold-based decision logic, the system achieves accurate multi-threaded detection without requiring complex additional data structures or state management mechanisms.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If locks transition through biased state to flatlock state, then reservation cancellations are reduced, but computational overhead increases due to state transition checks

Engineering Contradiction:
ImprovethroughputVSAvoidstate transition time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent implements a skipping mechanism where, under certain conditions, the lock transitions directly from the learning state to the flatlock state, bypassing the biased state entirely. This occurs when the learning state detects clear single-threaded access patterns, allowing the system to rush through unnecessary intermediate states and reduce computational overhead while maintaining accurate lock management.

Inventive Principle:
Principle #21Skipping (Rushing through)

Data Source

PatentUS11740947B2Resilient adaptive biased locking in multi-thread concurrent program execution
Publication Date: 2023.08.29 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11740947B2 patent drawing
  • US11740947B2 patent drawing
  • US11740947B2 patent drawing

AI summary

A computer-implemented method and system for resilient adaptive biased locking. The method includes adding, in a system including an adaptive lock reservation scheme having a learning state, a component comprising a per class counter that counts, collectively, a number of learning failures and a number of revocation failures. An embodiment includes initializing the per class counter upon loading a class with a predetermined value representing at least one of a maximum number of learning failures and cancellation instances associated with the class. An embodiment includes initializing, based on a determination of an operational state of the per class counter for an object transitioning from one of the learning state and a biased state to a flatlock state, a lock word of the object directly to the flatlock state while bypassing the biased state.