Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

java - Concurrent Mark and Sweep algorithm details

I am struggling to understand and get more details on the steps involved in CMS tenured collection cycles.

  1. Initial Mark
  2. Concurrent Mark
  3. Concurrent pre-clean
  4. Re-mark
  5. Concurrent Sweep
  6. Concurrent Reset

These steps are explained in lot of places in very short. But if I have to describe them in a class with diagrams and psuedo-examples where can I get that information from?

PS - I have searched extensively on Google, it throws up with a lot of textual stuff and jargon which I understand. But I am looking for a more animated explanation so that I can teach my audience.

These are some of the links which are popular, the 3rd one was very promising but it failed to explain the CMS in particular

  1. http://www.infoq.com/articles/Java_Garbage_Collection_Distilled
  2. http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
  3. http://www.cubrid.org/blog/dev-platform/understanding-java-garbage-collection/

Dear all, thanks for commenting and pointing me to some resources. I have tried to create a visual representation of the CMS steps, can you please let me know if this matches your understanding ?

Also I seem to be missing the Compacting step, which step does it belong to ?

Answer : Ok so compacting is not handled by CMS, instead it is delegated to full GC.

Stages of CMS GC

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Starting java 1.5, there is another phase that is missed out is the "concurrent abortable preclean". It aims to delay the remark until there is a desired occupancy is achieved in the Eden space.

Other than that you are pretty much on track.

I suggest you look at this old oracle gc whitepaper and this step by step description of the CMS gc logs . It confirms the steps you have put in the images.

This blog post summarizes things well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...