aspose file tools*
The moose likes Threads and Synchronization and the fly likes Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread" Watch "Thread" New topic
Author

Thread

Lalit G
Greenhorn

Joined: Jul 02, 2001
Posts: 6
hello,
Can anybody pls tell me the difference between daemon and user threads?
How daemon thread is useful during execution of prog.
What's the priority of daemon thread?
Does it belongs to ThreadGroup?
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
a daemon thread is generally a thread running in the background. The threads you create in a program are user threads unless you specify otherwise. I'm not sure the priority of a daemon thread. If there is one, I'd imagine it's pretty low.
sharad goswami
Ranch Hand

Joined: Jan 18, 2001
Posts: 51
hi!
THE DAEMON THREAD IS THREAD RUNNING IN THE BACKGROUNG BY JAVA VITUAL MACHINE.FOR EXAMPLE GARBAGE COLLECTION IS RUN BY LOW PRIORITY DAEMON THREAD OF JVM.


Stop The World I Want To Get Off.
Yuri Gadow
Greenhorn

Joined: May 08, 2001
Posts: 28
Daemon threads will not prevent the VM from exiting. Once all work in non-daemon threads is complete (the runs have returned), the VM will exit - so a daemon thread is most suitable for continuous tasks that support primary functions (like GC, lock sweeping, connection time-outs, etc.)
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
The daemon thread, except that it is managed by JVM and will get killed if no user threads are running, is also just another thread. Therefore, just like normal threads, they will have the priority of the creating thread and the value Thread.NORM_PRIORITY by default. They will belong to the same ThreadGroup as their parent thread, unless explicitly created as belonging to another ThreadGroup using the overloaded Thread constructor. Infact you can set the entire ThreadGroup as daemon. Any threads that belong to that ThreadGroup will be marked as daemon too.

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread