Why can't Unix users renice downwards?

3

I know that non-root users can renice a process up, but not renice a process priority down.

$ nice yes >/dev/null & p=$!
$ renice 15 -p $p 
8414: old priority 10, new priority 15
$ renice 12 -p $p
renice: 8414: setpriority: Permission denied
$ kill $p

I understand that as a non-root user I should not have the ability to (re)nice a process into negative nice territory, or that root may have started a process on my behalf at a higher nice level.

The question is for what logical reason can a non-root user not renice their own processed downward, even if just no further down to the original priority in which it was instatiated?

Jé Queue

Posted 2009-12-28T16:07:14.773

Reputation: 540

Answers

6

If root users are able to reprioritize another user's process because it's using too much resources, a user should not be able to circumvent that and change it back.

John T

Posted 2009-12-28T16:07:14.773

Reputation: 149 037

Should we not consider nice values [-20,-1] to be system priorities vs. the user 'space' [0,19] I get what you're saying but I'm of the recent persuasion that user processes should be able to re-prioritize themselves or their children...at least from a base priority set by root? – Jé Queue – 2009-12-28T17:07:13.220

Yes but the root user may realize the base priority was too high and reprioritize all of a certain users processes ( renice -u user... ). I've seen my school's sysadmin do something similar to our processes when he was running batch jobs so it would finish faster. – John T – 2009-12-28T17:38:26.760

4

renice modifies program niceness - higher number means lower priority.

I guess the reason is that the starting niceness isn't probably not remembered - only the current niceness value. So there's no good way of determining if a user can renice a program to higher priority. (This is a guess... Maybe someone can verify it? )

Egon

Posted 2009-12-28T16:07:14.773

Reputation: 2 513

3

Because then programs would have an incentive to prioritize themselves at the expense of the entire system.

Craig Gidney

Posted 2009-12-28T16:07:14.773

Reputation: 769

...which would still give the process a higher priority than all those other processes running at 20. – njd – 2010-02-09T12:57:50.947

Not necessarily. For instance, user renice could not drop below 0. – Jé Queue – 2009-12-28T17:02:01.373