JVM Core Threads

后端 未结 1 801
[愿得一人]
[愿得一人] 2020-12-30 10:39

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:<

相关标签:
1条回答
  • 2020-12-30 11:03

    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.

    0 讨论(0)
提交回复
热议问题