java 默认线程,如 DestroyJavaVM、Reference Handler、Signal Dispatcher

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5766026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 12:39:44  来源:igfitidea点击:

Default threads like, DestroyJavaVM, Reference Handler, Signal Dispatcher

javamultithreadingjvm

提问by Konrad Reiche

Working on a profiler of my own, I would like to explain what I see. There are some default threads which always appear, even in the simplest program:

在我自己的分析器上工作,我想解释我所看到的。有一些默认线程总是出现,即使在最简单的程序中:

  • DestroyJavaVM
  • Signal Dispatcher
  • Finalizer
  • Reference Handler
  • 销毁JavaVM
  • 信号调度员
  • 终结器
  • 引用处理程序

Although their names are quite self-documenting, I would like to get a little bit more information. It seems these threads are not documented, does someone know a source to dig for these information or even knows exactly what these threads do?

虽然他们的名字很自我记录,但我想获得更多信息。似乎这些线程没有记录,是否有人知道挖掘这些信息的来源,甚至确切地知道这些线程的作用?

回答by Suraj Chandran

  1. DestroyJavaVM is a thread that unloads the Java VM on program exit. Most of the time it should be waiting, until apocalypse of your VM.
  2. Signal Dispatcher is a thread that handles the native signals sent by the OS to your jvm.
  3. Finalizer threads pull objects from the finalization queue and calls it finalize method.
  4. Reference Handler is a high-priority thread to enqueue pending References. Its defined in java.lang.ref.References.java
  1. DestroyJavaVM 是在程序退出时卸载 Java VM 的线程。大多数时候它应该等待,直到你的虚拟机的启示。
  2. Signal Dispatcher 是一个线程,用于处理操作系统发送到 jvm 的本地信号。
  3. 终结器线程从终结队列中拉取对象并调用它的终结方法。
  4. Reference Handler 是一个高优先级线程,用于将待处理的References排入队列。它在 java.lang.ref.References.java 中定义