IP Library Granted Patent US 11,003,578
Granted Patent B2
US 11,003,578 · App. 16/144,624 · Granted May 11, 2021

Method and system for parallel mark processing

Inventors: Zhefeng Wu (Hangzhou, CN); Jianghua Yang (Hangzhou, CN)
Assignee: BANMA ZHIXING NETWORK (HONGKONG) CO., LIMITED
G06F12/0253G06F9/45558G06F9/4881G06F12/0261G06F12/0269G06F12/0276G06F2009/45583G06F2212/1024G06F2212/1044G06F2212/657
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,003,578
App. No.
16/144,624
Granted
May 11, 2021
Kind
B2
Abstract

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.

Claims (45)

1. A method, comprising:

traversing first objects in a virtual machine heap based on correspondences between memory blocks in the virtual machine heap and N marking threads, wherein N is an integer greater than 1, wherein memory capacity occupied by the N marking threads is preset, wherein each marking thread includes a corresponding private stack, and wherein the memory capacity includes a thread memory capacity of N private stacks;

pushing a first pointer of a first object of the first objects into a private stack of a marking thread corresponding to a memory block, the first object being located in the memory block, comprising:

determining whether the private stack of the marking thread is full;

in response to a determination that the private stack of the marking thread is full:

marking the private stack as overflowing; and

marking the first object as having an overflowed status for a push-in condition; and

performing one or more of the following:

recording, in a list form, the push-in condition of the first object corresponding to the private stack of the marking thread; and/or

marking a status corresponding to the first object in a bitmap of the memory block where a current first object is located;

performing first mark processing of the first object based on the push-in condition of the first pointer, comprising:

determining whether the private stack is overflowing; and

in response to a determination that the private stack is overflowing, omitting to perform the first mark processing of the first object until the private stack has new processing space;

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.

2. The method as described in claim 1 , prior to the traversing of the first objects in the virtual machine heap, the method further comprises:

requesting the N marking threads;

traversing the memory blocks in the virtual machine heap; and

establishing the correspondences between the memory blocks in the virtual machine heap and the N marking threads.

3. The method as described in claim 2 , wherein the establishing of the correspondences between the memory blocks in the virtual machine heap and the N marking threads comprises:

performing one of the following:

designating a corresponding marking thread for at least one memory block; or

designating at least one memory block which at least one marking thread is responsible for marking.

4. The method as described in claim 3 , wherein the establishing of the correspondences between the memory blocks in the virtual machine heap and the N marking threads comprises:

allocating an identifier to a first memory block; and

determining a marking thread identifier corresponding to a first memory block number based on first memory block numbers and a total quantity of the N marking threads.

5. The method as described in claim 4 , wherein the determining of the marking thread identifier corresponding to the first memory block number comprises:

acquiring a remainder from dividing the total quantity of the N marking threads by the first memory block identifier to determine a marking thread identifier corresponding to the at least one memory block.

6. The method as described in claim 1 , wherein the performing of the first mark processing of the first object based on the push-in condition of the first pointer comprises:

in response to a determination that the first pointer was successfully pushed into the private stack of the marking thread corresponding to the memory block where the current first object is located, marking a status corresponding to the first object in a bitmap of the memory block where the current first object is located as pushed-in.

7. A system, comprising:

a processor; and

a memory coupled with the processor, wherein the memory is configured to provide the processor with instructions which when executed cause the processor to:

traverse first objects in a virtual machine heap based on correspondences between memory blocks in the virtual machine heap and N marking threads, wherein N is an integer greater than 1, wherein memory capacity occupied by the N marking threads is preset, wherein each marking thread includes a corresponding private stack, and wherein the memory capacity includes a thread memory capacity of N private stacks;

push a first pointer of a first object of the first objects into a private stack of a marking thread corresponding to a memory block, the first object being located in the memory block, comprising to:

determine whether the private stack of the marking thread is full;

in response to a determination that the private stack of the marking thread is full:

mark the private stack as overflowing; and

mark the first object as having an overflowed status for a push-in condition; and

perform one or more of the following:

record, in a list form, the push-in condition of the first object corresponding to the private stack of the marking thread; and/or

mark a status corresponding to the first object in a bitmap of the memory block where a current first object is located;

perform first mark processing of the first object based on the push-in condition of the first pointer, comprising to:

determine whether the private stack is overflowing; and

in response to a determination that the private stack is overflowing, omit performing the first mark processing of the first object until the private stack has new processing space; 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.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 11, 2020
From: ALIBABA GROUP HOLDING LIMITED
To: BANMA ZHIXING NETWORK (HONGKONG) CO., LIMITED
Reel/Frame 054384/0014 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 17, 2019
From: WU, ZHEFENG; YANG, JIANGHUA
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 048788/0529 →
Continuity (2)
Continuation In Part PCTCN2017077446 · Mar 21, 2017
Related Publication 20190129843A1 · May 2, 2019