0

As far as I know, the load average in top is the numbers of precess(threads) in running or uninterrupted sleep status, So it should be equal to (procs-r +1 )+ procs-b in vmstat, but in practice, this two number always have big gap. Any wrongs in my understanding, appreciate so much if some guys give me some guide.

top - 05:34:50 up 1 day, 20:56,  5 users,  load average: 2.83, 2.67, 1.62
Tasks:  79 total,   1 running,  78 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.8%us,  1.8%sy,  0.0%ni, 91.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.4%st
Mem:   1758000k total,   582636k used,  1175364k free,   103932k buffers
Swap:   917500k total,        0k used,   917500k free,   180868k cached

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1182524 103784 180860    0    0     1     9    6   53  7  2 91  0  0
 0  0      0 1182524 103784 180860    0    0     0    36   70  117  0  0 100  0  0
 0  0      0 1182516 103784 180860    0    0     0     0   73  132  0  1 100  0  0
 0  0      0 1182516 103784 180860    0    0     0     0   60  127  0  0 100  0  0
 1  0      0 1182516 103784 180860    0    0     0     0   62  102  0  0 100  0  0
 0  0      0 1182628 103784 180860    0    0     0     0  289  238  1  2 97  0  0
 2  0      0 1152160 103784 180892    0    0     0     8 1481 2371 54 12 34  0  0
 1  0      0 1182192 103784 180860    0    0     0     0  681  834 19  4 78  0  0
 0  0      0 1182200 103784 180860    0    0     0     0   80  147  0  1 100  0  0
 0  0      0 1182200 103784 180860    0    0     0     0   53  107  0  0 100  0  0
 0  0      0 1182208 103788 180856    0    0     0    72   64  123  0  0 100  1  0
Mike
  • 22,310
  • 7
  • 56
  • 79
Mingfei.hua
  • 3
  • 1
  • 4

2 Answers2

3

It is based on the number of processes in a runnable or uninterruptable state. Runnable is either currently executing on a processor, or waiting for a processor to become free. The uninterruptable state is waiting for IO to complete - it's not "uninterruptable sleep" - the process is technically "sleeping", but it's waiting for a kernel call to complete.

Basically it's the number of processes that are currently "doing something", but keep in mind that it's an average over the last 1/5/15 minutes - it's not an instantaneous value. This is in contrast to the list of processes, which is a snapshot for the instant when top collected its information. Processes wake up and go to sleep many times per second, so there's no easy way to correlate normal activity with a load average unless you get really lucky, the process(es) are always active, or a problem with IO.

As an example of this - the first line in your top output shows a process that is not currently runnable, but has used 9% of the CPU since the last time top collected its statistics

Load average is not scaled for number of cores available to the OS - an average of 1 means that 1 CPU is 100% busy (so a single core system is pinned, but a quad core system is 25% utilized). It's generally not too bad to have a load average up to 75% of the number of cores in the system in my experience.

  • Thank you, Jamie. "load average" is a average number of a period time, but ps, vmstat are sample instantaneous value. many people,not just me somtetime feel the two values diffent to much. I even dubious some bugs there. – Mingfei.hua Jun 20 '12 at 07:03
0

The load average is the sum of the run queue length and the number of jobs currently running on the CPUs.

From the Book UNIX Power tools:

The load average tries to measure the number of active processes at any time. As a measure of CPU utilization, the load average is simplistic, poorly defined, but far from useless

(procs-r +1 )+ procs-b : hmm .

To understand the load average please read this article and this article.

mgorven
  • 30,615
  • 7
  • 79
  • 122
Pratap
  • 695
  • 6
  • 22
  • Have looked the article you give me. Do you think the fomula load average=(procs_r + 1) + procs_b) ? man vmstat as follows: Procs r: The number of processes waiting for run time. b: The number of processes in uninterruptible sleep. – Mingfei.hua Jun 20 '12 at 08:44