• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Is "Daemon" thread required in the Test?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone have taken the test, could you tell me whether the Daemon thread
appeared in the test? I am not familar with it and I will take the test
tomorrow, so .....?
Or somebody can give me a hand about this?
Thank you very much!
Shirley!
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is simple. When a thread t1 create another thread t2, and it designates that t2 is daemon thread, as soon as t1 dies, t2 also dies. If it is not designated as daemon thread, t2 continue live as long as it needs to beyond the life of t1. That is my recollection. I could not find it the books I have in front of me now. I do not if this is in the scope of exam or not.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daemon threads are no different from any other thread, except that they have a flag set which says "I am a daemon". This only matters to the VM for deciding when it's time to shutdown. Whenever a thread dies, the VM looks to see if there are any non-daemon threads still alive. If so, it stays up, otherwise it shuts down. The classic daemon thread is the garbage collector. It's always alive, but when all "user" (non-daemon) threads have died, it doesn't prevent the VM from shutting down.
 
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shirley
A thread can only be set daemon before the thread is started. You can know more about daemon threads here.
[ September 18, 2003: Message edited by: Anupam Sinha ]
reply
    Bookmark Topic Watch Topic
  • New Topic