Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jvm-interviewanswer.md #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jvm/jvm-interviewanswer.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ Parallel Scavenge 的关注点主要在**达到一个可控制的吞吐量上面
* 重新标记(CMS remark)
* 并发清除(CMS concurrent sweep)

对于上面这四个步骤,初始标记和并发标记都需要 *Stop The World*,初始标记只是标记一下和 GC Roots 直接关联到的对象,速度较快;并发标记阶段就是从 GC Roots 的直接关联对象开始遍历整个对象图的过程。这个过程时间比较长但是不需要停顿用户线程,也就是说与垃圾收集线程一起并发运行。并发标记的过程中,可能会有错标或者漏标的情况,此时就需要在重新标记一下,最后是并发清除阶段,清理掉标记阶段中判断已经死亡的对象。
对于上面这四个步骤,初始标记和重新标记都需要 *Stop The World*,初始标记只是标记一下和 GC Roots 直接关联到的对象,速度较快;并发标记阶段就是从 GC Roots 的直接关联对象开始遍历整个对象图的过程。这个过程时间比较长但是不需要停顿用户线程,也就是说与垃圾收集线程一起并发运行。并发标记的过程中,可能会有错标或者漏标的情况,此时就需要在重新标记一下,最后是并发清除阶段,清理掉标记阶段中判断已经死亡的对象。

CMS 的收集过程如下

Expand Down