• 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

what are daemon threads?

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi frnds ,

what are daemon threads??
can anyone give some properties of daemon threads so that i can answer this question?

 
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If main thread ends if there are still non daemon thread present than program will keep running.

If there are only daemon thread present than as soon as main thread completes program ends.

What is daemon thread?
before you start a thread you can set it as daemon thread by

setDaemon(boolean value)

if thread is daemon it only runs as long as other user threads have not completed.


b. A program will terminate only when all user threads stop running

is true statement.

daemon thread are generally present to support other thread they run in background for e.g. say garbage collector thread if program stops executing main ends now there is no point in running gc thread as program stops and OS will reclaim memmory. however program does not finish executing as long as there is non daemon thread present.
[ September 09, 2005: Message edited by: Santana Iyer ]
 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot ....Santana Iyer ..

answer also given was d...
 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot ....Santana Iyer ..

answer also given was d...
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic