4

I pulled up top and a program was using ~80-90% CPU. I increased the niceness, to see if I could reduce the load. Then I tried to reduce the nice of the same process back to it's initial level and was told I didn't have proper privileges. Is there a good reason for the disparity in privileges required here?

4

Yes. When every user in the system has the possibility to decreace the niceness of his process, then every user can cause other processes to starve.

Process priorities in the linux kernel do mean something. If you give a process the nice value of -20 it gets huge chunks of cpu time. That's why only root can decrease those values.

Addition suggested by Eliah Kagan:

Why users cannot get their own processes back to the niceness level they themselves started them with?

The point is, the system doesn't note who did the increase of the niceness. So, there is no mechanism to find out whether you or root did the incease.

Another approach is to say: a normal user shouldn't be able to overwrite the actions of a priviledged user. If root is logged in and he wants to change the niceness of your processes to 20: he can, and you should be prohibited to undo that changes. Untill the kernel doesn't remember who did the niceness changes, you will be prohibited.

Maybe some day the linux kernel developers include that functionality to the kernel code. You can do a feature request. But, be warned, kernel developers don't like new stuff just because it's cool.

  • "If root is logged in and he wants to change the niceness of your processes to 20: he can, and you should be prohibited to undo that changes." That makes perfect sense. I guess I just use Ubuntu as my personal platform, and just take for granted that it's a multi-user system. – blanket_cat Aug 13 '14 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.