Dynamic Reference Counting for Multi-Threaded Resource Visibility

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In multi-threaded environments, maintaining reference counts atomically is computationally expensive due to the need for indivisible operations, which increases overhead in high-performance computing environments where reference-counted resources are shared among multiple threads.

Innovation Solution

A method that determines whether to perform atomic or conventional reference counting based on a single bit of the reference count, using atomic operations only when the resource is visible to multiple threads, thereby reducing the need for expensive atomic increments and decrements by using conventional arithmetic when the resource is only visible to a single thread.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If atomic reference counting is performed in multi-threaded environments, then reference count accuracy is maintained, but computing resource overhead increases

Engineering Contradiction:
Improvereference count accuracyVSAvoidcomputing resource overhead
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent dynamically adjusts the reference counting strategy based on the visibility state of the resource. When a resource is visible to multiple threads, atomic operations are used to ensure accuracy. When the resource becomes visible to only one thread, the system switches to conventional non-atomic operations, thereby reducing computing overhead while maintaining correctness when needed.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the operational parameter of reference counting from always-atomic to conditionally-atomic based on the visibility bit state. This parameter change allows the system to adapt between two operational modes: atomic mode for multi-threaded visibility and conventional mode for single-threaded visibility, optimizing resource usage accordingly.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If atomic operations are used for reference count maintenance, then thread safety is ensured, but performance deteriorates

Engineering Contradiction:
Improvethread safetyVSAvoidperformance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system dynamically switches between atomic and non-atomic reference counting operations based on the visibility bit. When the visibility bit indicates multi-threaded access, atomic operations ensure thread safety. When the visibility bit indicates single-threaded access, conventional operations maintain performance without sacrificing safety since no other threads can access the resource.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent extracts the thread safety requirement from being a universal constraint and applies it selectively only when needed. By using the visibility bit to determine when atomic operations are necessary, the system removes the unnecessary overhead of atomic operations in single-threaded contexts while preserving thread safety in multi-threaded contexts.

Inventive Principle:
Principle #2Taking out (Extraction)

3Use of energy by moving object

If conventional reference counting is used, then computing overhead is reduced, but thread safety cannot be guaranteed

Engineering Contradiction:
Improvecomputing overheadVSAvoidthread safety
Core Design Contradiction:
Use of energy by moving objectVSReliability

Solution Approach 1:

The system dynamically adapts the reference counting mechanism based on runtime conditions indicated by the visibility bit. Conventional non-atomic operations are used when the visibility bit shows single-threaded visibility, reducing overhead. When the visibility bit shows multi-threaded visibility, atomic operations are employed to guarantee thread safety, thus balancing overhead and reliability based on actual needs.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The visibility bit acts as an intermediary that mediates between conventional and atomic reference counting operations. This single bit of state information determines which operation type to use, allowing the system to transition smoothly between overhead-reduced mode and safety-guaranteed mode based on the actual threading context.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Reliability

If atomic increment/decrement operations are performed, then reference count consistency is maintained, but execution time increases

Engineering Contradiction:
Improvereference count consistencyVSAvoidexecution time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent implements dynamic selection of increment/decrement operations based on the visibility bit state. Atomic increment/decrement operations are performed only when the visibility bit indicates multi-threaded visibility, ensuring consistency when needed. When the visibility bit indicates single-threaded visibility, conventional increment/decrement operations are used, reducing execution time without compromising consistency since no other threads can interfere.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system applies atomic operations partially - only when the visibility bit indicates multi-threaded access is required. This partial application of atomic operations avoids the excessive time cost of atomic operations in single-threaded contexts while maintaining consistency when multi-threaded access occurs, achieving an optimal balance between consistency and execution time.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS10621086B2Dynamic resource visibility tracking to avoid atomic reference counting
Publication Date: 2020.04.14 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10621086B2 patent drawing
  • US10621086B2 patent drawing
  • US10621086B2 patent drawing

AI summary

Determining whether to perform atomic or conventional reference counting is provided. A single bit of a reference count corresponding to a reference-counted resource is read to determine whether to atomic reference counting is to be performed. It is determined whether the single bit of the reference count is set. In response to determining that the single bit is set, an atomic operation for atomic maintenance of the reference count corresponding to the reference-counted resource is performed by adjusting the reference count by a value of two. In response to determining that the single bit is not set, a conventional adjustment operation is performed for maintenance of the reference count corresponding to the reference-counted resource.