Get or Set the Priority (Niceness) of a Process
Get or set the ‘niceness’ of the current process, or one or more other processes.
positive integers: the process IDs of one of more processes: defaults to the R session process.
The niceness to be set, or
POSIX operating systems have a concept of process priorities, usually
from 0 to 39 (or 40) with 20 being a normal priority and (somewhat
confusingly) larger numeric values denoting lower priority. To add to
the confusion, there is a ‘niceness’ value, the amount by which
the priority numerically exceeds 20 (which can be negative).
Processes with high niceness will receive less CPU time than those
with normal priority. On some OSes, processes with niceness
+19 are only run when the system would otherwise be idle.
On many OSes utilities such as
top report the priority and
not the niceness. Niceness is used by the utility
‘/usr/bin/renice’: ‘/usr/bin/nice’ (and
/usr/bin/renice -n) specifies an increment in niceness.
Only privileged users (usually super-users) can lower the niceness.
Windows has a slightly different concept of ‘priority
classes’. We have mapped the idle priority to niceness
‘below normal’ to
15, normal to
-5 and ‘realtime’ to
Unix-alikes, a non-privileged user can increase the priority class on
Windows (but using ‘realtime’ is inadvisable).
An integer vector of previous niceness values,
NA if unknown for any reason.
Various functions in package parallel create child processes whose priority may need to be changed.