-XX:+CMSIncrementalMode 运行 是在应用程序线程上还是在 GC 专用线程中?
Does -XX:+CMSIncrementalMode run on application threads or in GC-dedicated threads?
阅读此博客 Really? iCMS? Really? 时,有一句话引起了我的注意:
The concurrent phases are typically long (think seconds and not milliseconds).
If CMS hogged the single hardware thread for several
seconds, the application would not execute during those
several seconds and would in
effect experience a stop-the-world pause.
这对我来说在抢占式操作系统上没有意义。我的假设是 CMS 有一个或多个收集器线程 运行。另一个假设是,我们不是让 CMS 有专门的 GC 线程来执行垃圾收集,而是让应用程序线程将它们的逻辑与 GC 逻辑交错(时间复用)。
是这样吗?我在这里弄错了什么?
谢谢
在 HotSpot JVM 中,垃圾收集器(包括 CMS 和 i-CMS)使用专用工作线程。
CMS 线程 运行 与应用程序线程并发,但它们有 higher priority:NearMaxPriority
。在单核机器上,CMS 循环确实会使应用程序线程挨饿。 CMS 增量模式的想法是让 GC 自动让出 CPU 给应用程序而不依赖 OS 调度程序。
Normally, the CMS collector uses one or more processors during the
entire concurrent tracing phase, without voluntarily relinquishing
them. Similarly, one processor is used for the entire concurrent sweep
phase, again without relinquishing it. This overhead can be too much
of a disruption for applications with response time constraints that
might otherwise have used the processing cores, particularly when run
on systems with just one or two processors. Incremental mode solves
this problem by breaking up the concurrent phases into short bursts of
activity, which are scheduled to occur midway between minor pauses.
请注意,CMS 增量模式 was deprecated 早在 2012 年就已存在。
阅读此博客 Really? iCMS? Really? 时,有一句话引起了我的注意:
The concurrent phases are typically long (think seconds and not milliseconds). If CMS hogged the single hardware thread for several seconds, the application would not execute during those several seconds and would in effect experience a stop-the-world pause.
这对我来说在抢占式操作系统上没有意义。我的假设是 CMS 有一个或多个收集器线程 运行。另一个假设是,我们不是让 CMS 有专门的 GC 线程来执行垃圾收集,而是让应用程序线程将它们的逻辑与 GC 逻辑交错(时间复用)。
是这样吗?我在这里弄错了什么?
谢谢
在 HotSpot JVM 中,垃圾收集器(包括 CMS 和 i-CMS)使用专用工作线程。
CMS 线程 运行 与应用程序线程并发,但它们有 higher priority:NearMaxPriority
。在单核机器上,CMS 循环确实会使应用程序线程挨饿。 CMS 增量模式的想法是让 GC 自动让出 CPU 给应用程序而不依赖 OS 调度程序。
Normally, the CMS collector uses one or more processors during the entire concurrent tracing phase, without voluntarily relinquishing them. Similarly, one processor is used for the entire concurrent sweep phase, again without relinquishing it. This overhead can be too much of a disruption for applications with response time constraints that might otherwise have used the processing cores, particularly when run on systems with just one or two processors. Incremental mode solves this problem by breaking up the concurrent phases into short bursts of activity, which are scheduled to occur midway between minor pauses.
请注意,CMS 增量模式 was deprecated 早在 2012 年就已存在。