When I "flood" my CPU with 8 high priority (nice=-20) OS threads (the number of cores I have), operation becomes "halty" for obvious reasons, but is still usable.
Note that when I say "high-priority thread" I mean a thread that was spawned by the same high-priority process.
However doing something like 64 threads will completely make my PC unusable. What is the relationship between max priority threads and their distribution between cores? Can we figure out roughly how many threads I need to spawn to completely flood the CPU for a given nice value?
-
2Short answer : no ! It would highly depend on what these threads are doing (cpu / io) bound, of other tasks scheduled on some real time policy, dedicated pinnings etc... etc...MC68020– MC6802001/20/2024 17:30:23Commented Jan 20, 2024 at 17:30
1 Answer 1
no such relationship exists, at least directly.
Remember that a nice
value is a priority. The scheduling ends up the same whether you have N threads of niceness 0, or N threads of niceness 10, or N threads of niceness -10.
Whether or not a system remains responsive depends on how much time it has to care about slow things, like user inputs. If you have 1000 processes, just each waiting for a network packet or data to be delivered from storage, that will make little difference to your system behaving snazzy for you as human user. They exist, but they are not taking scheduling time away from what needs to happen for that snazziness. No matter whether they are the same, lower or higher niceness than the processes you interact with – what matters is whether they are contending for the same resources.
So, niceness really only plays a minor role in this; it's a tool to define who gets to run next, when there's more tasks ready to do work than there's CPU cores. How many tasks are ready to work, and whether they collide with tasks that might be having (PRIO_RR
) guarantees on how many times a second they're activated when ready is simply a different question.
You must log in to answer this question.
Explore related questions
See similar questions with these tags.