Garbage Collection Marking via Partitioned Pointer Segmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing garbage collection methods are hindered by the reliance on slow synchronization instructions, such as compare-and-swap (CAS) instructions, which can slow down user program execution and reduce memory reclamation efficiency without ensuring data integrity.

Innovation Solution

The implementation of a garbage collection system that avoids CAS instructions by using non-CAS atomic write instructions to set reference mark bits in memory pointers, allowing concurrent execution with mutator threads without compromising data integrity or increasing the risk of false negatives in memory reclamation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If compare-and-swap (CAS) instructions are used for garbage collection marking, then data integrity is ensured through synchronization, but execution speed decreases due to the cost of CAS instructions

Engineering Contradiction:
Improvedata integrityVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The pointer is segmented into two separate parts: an address portion and a garbage collection (GC) portion. The GC portion contains a reference mark bit that can be set independently without affecting the address portion. This segmentation allows the garbage collector to mark pointers using simple atomic writes to the GC portion, avoiding the need for expensive CAS instructions that would otherwise be required to safely modify the entire pointer while preserving data integrity.

Inventive Principle:
Principle #1Segmentation

2Productivity

If concurrent garbage collection is implemented, then user program execution continues without stopping, but synchronization complexity increases

Engineering Contradiction:
Improveconcurrent executionVSAvoidsynchronization complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

By segmenting the pointer into address and GC portions, the patent enables concurrent garbage collection with minimal synchronization. The mutator thread can freely write to the address portion while the garbage collector independently sets the reference mark bit in the GC portion using atomic writes. This eliminates the need for complex synchronization mechanisms like CAS instructions, locks, or barriers, allowing true concurrent execution.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The GC portion of the pointer acts as an intermediary structure that facilitates safe concurrent access between the mutator thread and garbage collector. Instead of requiring complex synchronization to protect shared data structures, the patent uses this intermediary GC portion to store marking information that can be safely written by the garbage collector without interfering with mutator operations on the address portion.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP3921736B1Reducing synchronization reliance in garbage collection marking
Publication Date: 2024.04.10 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3921736B1 patent drawingFigure 1~2
  • EP3921736B1 patent drawingFigure 3~4
  • EP3921736B1 patent drawingFigure 5~7

AI summary

Memory reclamation is tailored to avoid certain synchronization instructions, speeding concurrent garbage collection while preserving data integrity and availability. Garbage collection reclaims objects no longer in use, or other unused areas of memory. Pointers are partitioned into address portions holding address values and garbage collection portions having a special bit. Marking code writes only the garbage collection portions, setting the special bit as a mark reference, relocation candidate, etc. Mutator threads may concurrently mutate the entire pointer to update the address, but mutation does not cause incorrect reclamations or failure of operations such as relocation. Execution speed is increased by avoiding certain synchronization instructions in the garbage collector, and using different atomic writes instead. Mutators run in user or kernel address spaces. The garbage collector may enclose partitioned pointers and their use, to avoid runtime errors by code that expects references to be in a canonical nonpartitioned form.