Real-time Garbage Collection via Concurrent Object Replication

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Real-time systems face performance and response latency issues due to the overhead of garbage collection in modern programming languages, which impedes their adoption in critical applications like electronic securities trading and cyber-security defenses, where predictable and timely responses are essential.

Innovation Solution

A method and system for real-time garbage collection that initiates garbage collection by scanning application thread stacks incrementally using garbage collector threads and application threads, replicating referenced objects from a 'from-space' to a 'to-space' memory location, and maintaining write logs to optimize performance, allowing for concurrent execution and reduced latency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional garbage collection is used in real-time systems, then memory can be automatically reclaimed, but performance and response latency deteriorate due to collection overhead

Engineering Contradiction:
Improvememory management reliabilityVSAvoidsystem performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The heap memory is divided into two separate spaces: from-space and to-space. Objects are allocated in from-space during normal execution, and during garbage collection, live objects are copied to to-space. This segmentation allows application threads to continue executing in from-space while garbage collector threads work on to-space, eliminating performance degradation.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary actions by maintaining two ready-to-use memory spaces. When garbage collection is needed, the system simply switches allocation to the other space without pausing application execution. This preliminary preparation of dual spaces enables continuous operation during memory reclamation.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If garbage collection pauses application threads to scan and mark objects, then memory reclamation can be performed, but response latency increases

Engineering Contradiction:
Improvememory reclamationVSAvoidresponse latency
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

Application threads continue executing their useful work in from-space without interruption during garbage collection. The garbage collector operates concurrently on to-space, copying live objects and updating references. This continuity ensures that response latency remains predictable while memory reclamation proceeds in the background.

Inventive Principle:
Principle #20Continuity of useful action

Solution Approach 2:

The patent introduces an intermediary mechanism using two memory spaces as buffers. The from-space serves as the active workspace for application threads, while to-space serves as the collection workspace for garbage collector threads. This intermediary dual-space structure mediates between application execution and garbage collection, preventing direct interference.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Reliability

If the entire thread stack is scanned to find referenced objects, then all live objects can be identified, but scanning time and overhead increase

Engineering Contradiction:
Improveobject identification accuracyVSAvoidscanning time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The garbage collector performs partial scanning of thread stacks by using preemption points in the compiled code to identify boundaries of stack frames. Instead of scanning entire stacks, the collector scans only the necessary portions between preemption points, reducing scanning time while still identifying all live objects through multiple incremental passes.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS11132294B2Real-time replicating garbage collection
Publication Date: 2021.09.28 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11132294B2 patent drawing
  • US11132294B2 patent drawing
  • US11132294B2 patent drawing

AI summary

A method and a system for garbage collection on a system. The method includes initiating a garbage collection process on a system by a garbage collector. The garbage collector includes one or more garbage collector threads. The method also includes marking a plurality of referenced objects using the garbage collector threads and one or more application threads during a preemption point. The method includes replicating the referenced objects using the garbage collector threads and marking for replication any newly discovered referenced objects found by scanning the application thread stack from a low-water mark. The method also includes replicating the newly discovered referenced objects and overwriting any reference to the old memory location.