A managed thread is either a background thread or a foreground thread. Background threads are identical to foreground threads with one exception: a background thread does not keep the managed execution environment running. Once all foreground threads have been stopped in a managed process (where the .exe file is a managed assembly), the system stops all background threads and shuts down.
Use the System.Threading.Thread.IsBackground property to determine whether a thread is a background or a foreground thread, or to change its status. A thread can be changed to a background thread at any time by setting its System.Threading.Thread.IsBackground property to true.
Threads that belong to the managed thread pool (that is, threads whose System.Threading.Thread.IsThreadPoolThread property is true) are background threads. All threads that enter the managed execution environment from unmanaged code are marked as background threads. All threads generated by creating and starting a new System.Threading.Thread object are by default foreground threads.
If you use a thread to monitor an activity, such as a socket connection, set its System.Threading.Thread.IsBackground property to true so that the thread does not prevent your process from terminating.