bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: man nice, info nice


From: Jim Meyering
Subject: Re: man nice, info nice
Date: Mon, 02 Feb 2004 14:21:23 +0100

Dan Jacobson <address@hidden> wrote:
> $ info nice does not get one info about nice(1), instead it is some C thing.

Thanks for mentioning that.
The same thing happens for a few others, like rename and stat.
FWIW, as of coreutils-5.1.2, the automatically-generated man pages
refer people to

  info coreutils nice

which does do what we want.

> $ man nice
>        Run COMMAND with an adjusted scheduling priority.  With no COMMAND, 
> print the current
>        scheduling priority.  ADJUST is 10 by default.  Range goes from -20  
> (highest  prior-
>        ity) to 19 (lowest).
>
>        -n, --adjustment=ADJUST
>               increment priority by ADJUST first
>
> Well, maybe I know what you are trying to say, but maybe add examples:
> A practical one, and these:
> $ nice
> 0
> $ nice nice
> 10
> $ nice -n 10 nice #default
> 10
> $ nice -n 30 nice #hits max
> 19
> $ nice -n -22 nice #only root can
> nice: cannot set priority: Permission denied

Thanks.
I've made this change:

Index: coreutils.texi
===================================================================
RCS file: /fetish/cu/doc/coreutils.texi,v
retrieving revision 1.152
diff -u -p -u -p -r1.152 coreutils.texi
--- coreutils.texi      27 Jan 2004 12:53:24 -0000      1.152
+++ coreutils.texi      2 Feb 2004 13:18:31 -0000
@@ -11669,6 +11669,53 @@ Exit status:
 the exit status of @var{command} otherwise
 @end display
 
+It is sometimes useful to run non-interactive programs with reduced priority.
+
address@hidden
+$ nice factor `echo '2^997 - 1'|bc`
address@hidden example
+
+Since @command{nice} prints the current priority,
+we can invoke it through itself to demonstrate how it works:
+
+The default behavior is to reduce priority by @samp{10}.
+
address@hidden
+$ nice nice
+10
address@hidden example
+
address@hidden
+$ nice -n 10 nice
+10
address@hidden example
+
+The @var{adjustment} is relative to the current priority.
+Here, the first @command{nice} invocation runs the second one at priority
address@hidden, and it in turn runs the final one at a priority lowered by
address@hidden more.
+
address@hidden
+$ nice nice -n 3 nice
+13
address@hidden example
+
+Specifying a priority larger than @samp{19} is the same as specifying 
@samp{19}.
+
address@hidden
+$ nice -n 30 nice
+19
address@hidden example
+
+Only a privileged user may run a process with higher priority.
+
address@hidden
+$ nice -n -1 nice
+nice: cannot set priority: Permission denied
+$ sudo nice -n -1 nice
+-1
address@hidden example
+
 
 @node nohup invocation
 @section @command{nohup}: Run a command immune to hangups




reply via email to

[Prev in Thread] Current Thread [Next in Thread]