I see variations on this question occasionally. “Why is my low priority thread consuming 100% CPU?” Setting a thread to low priority doesn’t mean that it won’t consume lots of CPU. It just means that it doesn’t get to run as long as there is a higher-priority thread ready to run. But if there is a CPU looking for something to do, and there is no higher-priority thread that is runnable, your low-priority thread will run, and if your low-priority thread is CPU-intensive, it will get all the CPU.
Priority merely controls which threads get first dibs on CPU time, but if you arrange so that your thread is the only one who wants to run, then it get all the CPU. The chicken at the bottom of the pecking order gets to eat all it wants if no higher-rank chickens are around. You paid for that CPU. There’s no point withholding it just out of spite.
0 comments