Subject: Re: Nice processes on Unix
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 11 Jun 2008 02:45:39 -0500
Newsgroups: comp.lang.lisp
Message-ID: <keKdnWzXs6o-H9LVnZ2dnUVZ_vednZ2d@speakeasy.net>
Tim Bradshaw  <tfb+google@tfeb.org> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) wrote:
| > Sorry, you *are* wrong about this... for Linux.
| 
| Me or him?
+---------------

He, Raymond Wiker, was wrong about the definition for Linux (only),
and I was disagreeing with him about that O/S only. I was *agreeing*
with Raymond that the definition of load of "number of runnable process
in the run queue - i.e, processes that are not currently waiting
for I/O or sleeping" [scaled by the number of available CPU cores,
of course] is the *correct* definition of "load". [Linux therefore
uses an *incorrect* definition of "load", IMNSHO.]

I also agree with Raymond that "I/O bound processes should not count",
except of course for whatever fraction of CPU time they *do* actually
consume when they're not waiting for I/O completion events. [Again,
Linux gets this wrong, resulting in totally idle servers being shown
with load averages >100 just because that many processes are waiting
for network traffic.]

+---------------
| I've never found cases where I/O bound processes don't count
| towards load (but I don't manage Linux machines much nowadays).
| Certainly it did on BSD, SunOS and does on Solaris.
+---------------

As far as I can tell from a quick look at the FreeBSD 6.2 scheduler code, 
only processes (well, threads) in CPU run queues are counted in "load".
[See the code in "/usr/src/sys/kernsched_ule.c" & thereabouts, especially
the calls to "kseq_load_add()" & "kseq_load_rem()".] If a process/thread
is taken out of the CPU run queues, its contribution to "load" is immediately
removed. AFAIK this is *always* the way BSD has worked, all the way back
to 4.1a-BSD [the earliest version that I dug into the kernel]. And from
observation of the behavior of servers with lots of processes in I/O wait,
this was the case for Irix as well.

I know [again, from direct observation] that this is most definitely
*NOT* the case on Linux.

[I cannot speak to SunOS/Solaris, due to lack of hands-on experience.]

So, yes, I guess I'm disagreeing with you, Tim.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607