daemon threads remain or keep executing even after the JVM exits ? would that be correct to say. NO!
Daemon threads keep executing until the JVM exits. These threads are managed by the JVM and hence once the JVM exits they too are gone. Remember that JVM exits when the last user thread completes execution. This only makes sense since daemon threads are typically service threads that some long-haul background processing and their existence has no relevance when there is nobody to request ther services!
If yes, then they would be like the various services running or the processes running on a NT or unix box ? would that be ok to say. Daemon threads are like background processes. The only difference here is that they are managed by the JVM( actually by JVM's thread scheduler ). This means the thread process(es) are owned by the JVM instance and not by the operating system. That's why they all get terminated when JVM exits.
And why would one define or set a thread to be daemon ? so threads can be daemom or a user thread (ie not a daemon). would that be ok to say Yes, your terminology is correct. Threads can be of either
user type or
daemon type Daemon threads are used ( and to be used! ) for background processing. A good example would be a spell check algorithm for a
word processing software. The user interface components will be owned by the user thread however the actual spell check may be done by a daemon. As another example, you can have a daemon monitoring database connections and re-establishing them incase of a failure. As the amount of work, time and complexity increases, such processes qualify for good candidates for daemon threads. It is not unusual to see shared processes being run as daemons and accessed by many user threads.
Hope this explanation helps.