7.2.4 Threads and the Virtual Machine

All parallel actions within an application are organized with help of threads. For instance, any applet comes with an event loop, a garbage collector, a security manager and threads for image loading etc. Some of these threads on the background are only supportive, they are not essential for the flow of the program. These are called deamon threads. You can specify any thread to be a deamon thread by the message setDeamon().

Threads are essential for any program: they are the main mechanism for keeping the Virtual Machine going. An application on the Virtual Machine is started by starting a non-deamon thread, and it stops precisely at the moment that all non-deamon threads are dead.