并发GC 之所以称为“并发”,是因为它的很多操作 与 应用程序的业务 是并发关系。
注意是“很多操作”而不是“所有操作”。所以提到它时会附带“Mostly”,即“Mostly Concurrent Collectors”。
Hotspot JDK 8 中 有 2个 并发GC:
-
CMS(Concurrent Mark Sweep Collector): 适用于需要更短的GC暂停时间,且可以忍受处理器资源被GC共享 的应用程序。
(其实这是 并发GC 的一般特征,G1 也是这样的。)
- G1(Garbage-First Garbage Collector): 适用于大内存多处理器的机器。它可以在实现高吞吐量目标的同时,高概率满足暂停时间目标。
并发的开销
并发GC 以处理器资源为代价换取更短的 Major GC 暂停时间(这些处理器资源本可以用于执行应用程序的业务)。
最明显的开销就是在 GC 并发操作期间,它会用到 一个或多个 处理器。
在有 N 个 处理器的系统上,这些并发操作会使用 K/N 个处理器,其中 1<= K <=ceiling{N/4} 。(注意:K 的精度选择和边界可能会更改。)
除了在并发阶段使用处理器外,“启用并发性”也会产生额外的开销。
因此,虽然使用 并发GC 后暂停时间会短得多,但的吞吐量比 其它GC 稍低。
在多处理器机器上,GC并发阶段期间,业务线程仍然有可用的处理器,所以 并发GC 不会“暂停”应用程序。这个特性最终会表现为“较短的暂停”。但是,再提一次,应用程序可用的处理器资源会减少,而且处理速度会降低,特别是在应用程序业务最大限度地使用所有处理器的情况下。《Concurrent Mark Sweep (CMS)》中的“并发模式失败”讨论了这种“缩减”的潜在限制。
因为并发阶段至少要用到一个处理器,所以 并发GC 在单处理器机器上通常没有任何好处。
然而 CMS(不是G1)有一个特殊的模式,可以在只有一个或两个处理器的系统上实现低暂停。
参见《Concurrent Mark Sweep (CMS)》中的“增量模式”。
此特性在 Java SE 8 中被标记为“已废弃”,并且可能在后续的主干版本中被删除。
其它参考文献
相关推荐
Mostly adequate guide to FP (in javascript)
文凭GC C++ 的非保守垃圾收集器。安装: ./autogen.sh 。/配置清洁 | 制作| 进行安装测试: cd 测试/boehmTest 使 LD_LIBRARY_PATH=/usr/local/lib ./output
This book teaches you how to design and develop distributed web services in Java using RESTful architectural principles on top of the HTTP protocol. It is mostly a comprehensive reference guide on the...
聪明人都知道,学习函数式编程是很困难的。我自己学了很久也只感觉掌握了皮毛而已(并且这种永远只是略懂的感觉一直挥之不去)。幸运的是,这是一本非常好的教程。 函数式编程的概念里充满着诸如函数演算、代数、...
mostly-adequate-guide, 对 FP ( 在javascript中)的充分指导 关于本书这是一本关于一般功能范例的书。 我们将使用世界上最流行的函数编程语言: JavaScript 。有些人可以能觉得这是一个不好的选择,因为当前区域性的...
微软提供的WDK10开发的例子,用于驱动开发,保存于GitHub
mostly adequate guide
A collection of various utilities, classes and shaders for Java OpenGL GLSL(fixed function pipeline mostly) programming. The sources were originally developed for education pusposes and then I decided...
Matlab functions for wireless communications focussing mostly on LTE 3GPP.
This book is obviously targeted mostly for developers. We want to help Java programmers to get started and feel comfortable with both the syntax of the language and the tools. We will achieve this by ...
Some notes on machine learning algorithms, mostly in Matlab format.zip
Language Models (Mostly) Know What They Know.pdf
The output will be reasonably valid C++ code that looks alot like its Java counterpart and hopefully works mostly the same.The translation is based on The Java Language Specification, Third Edition, ...
Provides charsets that are not in java.base (mostly double byte and IBM charsets). jdk.compiler Defines the implementation of the system Java compiler and its command line equivalent, javac, as well ...
用法安装npm install mostly-poplarjs-rest快速范例import express from 'express' ;import bodyParser from 'body-parser' ;import nats from 'nats' ;import mostly from 'mostly-node' ;import poplar from '...
用法安装npm install mostly-poplarjs快速范例将您的Poplarjs API转换为微服务非常容易。 您现有的Poplarjs代码// dummy_api.jsconst ApiBuilder = poplar . ApiBuilder ;var DummyApi = new ApiBuilder ( 'dummies'...
英雄联盟LOL加里奥宝典云顶之弈循环,。。。。。英雄联盟LOL加里奥宝典云顶之弈循环
Meizu Foundation Classes library (MZFC) is a set of classes & APIs that is simple to learn and used. With MZFC, developing Meizu M8 style applications is mostly simplified.
太平洋集团java笔试题几乎真实的简历 (GPT-3) 这使用 GPT-3 API 访问来生成假简历。 简而言之,在使用 GPT-3 时,您将它传递到一个问题或语句(带有一些参数)中,然后它会吐出一些很酷的东西。 这个项目试图改进...
Open up android/app/src/main/java/[...]/MainApplication.java Add import co.twinger.zoomlayout.RNZoomLayoutPackage; to the imports at the top of the file Add new RNZoomLayoutPackage() to the list ...