> Could someone please explain to me how system load is calculated in
> unix, or point me to a resource that does?
Load average is a measure of the average number processes that are
runnable at any point in time over some period of time. For linux
(and all other UNIX machines that I am familiar with) these states are
kept for the last 1 minute, the last 5 minutes and the last 15
minutes.
If you are interested in the mechanics, the best resource is, of
course, the kernel itself. You can look in sched.c for the gory
details. I'll try to give a high level summary in case anyone out
there is truly curious.
In linux, every 5 seconds the sched.c:calc_load() triggers an update
of the load averages. At that time, we count the number of active
runnable processes and update the load averages.
This update is not quite as simple as you think. I don't have
time to go into the details, but basically, this is how you would
calculate the new load averages based on the old load averages
and the current number of runnable processes:
1 min: new_load_avg = .92 * old_load_avg + .08 * num_active
5 min: new_load_avg = .983 * old_load_avg + .017 * num_active
15 min: new_load_avg = .997 * old_load_avg + .003 * num_active
This is not the save as taking the average of the sum of all the
active processes for each 5 second measurement. The most recent
measurement is given a bit more weight. And, it looks to me that
process outside of the measured interval could probably have a an
effect on the load average for longer than the time interval it claims
to measure. But, somehow it all seems to give useful information, so
I won't shout too loudly...
___________________________________________________________________________
[EMAIL PROTECTED] soli deo gloria
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]