On Tue, Jul 03, 2001 at 10:14:58PM -0500, Jay Kline wrote:
> Can anyone tell me how the load is calculated in linux? To make myself clear, 
> I am talking about the 3 numbers for load average on `top`, or the load 
> number from `xosview` or any other number of cpu stat utilities.  Is there a 
> max number for these? What exactly does it mean?

(Note:  I am aware that this information is technically not 100%
correct.  However, like Newtonian physics, I believe it to be a close
enough approximation for everyday use.)

Load is the number of processes which are available to be run at any time.
These processes may either be actually running or they may be waiting
for some resource (generally either CPU or disk) to become available.
The three numbers listed are the average load over the last 1 minute,
5 minutes, and 15 minutes.

Although load is related to CPU utilization, they're not quite the
same thing.  A process which performs no I/O at all and consumes 50%
of the available CPU cycles will generate a steady load of 0.50.
However, if the process requires any disk I/O (including swapping),
the load will be increased because it has to spend time waiting for
disk operations to complete.  And, of course, CPU utilization can't
go above 100%, but load can easily exceed 1.00.  (Right now, for
instance, I'm typing this on a box with a 1-minute load avg of 2.02
because it's ripping a CD (cdparanoia waiting on the CDROM continually
= load 1.00) and compressing the tracks into mp3s (lame eating every
available CPU cycle = load 1.00).)

Load has no fixed maximum (theoretically, an infinite number of
processes could be runnable) but, aside from certain special cases
(such as my current mp3-making session), you generally want to keep
it to no more than the number of CPUs in the machine (since running
processes count for load also) and roughly proportional to CPU usage
(if load significantly exceeds CPU, processes are waiting for I/O; in
my experience, this usually means there's a lot of swapping going on
and you should add more memory).