From man renice
:
Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ``nice value'' (for security reasons) within the range 0 to PRIO_MAX (20) [...]
So, I can renice
my own processes upwards (give them lower priority) but never downwards:
$ renice 10 22316
22316 (process ID) old priority 0, new priority 10
$ renice 9 22316
renice: failed to set priority for 22316 (process ID): Permission denied
Why is this? I can understand why normal users cannot set nice values lower than 0, but why since I can decrease the priority to 10 can't I increase it again to 9? What "security reason" is there for this? I have the right to launch a process with a nice value of 9, so why can't I renice it to 9?
EDIT: I should learn to scroll down. Turns out this is listed as a bug in man renice
:
BUGS
Non super-users can not increase scheduling priorities of their own
processes, even if they were the ones that decreased the priorities
in the first place.
That's even more confusing. If they consider this behavior to be a bug, why not change it? The renice
command appeared in 4.0BSD which I think is from 1980. This should be very easy to fix so on the one hand they seem to have chosen to leave it and on the other they list it as a bug.