• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic