Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
NICE(1)			    General Commands Manual		       NICE(1)

NAME
       nice - run a command at low priority

SYNOPSIS
       nice [ -number ]	command	[ arguments ]

DESCRIPTION
       There are two distinct versions of nice:	it is built in to the C	shell,
       and is an executable program available in /usr/bin/nice	for  use  with
       the Bourne shell.

       nice  executes command with the "nice" value number.  The nice value is
       one of the factors used by the kernel to	determine a process's schedul-
       ing  priority.	Scheduling priorities range from 0 to 127.  The	higher
       the value, the lower the	command's scheduling priority, and  the	 lower
       the  value,  the	higher the command's scheduling	priority.  In addition
       to the nice value, the kernel also recent CPU usage by the process, the
       time  the  process has been waiting to run, and other factors to	arrive
       at scheduling priority.

       If the number argument is present, the nice  value  is  incremented  or
       decremented by that amount, between the limits -20 and 19.  If there is
       no number argument, the default nice value is 10	for the	Bourne	shell,
       and 4 for the C-shell.

       The super-user may run commands with priority higher than normal	by us-
       ing negative nice values, such as -10.

EXAMPLES
       The following examples illustrate the use of nice values	for users (not
       the super-user) using /usr/bin/nice.  The examples use the -l option to
       ps(1) because it	shows both the nice value and  the  kernel  scheduling
       priority.   Notice  the	NI and PRI columns.  In	the first example, the
       user doesn't use	nice, so the niceness  is  zero,  the  default	value,
       which  is  reflected  by	0 in the NI column.  The corresponding process
       scheduling priority is shown in the PRI column as 28 (this may vary be-
       cause of	the other factors the kernel's scheduler uses).

       In the second example, the user uses a nice value of 10,	and the	corre-
       sponding	priority is 53,	a higher numerical value but a lower priority.
       Notice that this	is the same as:
	      example%	nice ps	-l
       because the default nice	value is 10.

       In  the third example, the user asks that the nice value	be incremented
       by 20, but it's shown as	19 under NI, because that's the	upper limit of
       niceness.

       A fourth	example	shows the error	message	when an	ordinary user tries to
       decrement the nice value.
       example%	 ps -l
	     F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN	   STAT	TT  TIME COMMAND
	     ...
	     19442 16623  9725 12  28  0 120  336	   R	p2  0:00 ps -l
	     ...
       example%	 nice -10 ps -l
	     F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN	   STAT	TT  TIME COMMAND
	     ...
	     19442 16608 16606 32  53 10 120  328	   R N	p2  0:00 ps -l
	     ...
       example%	 nice -20 ps -l
	     F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN	   STAT	TT  TIME COMMAND
	     ...
	     19442 16609 16606 37  72 19 120  328	   R N	p2  0:00 ps -l
	     ...
       example%	 nice --20 ps -l
       nice: setpriority: Permission denied
       example%

SEE ALSO
       csh(1), getpriority(2), nice(3V), pstat(8), renice(8)

DIAGNOSTICS
       nice returns the	exit status of the subject command.

BUGS
       The nice	command	has a different	syntax than the	/usr/bin/nice  command
       described  here.	  It  uses the plus sign, +, to	increment nice values,
       for example:

	      example%	nice +number

       increments the nice value by number.  It	uses a single a	minus sign, -,
       to decrement nice values	for super-user.

			       9 September 1987			       NICE(1)

NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | SEE ALSO | DIAGNOSTICS | BUGS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=nice&sektion=1&manpath=SunOS+4.1.3>

home | help