问题描述
每当使用CMS的并发模式失败或升级失败时,它会使用单线程完成GC。为什么它不能使用并行采集器来完整的GC来减少完整的GC惩罚?
Whenever there's concurrent mode failure or promotion failure using CMS it does full GC using single thread. Why it couldn't do full GC using parallel collector to decrease the full GC penalty?
推荐答案
它没有以这种方式实施,工程努力集中在G1上。 CMS的大多数用户只是试图以一种永不会发生的方式调整它,从不意味着间隔大于任何需要重启JVM的时间间隔。由于收集器之间的内部数据结构不同,因此并行旧收集器不能通过简单地调用其代码来重复使用,因此它将涉及不重要的实现工作。
There is no particular reason other than that it hasn't been implemented that way and engineering effort is focused on G1. Most users of CMS just try to tune it in a way that it never happens, "never" meaning at an interval greater than whatever requires JVM restarts anyway. The parallel old collector can't be reused by simply calling its code since internal data structurs between the collectors differ, so it would involve non-trivial implementation effort.
Google devs a 为CMS提供并行完整的GC,但我不会指望它可以在任何openjdk构建中随时获得。
Google devs have proposed a patch to contribute parallel full GC to CMS, but i wouldn't count on it becoming available in any openjdk builds anytime soon.
这篇关于为什么CMS完全GC单线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!