知识库--jvm-Parallel+Compacting+Collector(并行压缩回收)

来源:互联网 发布:护眼宝pc版 知乎 编辑:程序博客网 时间:2024/06/15 01:55

Parallel Compacting Collector

The parallel compacting collector was introduced in J2SE 5.0 update 6. The difference between it and the parallel collector is that it uses a new algorithm for old generation garbage collection. Note: Eventually, the parallel compacting collector will replace the parallel collector.

Young Generation Collection Using the Parallel
Young generation garbage collection for the parallel compacting collector is done using the same algorithm as that for young generation collection using the parallel collector.
Old Generation Collection Using the Parallel Compacting Collector With the parallel compacting collector, the old and permanent generations are collected in a stop-the-world, mostly parallel fashion with sliding compaction. The collector utilizes three phases. First, each generation is logically divided directly reachable from the application code is divided among garbage collection
as live, the data for the region it is in is updated with information about the size and location of the object.

The summary phase operates on regions, not objects. Due to compactions from previous collections, it is typical that some portion of the left side of each generation will be dense, containing mostly live objects. The amount of space that could be recovered(回收) from such dense regions is not worth the cost of compacting them. So the first thing the summary phase does is examine the density of the regions, starting with the leftmost one, until it reaches a point where the space that could be recovered from a region and those to the right of it is worth the cost of compacting those regions. The regions to the left of that point are referred to as the dense prefix, and no objects are moved in those regions. The regions to the right of that point will be compacted, eliminating all dead space. (任务)The summary phase calculates and stores the new location of the first byte of live data for each compacted region(多线程copy的基础).
Note: The summary phase is currently implemented as a serial phase(重点); parallelization is possible but not as important to performance as parallelization of the marking and compaction phases.//汇总阶段串行 而标记和压缩为并行

In the compaction phase, the garbage collection threads use the summary data to identify regions that need to be filled, and the threads can independently copy data into the regions. This produces a heap that is densely packed on one end, with a single large empty block at other end.

适用于多cpu,stop-the-world时间严格限制。
option command: -XX:+UseParallelOldGC.

0 0
原创粉丝点击