Question about nice

David J. Weller-Fahy dave-lists-freebsd-questions at weller-fahy.com
Tue Nov 16 10:59:15 PST 2004


* Dan Nelson <dnelson at allantgroup.com> [2004-11-16 16:56 +0100]:
> In the last episode (Nov 16), David J. Weller-Fahy said:
> > If so, what is the difference between the following two commands (in
> > terms of priority level)?
> > nice isoqlog
> > isoqlog
>
> man nice:
>     The nice utility runs utility at an altered scheduling priority,
>     by incrementing its `nice'' value by the specified increment, or a
>     default value of 10.

Doh!  I missed that in the man page.  Ok, I dug a little deeper and
found that the default priority is 0 (man setpriority, who would've
figured? :).  So, to answer my own question (with your prompting):
Prepending 'nice' to any command runs it at priority 10, without 'nice'
it would run at 0 (or 'normal').

Idle priorities range from 0 to 31, realtime from 0 to 31, and normal
priority is in between (and, according to setpriority, is also 0...
lots of zeros).

So it will make a difference.

> > nice sudo isoqlog
> > sudo nice isoqlog
> The first may take longer to execute on a busy machine, since sudo
> itself is running at a lower priority.  The 2nd may be a security
> hazard, depending on whether you allowed "nice isoqlog" or just "nice"
> (with any command) in your sudo config file.

I had decided not to allow 'nice' with any command, it's pleasant to see
that I was correct.  So using the first syntax for non-time-sensitive
programs would keep those from hogging the machines resources, correct?

Well, I think I've got it, now.  Thanks again for a pointer to the
obvious. ;]

Regards,
-- 
dave [ please don't CC me ]


More information about the freebsd-questions mailing list