GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Daemon threads 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 threads " Watch "Daemon threads " New topic
Author

Daemon threads

natarajan meghanathan
Ranch Hand

Joined: Feb 01, 2001
Posts: 130
Hi,
I have a doubt. Does all threads created by the JVM are daemon threads?. I think it is true. Can anybody help me to resolve this!
TIA

Sun Certified Programmer for Java 2 Platform
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
No unless you issue a method setDeamon(true) then the thread becomes deamon(user Threads)


Val SCJP <BR>going for SCJD
natarajan meghanathan
Ranch Hand

Joined: Feb 01, 2001
Posts: 130
user threads are non-daemon threads. What i wanted to know is that whether all the threads run by the JVM on the background (eg. we know gc is a daemon thread) are daemon threads.
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Ok i dind' tget your question , and i am not doing well with threads yet. But is this a user Thread if i create my own ?
Thread d = new Thread(this);
d.setDeamon(true);
d.start();
Now is this a deamon thread ? I believe it comes a deamon and isn't it a user thread ?
Priya Kannan
Ranch Hand

Joined: Jan 19, 2001
Posts: 72
Hi,
All the threads spanned by JVM are not Daemon threads.
Eg: main()
Priya Kannan
Ranch Hand

Joined: Jan 19, 2001
Posts: 72
Hey Val,
Yep.It's a 'user' turned 'Daemon'!!!
Vijay pillai
Ranch Hand

Joined: Jan 10, 2001
Posts: 45
hi priya,
main thread is not a demon thread,but what about other threads that run in the background.
eg the ReferenceHandler thread,the Signal dispatcher thread etc.... as the JVM is said to start four threads for an application in the absence of a GUI.
could u please throw some light on this.
Vijay Pillai
 
jQuery in Action, 2nd edition
 
subject: Daemon threads