I would say that the correct answer to this question is "if you think that you need to worry about the priority of the garbage collector stream, you probably have something wrong."
Remember that thread priority is not necessarily directly related to how much processor time a process receives. It varies from system to system, but on Windows, the priority of a thread is essentially used to determine the ORDER, in which threads waiting to start are scheduled for available processors, so high priority threads can prevent low priority threads, assuming that both threads are actually compete for the processor. There is no real rule to give processors with lower priority less processor time. (For what, on Linux, there is a slightly more direct relationship between thread priorities (good values) and CPU time allocated.)
When using thread priorities used by Windows for a background thread such as a garbage collector, a more appropriate solution might, perhaps paradoxically, be to give it a high priority and then control the percentage of CPU usage by others means (essentially intentionally sleep for the appropriate proportions time or wait for the corresponding signals). In particular, a high priority is suitable for a background thread that should not do anything most of the time, but when it needs to do something, it should do it as soon as possible.
I really did not look at what thread priorities are used, if any, by specific garbage collection algorithms. But I think the situation is somewhat complicated, and it seems strange to base any assumptions about the behavior of the garbage collector in thread priorities.
Those who are more interested in thread priorities can look at some dimensions of the impact of thread priorities that I took - admittedly, a couple of years ago, and this stuff can do with the update.
Update: Coincidentally, talk by Cliff Click was published yesterday on YouTube. After about 35 minutes, he mentions this very moment that certain JIT and GC threads must have high priority so that they are not depleted.
Neil coffey
source share