How does the java daemon thread run after the Java: virtual machine process exits?

with regard to daemon threads, it is stipulated that "if only daemon threads are left in the virtual machine, the virtual machine will exit."

then I think class information is always used in the daemon thread, constant pools are used, objects are allocated on the heap, etc., and the virtual machine exits. How does the java daemon thread run?

Mar.21,2021

if only the daemon thread is left in the virtual machine, the virtual machine will exit , which means that as long as one non-daemon thread does not exit, the virtual machine will not end. Only when the last non-daemon thread ends, the daemon thread ends work with the JVM.

the daemon thread ends with the end of JVM


the virtual machine exits and the daemon thread is naturally recycled.


the Java daemon thread is different from the operating system daemon (service). By definition, Java's deamon is a thread that exits and does not prevent the virtual machine from ending running.


the daemon thread ends with the end of jvm

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e507b6-450bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e507b6-450bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?