aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Query about Daemon thread. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Query about Daemon thread." Watch "Query about Daemon thread." New topic
Author

Query about Daemon thread.

Ganesh Prakhya
Ranch Hand

Joined: May 05, 2004
Posts: 76
Hi,

Can anybody explain me the difference between User Thread and Daemon Thread in terms of execution?

Thanks in advance,
Ganesh
patrick J. d'cousta
Greenhorn

Joined: Oct 25, 2005
Posts: 24
The only diffrence between daemon thread and user thread is daemon threads are for serving user threads.That is if all the user threads get over then all the daemon thread are terminated and application exits.

Example garbage collector thread
Ganesh Prakhya
Ranch Hand

Joined: May 05, 2004
Posts: 76
Hi patrick J. d'cousta,

But, if I create an user thread and a daemon thread, what advantages I have with daemon thread over user thread? In otherwords, when we need to create/use daemon threads?

Thanks in advance,
Ganesh..
patrick J. d'cousta
Greenhorn

Joined: Oct 25, 2005
Posts: 24
Ganesh
Imagine u are writing a application where there are two tasks

1.Number of thread do some work and dump the output in a directory
2.One thread is supposed to run once a while and purge this output

1 are all user threads
2 is a daemon thread.
Ganesh Prakhya
Ranch Hand

Joined: May 05, 2004
Posts: 76
Now its clear to me. Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query about Daemon thread.
 
Similar Threads
Daemon Thread
Daemon threads
how to generate a deamon thread in java
"Top Ten Topics that Everyone Thinks are on the SCJP Exam, but Aren't "- Bert Bates
Daemon Thread