当前位置:首页 > 开发 > 编程语言 > 编程 > 正文

mark下G1

发表于: 2011-07-29   作者:chenchao051   来源:转载   浏览次数:
G1 GC
摘要: 简单mark下,不知道是否真有说的那么好。 Garbage-First (G1) Collector is a server-style garbage collector, targeted for multi-processors with large memories, that meets a soft real-time goal with high probability, whil

简单mark下,不知道是否真有说的那么好。
Garbage-First (G1) Collector is a server-style garbage collector, targeted for multi-processors with large memories, that meets a soft real-time goal with high probability, while achieving high throughput. G1 is the long term replacement of the Concurrent Mark-Sweep Collector (CMS). Whole-heap operations, such as global marking, are performed concurrently with the application threads, to prevent interruptions proportional to heap or live-data size. Concurrent marking provides both collection "completeness" and identifies regions ripe for reclamation via compacting evacuation. This evacuation is performed in parallel on multi-processors, to decrease pause times and increase throughput.

这边也提到了主要针对多处理器,并且有较大的内存。按他的说法,CMS就可以被G1所替代了。总之就是减少应用的暂停时间,增大吞吐量。

The G1 collector achieves these goals through several techniques. The heap is partitioned into a set of equal-sized heap regions, each a contiguous range of virtual memory. G1 compacts as it proceeds. It copies objects from one area of the heap to the other. Thus, it will not encounter fragmentation issues that CMS might encounter. There will always be areas of contiguous free space from which to allocate, allowing G1 to have consistent pauses over time. G1 uses a pause prediction model to meet a user-defined pause time target. It achieves smoother pause times than CMS at comparable throughput.
说是堆被分成了相当大小的区域,而每一个区域都是连续的。G1还是像以前一样的去压缩,把对象从一个区域复制到另一个区域,这样就避免了内存碎片,而这正是CMS经常遇到的问题。
并且呢,总会有连续的空的空间来分配。G1用了一个“预测模型”,来达到可以满足用户自定义pause time的目标。总之呢,就是在和CMS吞吐量差不多的情况下,G1的pause time更为平滑。

After G1 performs a global marking phase determining the liveness of objects throughout the heap, it will immediately know where in the heap there are regions that are mostly empty. It will tackle those regions first, potentially making a lot of space available. This way, the garbage collector will obtain more breathing space, decreasing the probability of a full GC. This is also why the garbage collector is called Garbage-First. As its name suggests, G1 concentrates its collection and compaction activity first on the areas of the heap that are likely to be full of reclaimable objects, thus improving its efficiency.
这一段也简单阐述了下,G1关注的是那些充满着可回收对象的堆。


While most real-time collectors work at the highly granular level of individual objects, G1 collects at the region level. If any region contains no live objects it is immediately reclaimed. The user can specify a goal for the pauses and G1 will do an estimate of how many regions can be collected in that time based on previous collections. So, the collector has a reasonably accurate model of the cost of collecting the regions, and therefore "the collector can choose a set of regions that can be collected within a given pause time limit with high probability." In other words, G1 is not a hard real-time collector - it meets the soft real-time goal with high probability but not absolute certainty. G1 attempts to yield higher throughput in return for the softer, but still moderately stringent, real-time constraints. This is a good fit for large-scale server applications which often have large amounts of live heap data and considerable thread-level parallelism. G1 also provides some finer control, allowing a user to specify a fraction of time during a period of execution to be spent on garbage collection. For example, for every 250ms of execution spend no more than 50ms on garbage collection.

G1 is planned to replace CMS in the Hotspot JVM. There are two major differences between CMS and G1. The first is that G1 is a compacting collector. G1 compacts sufficiently to completely avoid the use of fine-grain free lists for allocation, which considerably simplifies parts of the collector and mostly eliminates potential fragmentation issues. As well as compacting, G1 offers more predictable garbage collection pauses than the CMS collector and allows users to set their desired pause targets.
G1就是要在hotspot中来代替cms,总结了G1和cms的两个不同点。首先G1是一个压缩搜集器。其次就是G1提供了更可预测的pause time。

恩,先简单mark下好了,回头再仔细看看。。。

mark下G1

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/G1GettingStarted/index.html Co
------------------------ --2015年7月22日13:27:49 33. sql server的 sql 分页代码 1 select * fro
本文汇集了30个优秀的开源CMS建站系统,采用PHP开发。以下列表不分先后顺序。 1. AdaptCMS AdaptCMS
本文汇集了30个优秀的开源CMS建站系统,采用PHP开发。以下列表不分先后顺序。 1. AdaptCMS AdaptCMS
The G1 Garbage Collector The Garbage-First (G1) collector is a server-style garbage collector
iOS 注释 使用 #pragma mark可以用来方便查找和导航代码,例如,如果使用以下代码 <pre style="w
标记清除算法是第一个能够回收循环数据结构的算法。现在最普遍的垃圾回收技术都是标记清除算法的变
整体外观   关键词:G1外形特点、机身尺寸、机身材质、颜色手感   与iPhone的宽大、诺基亚5800
适用固件: 已升级自制固件且刷好dev的G1 注意事项: 这篇教程 主要教大家如何自定义 G1启动画 面,
The Concurrent Mark Sweep (CMS) collector The Concurrent Mark Sweep (CMS) collector (also ref
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号