0

From plumbr's cookbook, I have seen that what init mark, concurrent mark, concurrent preclean and concurrent abortable preclean do.

init mark

enter image description here

concurrent mark enter image description here

concurrent preclean enter image description here

But I can't get the real job about the "final remark". Only traverse the old generation again? If it does this, I think the previous steps are unnecessary。

lxyscls
  • 243
  • 2
  • 15

1 Answers1

1

Concurrent Mark Sweep has 4 main phases.

  • Initial mark
  • Concurrent mark / Concurrent preclean
  • Final remark
  • Sweep

Additional specific of Concurrent Mark Sweep - all object in young space are treated as GC roots.

Main reason concurrent mark is concurrent is because it take significant time to traverse object graph in old space. Though on subsequent marks are much faster because most object are already marked and do not need to be revisited.

Still concurrent operation cannot guaranty consistent marking, because thread continue to change object graph. Stop the World is required to catch up.

"Final remark" is a stop the world phase involving full marking (root scanning + recursive traversal), but due to most object are already marked by concurrent mark/preclean recursive traversal phase is typically quick.

You find more details in my Understanding GC pauses in JVM, HotSpot's CMS collector article.

Alexey Ragozin
  • 7,288
  • 1
  • 20
  • 19
  • Does it mean that remark only rescan young gen and thread stack(GC Root), and use "card marking" to scan old gen again after the preclean? – lxyscls Aug 02 '19 at 01:21