[concurrency-interest] Termination of daemon threads

Peter Kovacs peter.kovacs.1.0rc at gmail.com
Tue Apr 1 05:43:07 EDT 2008


David,

I wonder what "critical" may mean here. The process is going to be
terminated: resources are freed, memory recovered, locks released...
Nature is at work here making room for a new life... What is critical
for me (e.g. a big salary raise, dating with the handsome assistant
from the 99th floor) will not be critical after my death. In other
words: what can be critical as I am just dying.

OK, I try to put my egotism aside: may "critical" mean "something"
which other processes rely on? Should the answer then not be: a daemon
thread can do anything, just be prepared for it being abruptly
terminated? Just as if the process itself would be killed -- I assume.
So the advice goes: don't do anything critical in non-daemon threads
either, because your process may get killed. :-)

Peter

On Tue, Apr 1, 2008 at 6:41 AM, David Holmes <dcholmes at optusnet.com.au> wrote:
> A daemon thread should never do anything critical. Daemon threads just
>  "vanish" when the process is terminated. Though for Sun's VM they are at
>  least brought to a system "safe-point" first - though executing native code
>  is considered being at a "safe-point" ie outside of the VM.
>
>  It probably could be documented better.
>
>  David Holmes
>
>
>
>  > -----Original Message-----
>  > From: concurrency-interest-bounces at cs.oswego.edu
>  > [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Dimitris
>  > Andreou
>  > Sent: Tuesday, 1 April 2008 2:02 PM
>  > To: concurrency-interest at cs.oswego.edu
>  > Subject: [concurrency-interest] Termination of daemon threads
>  >
>  >
>  > Hi all,
>  >
>  > Here is my question: How are daemon threads terminated? What if they are
>  > in the middle of a critical operation, like writing to a file? They seem
>  > to exit immediately. How could that be safe? Or a daemon thread should
>  > never do anything critical, but always delegate such work to a
>  > non-daemon thread? If any case, shouldn't it be documented in
>  > java.lang.Thread?
>  >
>  > Thanks
>  > Dimitris Andreou
>  >
>  > _______________________________________________
>  > Concurrency-interest mailing list
>  > Concurrency-interest at altair.cs.oswego.edu
>  > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>  >
>
>  _______________________________________________
>  Concurrency-interest mailing list
>  Concurrency-interest at altair.cs.oswego.edu
>  http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>


More information about the Concurrency-interest mailing list