java“虚拟机线程"是什么意思?做?

2022-01-16 00:00:00 multithreading jvm java

我使用 jstack 来输出线程信息.还有一个线程:VM 线程"prio=10 tid=0x0878b400 nid=0x760a 可运行

I use jstack to output the thread info. And there is a thread: "VM Thread" prio=10 tid=0x0878b400 nid=0x760a runnable

这个线程是用来做什么的?它占用 50% 的 CPU 使用率和大部分 CPU 时间

What is this thread used to do? It takes 50% CPU usage and most of CPU time

推荐答案

VM线程定义这里 作为:

该线程等待需要 JVM 到达安全点的操作出现.这些操作必须在单独的线程上发生的原因是因为它们都要求 JVM 处于不能对堆进行修改的安全点.该线程执行的操作类型是stop-the-world"垃圾收集、线程堆栈转储、线程挂起和偏向锁定撤销.

This thread waits for operations to appear that require the JVM to reach a safe-point. The reason these operations have to happen on a separate thread is because they all require the JVM to be at a safe point where modifications to the heap can not occur. The type of operations performed by this thread are "stop-the-world" garbage collections, thread stack dumps, thread suspension and biased locking revocation.

在去重的 SO 答案中还提供了一些信息 这里.

There's also some information provided in a de-duplicated SO answer here.

相关文章