Re: What exactly is 'load average' ?

From: Kurtis D. Rader (krader_at_skepticism.us)
Date: 06/17/03


Date: Mon, 16 Jun 2003 19:44:41 -0700

On Mon, 16 Jun 2003 02:55:53 +0100, Dr. David Kirkby wrote:

> I've been trying to measure the load average on quad processor Sun Ultra 80
> running Solaris 9 using a UNIX system call. I seem to be able to do this, but
> I'm baffled by the numbers I get back. Perhaps someone can enlighten me on
> exactly what is the 'load average' on Solaris.

Frank Cusack came closest to providing the correct answer. On the UNIXes
to which I have source code access (Linux and a couple of proprietary
versions based on a melding of System V and BSD) it is calculated as

    processes running + runable + fast wait
    ---------------------------------------
                number of CPUs

The part that typically confuses people is the "fast wait" term. That is
the number of processes sleeping at a non-interruptable priority. This
is typically because they are waiting for a disk I/O operation to
complete. But could also be due to any number of other reasons; e.g.,
sleeping for a kernel memory allocation to complete. The reason that
term is included is based on the premise that processes sleeping at a
non-interruptable priority will do so for a very short duration (e.g.,
a few milliseconds). Therefore, because they are likely to become runable
again in the very near future (possibly before the current timeslice
completes) it is reasonable to include them in the calculation of the
CPU "load".

Of course, the actual calculation is slightly more complex to handle the
aging, but that doesn't materially affect the definition. The above
calculation is typically performed at each timer tick (e.g., 1/100 of a
second) and the current value factored into the 1, 5, and 15 minute
averages using an exponential decay equation executed using integer
arithmetic for speed.

On many systems there are a few system daemons that sleep at
non-interruptable priority. In many cases the daemons rarely execute, so
therefore skew the load average. They reason they sleep non-interruptably
is that it simplifies the code.


Loading