Question about nice

Svein Halvor Halvorsen svein-freebsd-questions at theloosingend.net
Tue Nov 16 16:46:54 PST 2004


[David J. Weller-Fahy, 2004-11-16]
>  1. I understand nice is useful if you need to run a program at a certain
>  priority.  Is nice useful when not passing a priority?  If so, what is
>  the difference between the following two commands (in terms of priority
>  level)?
>  
>  nice isoqlog
>  isoqlog

According to the man page nice(1)

     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.  The lower the nice value of a process, the higher its
     scheduling priority.

If you don't specify tge priority level, then mice adds 10.


>  2. If it is useful to run nice without passing a priority, then are the
>  following two commands equivalent?  If not, which one would be preferred
>  and why?
>  
>  nice sudo isoqlog
>  sudo nice isoqlog

The former will run sudo nice, which in turn will make isoqlog run as 
root, with the priority level inherited. The latter will make sudo run 
nice as root, and in turn run isoqlog with priority 10, with the effective 
user inherited.

The obvoius difference, is that you let sudo run nice without a password, 
you could do "sudo nice <anyprogram>" without a password.



   Cheers, 
   Svein Halvor


More information about the freebsd-questions mailing list