'Can someone explain what happens in the "Concurrent Abortable Preclean" phase of CMS garbage collection?
I went through https://plumbr.eu/handbook/garbage-collection-algorithms-implementations/concurrent-mark-and-sweep link explaining CMS GC, but couldn't understand what Concurrent Abortable Preclean is doing, would be helpful if someone explains it in detail.
Solution 1:[1]
The blog post Understanding CMS GC Logs mentions the purpose of the (non-abortable) preclean phase:
Precleaning is also a concurrent phase. Here in this phase we look at the objects in CMS heap which got updated by promotions from young generation or new allocations or got updated by mutators while we were doing the concurrent marking in the previous concurrent marking phase. By rescanning those objects concurrently, the precleaning phase helps reduce the work in the next stop-the-world “remark” phase.
So that phase is an optimization.
The abortable preclean is then described as
After 'concurrent preclean' if the Eden occupancy is above CMSScheduleRemarkEdenSizeThreshold, we start 'concurrent abortable preclean' and continue precleanig until we have CMSScheduleRemarkEdenPenetration percentage occupancy in eden, otherwise we schedule 'remark' phase immediately.
Another post The Unspoken - CMS and PrintGCDetails further mentions:
The remark phase is scheduled so that it does not occur back-to-back with a ParNew so as not to appear to be a pause that is the sum of the ParNew and the remark pause. A second precleaning phase is started and is aborted when the remark phase is ready to start. Aborting this second precleaning phase is the expected behavior. That it was aborted is not an indication of an error. Since the remark phase is waiting, why not preclean but don't delay the remark for the sake of precleaning.
In other words the abortable preclean is an optimization (of the preclean optimization) to space the remark pause between young collections and to spend that waiting time in a useful manner.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | freedev |