JIT Compiler Lock Profiling and Biased Conversion

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing techniques for managing locks in multithreaded software applications incur performance penalties due to the overhead of adjusting between lightweight and biased locks, often resulting in permanent conversion to lightweight locks, which is costly even when conditions revert to requiring biased locks.

Innovation Solution

A just-in-time compiler profiles locks during execution, identifying and converting lightweight locks to biased locks at a global safepoint based on access information, optimizing lock usage by determining biases based on current lock status and access patterns.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If locks are converted to lightweight locks to reduce overhead, then performance improves when there is no contention, but the system loses the ability to use biased locks when conditions revert to requiring exclusive access

Engineering Contradiction:
Improveapplication performanceVSAvoidlock conversion flexibility
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The patent implements dynamic lock management where the Just-In-Time compiler continuously monitors lock access patterns and automatically converts locks between different types (biased, lightweight, heavyweight) based on runtime conditions. This dynamic adaptation allows the system to optimize for performance when there is no contention while maintaining the ability to use appropriate lock types when contention occurs, thereby resolving the contradiction between performance improvement and adaptability loss.

Inventive Principle:
Principle #15Dynamics

2Reliability

If atomic instructions are used to enforce mutually exclusive access, then thread safety is ensured, but performance penalties increase due to additional processing cycles

Engineering Contradiction:
Improvethread safetyVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies different lock implementation strategies to different locks based on their specific access patterns and contention characteristics. By analyzing individual lock behavior and applying localized optimizations (biased locks for single-threaded access, lightweight locks for low contention, heavyweight locks for high contention), the system ensures thread safety where needed while minimizing the performance impact of atomic instructions to only those locks that actually require them.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS11036528B2Efficient profiling-based lock management in just-in-time compilers
Publication Date: 2021.06.15 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11036528B2 patent drawing
  • US11036528B2 patent drawing
  • US11036528B2 patent drawing

AI summary

Aspects of the present disclosure describe techniques for managing locks in just-in-time compiled code in a software application. An example method generally includes profiling locks by during execution of the JIT compiled code. Locks are generally profiled by identifying locks on resources accessed by the JIT compiled code, and recording access information for each of the identified locks. When a safepoint is reached during execution of the JIT compiled code, one or more locks eligible for conversion to a biased lock are identified .based on the recorded access information for each of the identified locks, one or more locks eligible for conversion to a biased lock. Each respective lock of the one or more eligible locks is converted to a biased lock based on a current lock status of the respective lock.