简体   繁体   English

年轻一代的垃圾收集器

[英]Garbage collector for young generation

Have sort question - is it true that all GC in JDK 7 (other than G1) always use stop-the-world for young generation collection? 有排序问题 - JDK 7中的所有GC(G1除外)是否始终使用stop-the-world进行年轻代收集?

thanks 谢谢

For OpenJDK, JRockit, IBM JVM, and Sun/Oracle JDK, the young collection is always stop the world for every available collector. 对于OpenJDK,JRockit,IBM JVM和Sun / Oracle JDK,年轻的系列总是为每个可用的收集器停止世界。

The only JVM I know of which does not have a stop the world collector is Azul's Zing. 我所知道的唯一没有阻止世界收藏家的JVM是Azul的Zing。 (Not free) (不是免费的)

While OpenJDK/Hotspot has CMS this is mostly concurrent. 虽然OpenJDK / Hotspot有CMS,但这主要是并发的。 There is still stop the world portions and in some cases CMS will fall back to a Full GC which is stop-the-world. 仍有世界各地的部分停留,在某些情况下,CMS将退回到全球GC,这是一个世界末日。

AFAIK, It is hard to find real world examples where G1 is faster in terms of pause time than CMS, however it is improving all the time. AFAIK,很难找到真实世界的例子,其中G1在暂停时间方面比CMS更快,但它总是在不断改进。

Do your GC logs speak to you 您的GC日志是否与您说话

All (almost) Java garbage collectors has some sort of a Stop-the-world phase where all the Java threads (not native threads) are suspended waiting for exclusive system operations to complete. 所有(几乎)Java垃圾收集器都有某种Stop-the-world阶段,其中所有Java线程(非本机线程)都被挂起,等待独占系统操作完成。 This state is sometimes referred to as a safepoint. 这种状态有时被称为安全点。

The modern garbage collectors are concurrently running together with the applications threads, which means that the garbage collector perform its work at the same time as the application threads are running. 现代垃圾收集器与应用程序线程同时运行,这意味着垃圾收集器在应用程序线程运行的同时执行其工作。 During the garbage collector process there are phases where exclusive access memory is needed, in that phase the application Java threads goes into the safepoint state. 在垃圾收集器进程期间,存在需要独占访问存储器的阶段,在该阶段,应用程序Java线程进入安全点状态。

One alternative to get rid of the stop-the-world garbage collections is to go for the Zing JVM with the C4 collector from Azul systems. 摆脱世界末日垃圾收集的另一种方法是使用Azul系统的C4收集器来使用Zing JVM。 The implementation has a low pause approach with no stop-the-world collections at all. 该实现具有低暂停方法,根本没有停止世界的集合。 Instead it is using a concurrent compacting approach with no stop-the-world phase. 相反,它使用的是并发压缩方法,没有世界末日。

No it is not true. 不,这不是真的。 Java 7 also supports the older Concurrent Mark Sweep (CMS) collector. Java 7还支持较旧的Concurrent Mark Sweep(CMS)收集器。 CMS is a low pause collector, just like G1. CMS是一个低暂停收集器,就像G1一样。

UPDATE UPDATE

Apparently CMS is only for the tenured generation ... according to the blog posting that you found at http://blogs.oracle.com/jonthecollector/entry/our_collectors 显然,CMS仅适用于终身代......根据您在http://blogs.oracle.com/jonthecollector/entry/our_collectors上发现的博客文章

So that means that your proposition is in fact true. 这意味着你的命题实际上是正确的。


One could argue that all of the low-pause collectors: - need to stop the mutator threads to do some phases of their work, and - may fall back to a Full GC using the mark/sweep collector when they can't keep up. 有人可能会争辩说所有的低暂停收集器: - 需要阻止mutator线程完成其工作的某些阶段,并且 - 当它们无法跟上时,可能会使用标记/扫描收集器回退到Full GC。

However, there is a qualitive difference between "mostly concurrent" collectors like G1 and CMS, and other collectors that suspend non-GC threads for the entire duration of the collection process. 但是,“大多数并发”收集器(如G1和CMS)与其他收集器之间存在质量差异,这些收集器在整个收集过程中暂停非GC线程。 That is what is normally meant by a "stop the world" strategy. 这通常意味着“制止世界”战略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM