并行垃圾收集器是否在主程序旁边的单独线程上运行 [英] Does the parallel garbage collector runs on a separate thread alongside the main program

查看:39
本文介绍了并行垃圾收集器是否在主程序旁边的单独线程上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JKD8,并且正如我在默认情况下使用以下命令所看到的那样,JVM使用了并行垃圾收集器.我如何观察垃圾是否在主程序旁边的单独线程上运行?是否有像-XX:-PrintGCDetails选项一样的参数?

I am using the JKD8 and as I see with the following command by default the JVM use the parallel garbage collector. How can I observe if the garbage runs on a separate thread alongside the main program? Is there any parameter just like -XX:-PrintGCDetails option?

顺便说一句,我正在使用Visual VM,也可以从那里观察它吗?例如,在->线程"选项卡部分中,因为我找不到它.

By the way, I am using Visual VM also can I observe it from there? For example in the ->"Threads" tab section because I can't find it.

java -XX:+PrintCommandLineFlags  -XX:-PrintGCDetails -version
-XX:InitialHeapSize=535233856 -XX:MaxHeapSize=8563741696 -XX:+PrintCommandLineFlags -XX:-PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

推荐答案

垃圾收集器在单独的线程中运行.您可以在线程转储中观察到这一点:

Garbage collectors run in a separate thread. You can observe this in a thread dump:

...

"VM Thread" os_prio=0 tid=0x00007f4fec078000 nid=0x74c9 runnable 

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007f4fec01f800 nid=0x74c5 runnable 

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007f4fec021800 nid=0x74c6 runnable 

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00007f4fec023000 nid=0x74c7 runnable 

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00007f4fec025000 nid=0x74c8 runnable 

...

您可以通过向进程发送SIGQUIT(3)来生成线程转储:

You can generate a thread dump by sending SIGQUIT (3) to the process:

kill -SIGQUIT <pid>

为此,请参阅RedHat: https://access.redhat.com/solutions/18178

See RedHat for this: https://access.redhat.com/solutions/18178

这篇关于并行垃圾收集器是否在主程序旁边的单独线程上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆