my dog learned polymorphism*
The moose likes Threads and Synchronization and the fly likes Daemon threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Daemon threads" Watch "Daemon threads" New topic
Author

Daemon threads

Smitha Prasad
Ranch Hand

Joined: Apr 02, 2002
Posts: 41
What is a daemon thread, what is the difference between a normal thread and a daemon thread?
Robert Ziel
Greenhorn

Joined: Apr 22, 2002
Posts: 28
hi,
a deamon thread is a thread what wil not outlive the main thread.
when the mainthread stops the deamon threads wil also stop..
Robert
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

By default when a thread is created in java it is a user thread. A thread can be made daemon by using setDaemon().Daemon threads work in background. JVM diffrentiates b/w these threads as follows : When user thread exits JVM checks whether there are more user threads to execute. If none present then JVM exits. It means that when only daemon threads are running JVM shuts down. An example of daemon thread is garbage collection. Daemon threads should be used for background processes..


Groovy
abhi zulu
Greenhorn

Joined: May 18, 2002
Posts: 14
Deamon thread is used to give service to other thread's ,if in my application all the threads finish there operation, then the Demon thread also exits even if it has not finished its operation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Daemon threads
 
Similar Threads
A few questions ...
Daemon Thread
what is daemon thread
Daemon Thread
Daemon threads & non daemon Threads