On starting a JVM instance on my machine, with a simple class running infinite sleep in main()
, I see four key threads (apart from the main thread) in the JVM:
I am curious to understand purpose of each of these core JVM threads. From a quick internet search, I found the following details on these threads:
I'd like to know further details (or correction in understanding) on these threads and reference documentation (if known).
You've pretty much got that right, the only further clarification I'd add is with the attach listener thread (which is responsible for dynamic attach.) This isn't something that's usually used, but essentially allows another process to inject a thread inside the running JVM to query certain details about how the VM is running. It's only used in practice (as far as I've seen) between two Java VM's, such as when debugging or profiling (or in the case of some IDEs that display some other information about user code as it's running.)
Note that all of these threads are heavily implementation dependent and aren't necessarily on other VM's (or even different versions of the same VM, or the same VM with different options.) The JVM may start up as many or as few core threads as it likes on launch, the number and type of those (aside from the main thread) are not under user control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With