• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Daemon Thread

 
Salman Riaz
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is Daemon thread?
What happens when we run more then one program simultaniouly with one main JVM thread.
Can someone explain plz!!!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Threads Forum.
This forum is for management issues relating to the JavaRanch site itself.
[ August 06, 2003: Message edited by: Cindy Glass ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weird -- someone else just asked "what are daemon threads" this morning.
The definition of a daemon thread is just this: if all the threads running in a JVM are daemon threads, the JVM will exit. That's it. So if you want to create a "background" thread to do some repetitive task, but you want your program to exit as soon as main() returns, then make that background thread be a daemon thread.
As far as your second question: is it "What happens when you run multiple JVMs?" or "What happens when you run multiple threads in one JVM?" In either case, nothing remarkable; if you understand what a JVM is and what a Thread is, you should already know the answers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic