Multi-thread Program Code Lock Collision Reduction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In multi-core processor architectures, conventional program codes often experience performance deterioration due to lock collisions, which are difficult to identify and modify manually, especially in large existing codebases, leading to system performance issues.

Innovation Solution

A method is introduced to automatically convert program code running in multi-thread environments by searching for conditional statements within synchronized blocks with no side effects, duplicating these paths outside the synchronized blocks, and adding conditional statements to execute them without acquiring locks, thereby reducing lock collisions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If program code uses synchronized blocks for exclusive execution in multi-thread environments, then thread safety is improved, but lock collisions occur frequently causing performance deterioration

Engineering Contradiction:
Improvethread safetyVSAvoidsystem performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent segments the program code by identifying synchronized blocks and extracting conditional statements with no side effects from them. This segmentation allows the code to be divided into lock-protected sections and lock-free sections, enabling parallel execution of lock-free segments while maintaining thread safety in critical sections.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts conditional statements that have no side effects from synchronized blocks and places them outside the lock-protected regions. This extraction eliminates unnecessary lock acquisitions for read-only or non-modifying operations, reducing lock collisions while preserving thread safety for operations that actually modify shared state.

Inventive Principle:
Principle #2Taking out (Extraction)

2Productivity

If manual identification and modification of lock collision causes is performed, then performance issues can be resolved, but the workload is extremely large for existing program codes

Engineering Contradiction:
Improveperformance optimizationVSAvoidmodification time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent implements an automatic analysis system that performs static analysis on program code to identify synchronized blocks and conditional statements with no side effects. This self-service approach eliminates the need for manual code review and modification, allowing the system to automatically generate optimization recommendations and reduce lock collisions without significant time investment.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent performs preliminary static analysis of the program code structure before execution to identify opportunities for lock collision reduction. By analyzing the code in advance and pre-identifying which conditional statements can be extracted from synchronized blocks, the system prepares optimization strategies beforehand, avoiding time-consuming manual intervention during deployment.

Inventive Principle:
Principle #10Preliminary action

3Productivity

If conditional statements with side effects are moved outside synchronized blocks, then lock collision frequency decreases, but thread safety may be compromised

Engineering Contradiction:
Improvelock collision frequencyVSAvoidthread safety
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies local quality by carefully analyzing each conditional statement to determine whether it has side effects. Conditional statements with no side effects (read-only operations) are extracted from synchronized blocks and placed outside, while conditional statements with side effects (modifying operations) remain inside. This selective extraction maintains thread safety for critical operations while reducing lock collisions for safe operations.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS8972959B2Method of converting program code of program running in multi-thread to program code causing less lock collisions, computer program and computer system for the same
Publication Date: 2015.03.03 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US8972959B2 patent drawing
  • US8972959B2 patent drawing
  • US8972959B2 patent drawing

AI summary

A method of converting a program code of a program running in multi-thread to a program code which causes fewer lock collisions. The method includes reading the program code into a memory and searching the program code for a first conditional statement making a branch to a path, which is in a synchronized block and has no side effect on the synchronized block; duplicating the path having no side effect to which the branch is made by the searched first conditional statement into the outside of the synchronized block; and adding a second conditional statement into the program code in response to the duplication, wherein the second conditional statement is a conditional statement making a branch to the duplicated path having no side effect. Also provided is a system and an article of manufacture which causes a computer to carry out the steps of the above method.