Rev 85981 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/tools/man/psnice.Rd% Part of the R package, https://www.R-project.org% Copyright 2011 R Core Team% Distributed under GPL 2 or later\name{psnice}\alias{psnice}\title{Get or Set the Priority (Niceness) of a Process}\description{Get or set the \sQuote{niceness} of the current process, or one ormore other processes.}\usage{psnice(pid = Sys.getpid(), value = NA_integer_)}\arguments{\item{pid}{positive integers: the process IDs of one of moreprocesses: defaults to the \R session process.}\item{value}{The niceness to be set, or \code{NA} for an enquiry.}}\details{POSIX operating systems have a concept of process priorities, usuallyfrom 0 to 39 (or 40) with 20 being a normal priority and (somewhatconfusingly) larger numeric values denoting lower priority. To add tothe confusion, there is a \sQuote{niceness} value, the amount by whichthe priority numerically exceeds 20 (which can be negative).Processes with high niceness will receive less CPU time than thosewith normal priority. On some OSes, processes with niceness\code{+19} are only run when the system would otherwise be idle.On many OSes utilities such as \command{top} report the priority andnot the niceness. Niceness is used by the utility\file{/usr/bin/renice}: \file{/usr/bin/nice} (and\command{/usr/bin/renice -n}) specifies an \emph{increment} in niceness.Only privileged users (usually super-users) can lower the niceness.Windows has a slightly different concept of \sQuote{priorityclasses}. We have mapped the idle priority to niceness \code{19},\sQuote{below normal} to \code{15}, normal to \code{0}, \sQuote{abovenormal} to \code{-5} and \sQuote{\I{realtime}} to \code{-10}. UnlikeUnix-alikes, a non-privileged user can increase the priority class onWindows (but using \sQuote{\I{realtime}} is inadvisable).}\value{An integer vector of \emph{previous} niceness values,\code{NA} if unknown for any reason.}\seealso{Various functions in package \pkg{parallel} create child processeswhose priority may need to be changed.\code{\link{pskill}}.}\keyword{ utilities }