There are 4 high level phases CMS works for full GC
- Initial mark :- Stop the world(STW)
- Concurrent marking :- Run concurrently
- Remark :- STW
- Concurrent sweeping:- Run concurrently
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 ?