Daemon Threads

 

 

 

Foreword

Resources

Code Listings

Foil Sets

Assignments

Solutions

External Resources

SiteMap

Search

Home

 

 

Up ] Introductory Examples ] Object Cloning ] Static Method's ] Sleep and Locks ] Thread Primer ] [ Daemon Threads ] Thread Synchronization ] Gaurded Suspension ] Deadlock ] Virtual Machine Threads ] Volitility ] Wait-Notify ]

 

A daemon thread is a thread that runs for the benefit of other threads. Daemon threads run in the background and unlike conventional user threads, do not prevent a program from termination. A prime example of a daemon thread is the garbage collector, which is responsible for reclaiming memory from unused object references. Conventional user threads are non-daemon threads. The following example demonstrates the use of deamon threads. Please refer to section 2.3.2 in the Java chapter for more information on threads.

Source

daemon.java

JAR Files: Please refer to the Java-Basics section for more information on using JAR files.

daemon.jar