Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default threads like, DestroyJavaVM, Reference Handler, Signal Dispatcher

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

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?

like image 829
Konrad Reiche Avatar asked Apr 23 '11 18:04

Konrad Reiche


People also ask

What is DestroyJavaVM?

Once main completes, the JVM is told to shut down using a DestroyJavaVM thread which waits for all non-daemon threads to complete before doing its work. This is to ensure that any non-daemon threads you create run to completion before the JVM is torn down.

What is reference handler in Java?

“Reference Handler” is the Human-readable name of the thread. #2 is the unique ID associated with each Thread object. “daemon” is a tag denoting if the thread is a daemon thread. “prio=10” is the numeric priority of the Java thread.


1 Answers

  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
like image 55
Suraj Chandran Avatar answered Oct 05 '22 00:10

Suraj Chandran