Reference Counting Overhead Reduction via Segmented Local and Global Counters

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

As the number of threads in a computing system increases, memory management becomes less efficient due to increased reference counting instructions, leading to higher latencies and reduced processing efficiency, especially when multiple threads access shared memory objects.

Innovation Solution

Implementing a global reference counter with a lock and local reference counters in a lock-free manner to track thread references to memory objects, reducing the need for locking mechanisms and minimizing overhead.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a global reference counter with locking mechanisms is used to track thread references to memory objects, then reference counting accuracy is maintained, but system performance deteriorates due to increased locking overhead and instruction overhead

Engineering Contradiction:
Improvereference counting accuracyVSAvoidsystem performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The reference counting system is segmented into local reference counters (one per thread) and a global reference counter. Each thread maintains its own local counter to track references it creates, eliminating the need for locking during local counter updates. The global counter only needs to be updated during initial and final references, significantly reducing locking overhead while maintaining accuracy.

Inventive Principle:
Principle #1Segmentation

2Measurement precision

If reference counting instructions are increased to track more threads, then reference tracking accuracy is improved, but processing efficiency deteriorates due to increased instruction overhead

Engineering Contradiction:
Improvereference tracking accuracyVSAvoidprocessing efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The system divides reference tracking into thread-specific local counters and a shared global counter. Local counters are updated without locking operations, providing accurate per-thread reference tracking with minimal overhead. The global counter provides overall reference accuracy with reduced update frequency, achieving both precision and efficiency.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Each thread is responsible for maintaining its own local reference counter, autonomously tracking references it creates without requiring synchronization with other threads. This self-service approach eliminates locking overhead for the majority of reference operations while maintaining accurate reference counting.

Inventive Principle:
Principle #25Self-service

3Productivity

If multiple threads share common memory objects, then computational throughput is improved, but memory management efficiency deteriorates due to increased reference count transfers between memories

Engineering Contradiction:
Improvecomputational throughputVSAvoidreference count transfer latency
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The reference counting system is segmented into processor-local components (local counters in thread contexts) and a global coordinator. This segmentation allows threads on different processors to update their local counters independently without transferring reference count data across processor boundaries, eliminating transfer latency while supporting parallel execution.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The global reference counter acts as an intermediary that coordinates between local counters. It is only consulted during initial and final references, serving as a lightweight mediator that synchronizes memory management without requiring frequent inter-processor communication or data transfers.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP3571583B1System and method to reduce overhead of reference counting
Publication Date: 2022.01.26 HUAWEI TECH CO LTD
  • EP3571583B1 patent drawingFigure 1
  • EP3571583B1 patent drawingFigure 2A
  • EP3571583B1 patent drawingFigure 2B

AI summary

The disclosure relates to technology for reference counting. A global reference counter associated with a lock to count one or more threads of a process referencing an object allocated in the memory is established. Each reference to the object by a thread is then tracked using a corresponding local reference counter. The global reference counter is updated whenever a reference to the object by each of the one or more threads is an initial reference or a final reference. Otherwise, local counters are used to track a local reference count of the object.