MSDN states that:
Background threads are identical to foreground threads with one exception: a background thread does not keep the managed execution environment running
Is there any dereference in the Thread Quantum that given by OS to the thread if it were a background thread rather than the foreground threads? Check this.
When setting a background thread priority to a higher value like Highest
, will it get more quantum than a foreground one with lower priority?
Thanks in advance.
Foreground Thread Foreground threads are those threads that keep running even after the application exits or quits. It has the ability to prevent the current application from terminating. The CLR will not shut down the application until all Foreground Threads have stopped.
Communicating with the main thread We can do that by using callbacks. In this example, the callback is executed in the calling thread, which is a background thread.
The . NET Framework defines two types of threads: foreground and background. All processes have at least one thread of execution, which is usually called the main thread because it is the one that is executed when your program begins. Is this main thread is back ground or foreground thread.
Foreground threads continue to run until the last foreground thread is terminated. When all the foreground threads are stopped, the application is closed. The default threads that are created are foreground threads.
Managed foreground/background threads, the Windows thread quantum and thread priority are orthogonal concepts.
Of these three items, only foreground/background pertains to managed code.
Now to your questions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With