devutils/ATFQ/book ATFQ git

Part II · Your system

18.1 Load average

alsoloadload averageloadavguptimesystem load

TL;DR

  • Load average: the number of tasks running or waiting for a CPU, plus those waiting on disk (D state), averaged over 1, 5 and 15 minutes.
  • Compare it with the number of CPUs: on 8 CPUs, a load of 8 means fully busy, and 16 means tasks are queuing.
  • A high load with idle CPUs points to I/O: a slow disk or network storage.
uptime
nproc

On your machine

alice@laptopexample
$ atfq 18.1
  CPU       11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz · 8 logical CPUs
  Load      1.25, 0.90, 0.62 over 1, 5 and 15 minutes, for 8 CPUs
  Tasks     2 running right now, 1043 in all
  Governor  powersave

An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.

Pitfalls

Deep dive 2 questions

Why does Linux count tasks waiting on disk?

Since 1993, Linux adds tasks in uninterruptible sleep to the load, so that it shows the demand on the whole system and not only on the CPUs. A machine stuck on a slow disk then shows a high load, which makes the problem visible, but it also makes the number harder to read: you can't tell CPU demand from I/O waiting without looking further.

Load or CPU usage?

CPU usage, as top shows it, is the share of time the CPUs were busy. Load is the length of the queue. At 100% CPU with a load equal to the number of CPUs, everything runs and nothing waits; with twice that load, every task waits about as long as it runs.

Commands
uptime nproc top
Paths
/proc/loadavg
See also
18. CPU
16.1 Process states and zombies
16.3 nice and priorities