File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes daemon thread   and heavyweight concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "daemon thread   and heavyweight concept" Watch "daemon thread   and heavyweight concept" New topic

daemon thread and heavyweight concept

sam mitwa

Joined: Mar 27, 2005
Posts: 13
what is the difference between daemon thread and user thread
i m not able to get it
please help me

and why we say thread as heavyweight process;
and what is light weight process
i m madly confused between these concept
i just crammed not understood
can anybody help me
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
A User Thread will always run to completion, whether that completion happens normally or because of some abrupt termination (such as an unchecked/uncaught exception).

A Deamon Thread will run until it completes or until all User Threads have completed. Daemon threads make excellent "behind the scenes" processes for things that must happen in the background but can be terminated when the application ends - garbage collection is a great example of a process that could be handled with a daemon thread. Once all User Threads complete, any Deamon Threads that are still running are automatically halted and the application terminates.

SCJP Tipline, etc.
I agree. Here's the link:
subject: daemon thread and heavyweight concept
It's not a secret anymore!