This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Garbage Collector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Garbage Collector" Watch "Garbage Collector" New topic
Author

Garbage Collector

chintan shah
Greenhorn

Joined: Oct 05, 2008
Posts: 7
can a daemon thread outlive the main thread that created and turned it to daemon?
Also,
It is said that garbage collector is a daemon thread used by JVM.
can anyone tell where and when it is spawned?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Yes, daemon threads can live longer than the thread that created them, as long as there is at least one other non-daemon thread in the JVM. There's no special link between the daemon thread and its creator.

The garbage collector thread, along with several other special-purpose threads, are all created when the JVM starts up, before any of your code is invoked.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage Collector
 
Similar Threads
Confusion
Query about Daemon thread.
Garbage Collector
Daemon Threads
Daemon Thread