How CMS interleave with ParNew

Srinivas Ramakrishna ysr1729 at gmail.com
Tue Dec 24 01:19:52 PST 2013


Hi Guoqin --


On Sun, Dec 22, 2013 at 6:14 PM, Guoqin Zheng <lanson.zheng at gmail.com>wrote:

> Srinivas,
>
> Thank you very much for this detailed response.
>
> One more question, why CMS treats the young gen as the source of root
> references rather then the ordinary roots? In the other collectors, the
> roots usually comes from the stack, static variable, thread, JNI, etc. Why
> there is such difference?
>


CMS does not do any marking of objects in the minor generation, It takes
them as live, and (marks/traverses and) collects only the objects in the
old generation (and permanent generation, with certain caveats). It must
thus
treat young gen objects as roots, as it does not do any reachability
analysis of young gen objects. Like G1, it could have traversed and marked
the young generation objects as well, but for historical reasons it didn't.
If it were to traverse and mark young gen objects, it would also have had
to worry about dealing with concurrent mutation of young gen objects as
well, where mutation rate is typically much higher. I can't recall the
history of the design trade-offs here, but it's possible that the cost of
dealing with concurrent mutation of young gen objects with an incremental
update barrier of the kind CMS uses may have trumped the gains
from not treating all of them as potential roots into the old gen. (G1's
SATB barrier makes it much more immune to such young gen mutation.)

HTHS.
-- ramki


-- ramki


>
> Thanks,
>
> G. Zheng
>
>
> On Fri, Dec 20, 2013 at 12:54 AM, Srinivas Ramakrishna <ysr1729 at gmail.com>wrote:
>
>> Hi G. Zheng ---
>>
>>
>> On Wed, Dec 18, 2013 at 11:53 PM, Guoqin Zheng <lanson.zheng at gmail.com>wrote:
>>
>>> Hey folks,
>>>
>>> While search for how CMS works in detail, I happened to an article
>>> saying usuablly before the inital-mark phase and remark phase, there is
>>> young gen collection happening and the initial-mark/remark also scan young
>>> gen space. So
>>>
>>>    1. Can you help me understand how the ParNew collection work with
>>>    CMS to improve the performance.
>>>
>>> ParNew collections are minor collections. CMS collects just the old gen
>> and optionally the perm gen. A concurrent CMS
>> collection is "interrupted" by ParNew minor collections.
>>
>>>
>>>    1.
>>>    2. Why the young gen space needs to be scanned
>>>
>>> Since CMS scans and collects just the old gen and perm gen, it treats
>> the young gen as a source of roots,
>> and scans the young gen in its entirety.
>>
>>
>>>
>>>    1. If the remark takes very long, what does that mean?
>>>
>>> It typically means that there is a lot of concurrent mutation happening
>> in the old gen (perhaps as a result of
>> objects being promoted rapidly into the old gen). In this case, the
>> concurrent scanning and precleaning of the
>> CMS generation (which is designed to catch up with mutations in the old
>> gen) isn't able to keep up with
>> the rate of mutations happening there.
>>
>>
>>>
>>>    1. Finally, is there a official/or good docs talking about CMS in
>>>    detail?
>>>
>>>
>> The paper by Printezis and Detlefs in ISMM 2000 was the starting point of
>> the
>> HotSpot CMS implementation, with a few modifications along the way.
>>
>> HTHS.
>> -- ramki
>>
>>
>>> Thanks,
>>>
>>> G. Zheng
>>>
>>> _______________________________________________
>>> hotspot-gc-use mailing list
>>> hotspot-gc-use at openjdk.java.net
>>> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20131224/e842e320/attachment.html 


More information about the hotspot-gc-use mailing list