Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2001 23:07:13 -0500
From:      Mike Meyer <mwm@mired.org>
To:        Michael Lucas <mwlucas@blackhelicopters.org>
Cc:        questions@freebsd.org
Subject:   Re: top "nice" CPU usage %
Message-ID:  <15231.15217.55553.675980@guru.mired.org>
In-Reply-To: <20010818180719.A62086@blackhelicopters.org>
References:  <106465644@toto.iv> <15230.58619.22982.65728@guru.mired.org> <20010818180719.A62086@blackhelicopters.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Michael Lucas <mwlucas@blackhelicopters.org> types:
> On Sat, Aug 18, 2001 at 04:58:19PM -0500, Mike Meyer wrote:
> > I don't know of a description, but you've nailed it. This reports the
> > cumulative cpu time of processes running with a nice > 0. For the
> > user, nice > 0 gets less CPU time than processes with nice of 0. Nice
> > < 0 can only be set by root.
> So, it only reports processes where nice is less than zero, or
> processes where the user has decided to be nice?  Hmmm... seems it
> would be more useful to report processes set to be more "hungry".  Ah,
> well, I'm sure patches would be welcome.  :)

It reports processes where the user has decided to be nice - so that
nice > 0. It used to be the case - and may still be - that processes
that have accumulated a lot of CPU time are niced by the system.

Processes running at negative nice tend to be things that don't need a
lot of CPU, but when they do, they need it *right now*. There aren't a
lot of them. On my system right now, with 79 processes, exactly one
has a negative nice - ntpd. If one of them starts chewing up CPU, you
tend to notice right away - because everything else grinds to a halt.

Having CPU running things at positive nice means one of two
things. Either you've got something designed to soak up cpu nicely -
setiathome on my system - so you should have 0% idle, and what is
normally idle listd as nice. If they were combined, I'd see a system
that's I'm not doing anything on - just this email - running at ~97%
cpu usage. That would worry me. 

The second possibility is that you've got things that have chewed up a
lot of cpu because you've been up for a while. In the latter case, you
might want to nice them back up a bit. On the other hand, if that's
the bulk of your CPU usage, it won't matter much. Short interactive
commands running at zero will get better response than the background
tasks that have risen to a positive value, which is well and good.

If you want to patch things, you'll have to start with the kernel. It
doesn't record values for nice < 0. Patching it to alter the meaning
of nice should be trivial - a one-character change in
kern/kern_clock.c. Patching it to collect both flavors of nice is a
bit harder.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15231.15217.55553.675980>