Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

daemon thread.

 
jaman tai
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With respect to User and Daemon threads:

a) Daemon threads can not be destroyed

b) Running User threads prevent a JVM from terminating program

c) Running Daemon threads prevent a Java VM from terminating program

d) Daemon threads can not be grouped together

e) The JVM can terminate program when only daemon threads are running

answer: b, e? why e is correct?
 
Pranav Shukla
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daemon threads exist only to serve User threads. Typically they will provide services to the User Threads and User Threads will do the real "work" in the program.

So if there doesn't exist any live User Thread, the JVM may choose to terminate the program even if there are daemon threads running.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find out why e is correct by looking up the definition of a Daemon thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic