I have found some great articles (Maoni, Richter #1, Richter #2) giving many details as to the theory and practice of the GC, yet I cannot find anything that states how the GC’s thread priority is set.
The closest I’ve found is this one that states that the Finalizer thread “runs asynchronously to the application and at a high priority.”
I always thought that it was a “low-priority” thread, but reading more and more about it that seems to be wrong (since the GC has to block all your other threads, and you don’t want to have your app depend on a low-priority thread in order to resume in a timely fashion).
Does anybody know for sure know what the actual priority is supposed to be?
In CLR via C#, Richter explains that:
(see the “Finalization Internals” heading of chapter 20)
This is the only context in which he talks about a garbage collector thread. A little earlier in the chapter, he explains that garbage collection is started in response to one of the following events:
GC.Collect…which suggests that the only thread created by the garbage collector is this single, “high-priority” finalizer thread.
Edit: He then goes on, in “Concurrent Collection”, to explain that: