Why the niceness is not always taken into account ?
Alexandre Laurent
alexandre.laurent at uvsq.fr
Tue Apr 16 04:35:05 EDT 2013
Hello,
I have some questions about nice and programs scheduling.
My machines have an 8 cores CPU. I am using an CPU intensive test,
using OpenMP and running on the 8 cores for the experiments.
When I am running my test it is taking around 12s. If I am starting at
the same time two instances of this test it takes 24s which is totally
fine and expected.
I wanted to prioritize one instance of the test with nice. To do this,
I am applying a niceness of -20 to privileged one, and setting a
niceness of 20 to "slow down" the second one.
This is usually working well. The privileged one with run around 12s
(so, at full speed) and the other one 24s (-> paused for 12s and
running
the 12 last seconds at full speed).
My problem is that in some cases it is not working at all. It works
fine if I am running both programs in the same instance of the
terminal,
or from a script (so, same instance of interpreter). But this is not
working if I am running the instances in separate SSH session. When I
say it is not working, both instances will take 24s to run and the CPU
usage is just shared between the tasks. More precisely :
I am running the same test, but connecting twice on the remote machine
(one connection by test instance). I am using exactly the same commands
than during the others experiments. But, by using two SSH instances,
the
niceness will not be taken into account. The CPU will be shared equally
between both instances even if htop is showing a niceness of 19 / -20
for the low priority program and the privileged program respectively.
(For information, if I am running my program throught SSH using a
script, and even by running the commands directly throught the SSH
terminal it will work as expected. So, the cause is not on SSH.)
Can you explain me, why in such case, the niceness is not taken into
account ?
Can you tell me how I can workaround this problem to effectively set
niceness and get it respected by the system ?
Best regards,
More information about the Kernelnewbies
mailing list