Re: [SLUG] nice and priority on top

From: Ian C. Blenke (icblenke@nks.net)
Date: Wed May 01 2002 - 10:41:16 EDT


On Wed, 2002-05-01 at 10:05, Mikes work account wrote:
>
> Can someone explain the difference between the nice value and the priority
> value on the top program. When I change the nice value to 19 to reduce the
> impace of a process on system performance then the priority goes up to 19 as
> well. Should I change the priority to a lesser value or should it do it on
> its own when I up the nice value??
>
> Michael C. Rock

This is a function of the scheduler.

The process priority is dynamic and constantly changing.
The nice value of a process is generally static, although you can
"renice" a running process as often as you wish.

The lower the priority of a process, the more likely it is to be run.

The nice value is added to the priority of a process to adjust its
importance. A positive nice value will make a process less important. A
negative nice value will make a process more important.

The nice value is just a basis for the priority. The scheduler changes
the priority of a process while it is running. If a process is resource
intensive, its priority will drop in the scheduler (the priority number
will grow as it is penalized for using resources) to allow other
processes with lower priority to run.

Think of the nice value as a "priority baseline". As a process gets more
time to run, its priority number will grow to the point where it exceeds
the priority of other jobs on the system with lower priorities. Once the
lower priority processes have had their chance.

Process priority is based on a number of factors aside from simple
aging, however. CPU use, memory use, IO wait time, and dozens of other
factors go in to recomputing the constantly changing priorities of
processes on your system. This is what the scheduler does. Changing the
behavior of the scheduler can change the entire "feel" of your computer
(making it more/less interactive, or running long-running compute jobs
more/less efficiently).

Giving a positive nice value will penalize a process so that it will
always schedule last after everything else has a chance to run.

Giving a negative nice value will give a process preference over other
running processes on the system. The more negative the nice value, the
less likely other jobs will be given a chance to run.

To answer your question though, yes the system should update the
priority to start at the niceness value you set. In fact, it should
generally never drop below the nice value - at least with the current
scheduler, AFAIK.

- Ian C. Blenke <icblenke@nks.net> <ian@blenke.com>
http://ian.blenke.com



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:28:21 EDT