How does nice ordering work at a scheduling level?

michaelsanford

Translator, Web Developer
How does a nice value of 1 differ from a nice value of 20.

Say, I have most of my processes running at nv0, and a few running at nv20. Would it make any differene to scheduling if I ran those nv20 processes at nv1?

Do intermediate nvs only start to make a difference when you have a range of nice values?

Thanks!
 
If all your processes are running at either 0 or 20, it makes no difference what number the ones running at 20 are at.

The nice value is basically how nice that process is to other applications, not the system. The difference is, a process will not try to use the CPU as long as processes with a lower value want access to it. If no one else is using the CPU, the process, no matter what the nice value, can take up 100% of the CPU, until ofcourse, a process with an equal or lower nice value decides it also wants access. The system itself won't have a nice value of 20 only use up a max of 50% of the CPU, while a value of 1 could use 95% of the CPU, which is what I assume you were asking.

Brian
 
If all your processes are running at either 0 or 20, it makes no difference what number the ones running at 20 are at.
Sorry I don't quite get that. If they're running at 20, what do you mean by "it doens't matter what number the oens runnign at 20 are"?

I get the second part, since I was curious how, say it would work if I had 3 applications (and no others) that are doing a task using the same amount of CPU, one at nice 0, nice 10, and niec 20; how it would partition the CPU usage between the three. But your answer explains that, if I understand correctly, the ap with nice 0 would use 100% until it was done, then the one with nice 10, then nice 20?

Thanks!
 
The first part, I probably worder badly. It's probably clearer as: If all your processes are currently running at 0 or at 20, changing the values of the processes that are running at 20 to say, 10, would not have any effect on the load or the amount of CPU used by the processes.

As to the 2nd part, you are correct (atleast for all intents and purposes). If you really want to dig down into it, the first process might not use 100%, it could be waiting for I/O or other such functons, while that process is waiting for something other then the CPU, the next process would start using the CPU cycles until the first process has finished waiting for whatever it was waiting for. But, this is I think alot more than what you're really after.

Brian
 
Back
Top