Reputation: 10530
There are 4 high level phases CMS works for full GC
I have got high level understanding of CMS after reading
http://www.tikalk.com/java/garbage-collection-serial-vs-parallel-vs-concurrent-mark-sweep/ and https://plumbr.eu/handbook/garbage-collection-algorithms-implementations/concurrent-mark-and-sweep
My question is why initial mark stage is STW for Initial Mark
phase ? Can't we have just Remark phase as STW as this is the final stage for reconciliation.
Similarly why Sweeping phase
is not STW as it will require compaction which means change ofphsical location of object. So if object is referred by app and concurrent
thread changes the phsical location, won't it be issue ?
I know i a missing something here but what's that ?
Upvotes: 3
Views: 1762
Reputation: 8379
I assume you are referring Concurrent Mark Sweep implementation in Oracle's HotSpot JVM.
Initial mark phase include scanning young space (any young to old reference is root for concurrent mark). Remark phase includes very same operation.
In theory, you could omit STW for initial mark as scan it concurrent with risk of missing few root (which will be recovered during final remark any way). Though there are draw backs here
Sweeping does not require STW because it does not compact. CMS does not compact old space in concurrent cycles.
Here is my article explaining nature and asymptotics of CMS GC pauses
Upvotes: 1