Parallel Mark Processing in Virtual Machine Garbage Collection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current single-thread marking techniques in garbage collection waste memory space and reduce processing performance due to increasing memory usage as the number of marked objects grows, necessitating a more efficient method for managing memory and improving performance.
Innovation Solution
Implementing parallel mark processing using multiple threads with preset memory capacity, where each thread has a private stack and synchronously performs mark processing based on push-in conditions, allowing for efficient traversal and marking of objects across a virtual machine heap.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If single-thread marking technique is used, then implementation is simple, but memory space is wasted and processing performance is reduced
Solution Approach 1:
The patent divides the marking task into multiple segments by creating N marking threads (where N > 1), each responsible for processing a specific memory block. This segmentation allows parallel processing of different memory regions simultaneously, improving overall marking efficiency and processing performance while maintaining manageable complexity through structured division of labor.
Solution Approach 2:
The patent transitions from single-thread sequential marking to multi-thread parallel marking by adding the thread dimension. Each marking thread operates independently on different memory blocks, utilizing the fourth dimension (time parallelism) to process multiple objects simultaneously, thereby resolving the contradiction between implementation simplicity and processing performance.
2Device complexity
If single-thread marking technique is used, then implementation is simple, but memory space occupation increases
Solution Approach 1:
The patent segments the heap into N memory blocks and assigns each block to a dedicated marking thread. This segmentation ensures that each thread processes only its assigned memory block, preventing redundant marking operations and reducing overall memory space occupation by eliminating duplicate object markings that occur in single-thread approaches.
Solution Approach 2:
The patent creates N marking threads as copies of a single marking thread template, where each copy is assigned to a specific memory block. This copying approach allows efficient resource utilization while reducing memory space occupation, as each thread instance is lightweight and processes a discrete portion of the heap without interfering with other threads' memory usage.
3Productivity
If parallel mark processing with multiple threads is implemented, then processing efficiency is improved, but memory capacity requirements increase
Solution Approach 1:
The patent applies local quality by giving each marking thread a private stack with a predetermined capacity specifically tailored to its assigned memory block size. This local optimization ensures that memory capacity is allocated efficiently based on actual needs of each thread, improving garbage collection performance through parallel processing while preventing excessive overall memory capacity consumption.
Solution Approach 2:
The patent changes the parameter of stack capacity from unlimited (in single-thread marking) to predetermined and limited (in parallel marking). By setting appropriate capacity limits for each thread's private stack, the system achieves parallel processing efficiency while controlling total memory capacity usage, as the sum of limited individual stack capacities is less than the unbounded memory requirements of single-thread marking.
Data Source
AI summary
Parallel mark processing is disclosed including traversing first objects in a virtual machine heap based on correspondences between memory blocks in the virtual machine heap and N marking threads, pushing a first pointer of a first object into a private stack of a marking thread corresponding to a memory block, the first object being located in the memory block, performing first mark processing of the first object based on a push-in condition of the first pointer, and after traversal of the first objects has been completed, launching the N marking threads to cause the N marking threads to synchronously perform mark processing used in garbage collection based on push-in conditions of first pointers in respective private stacks of the first pointers.


