Linux : Understanding load average and % CPU?
Understanding Load Average: 0.83 0.73, 0.55
Load is the measure of the amount of computational work a system performs. The three values is the load average over a time interval. The intervals are, the last 1 minute, 5 minutes, and 15 minutes. Load average is computed as an exponential moving average. If you wish, you can take a deep dive and read Examining Load Average
-
Single Core System
- The load average value varies in range. With a single core system the value
0.83
means your CPU was at 83% capacity within the last minute. A value of1.0
would mean your CPU is at exact capacity (100%). With the value1.0
the system will be overloaded by adding even a little bit of additional work. A value greater than1.0
means it's getting more than it can handle. This isn't bad, it just means that more processes are waiting for CPU time. You would see the slowness of the computer.
- The load average value varies in range. With a single core system the value
-
Multi-Core System
- With a multi-core system, you divide the load average by the number of cores you have. So for example, having a load average of
0.83
and having 4 cores, you would take0.83 / 4
to get0.2075
or(0.83 / 4) * 100
to get20.75%
capacity. With a quad-core system, if you had a load average greater than4.0
that would indicate all cores are at 100% capacity, and any overload will result in processes waiting for CPU time.
- With a multi-core system, you divide the load average by the number of cores you have. So for example, having a load average of
Overloading occurs when you go over your max capacity. The load average as an overload can be a bit confusing to read because it's based on your cores. If you have a quad-core CPU, you won't overload until the load value is over
4.0
. If the first load average value was5.50
that would mean your system is 150% overloaded, and on average 1.5 processes in the last minute had to wait for CPU time.
Understanding %Cpu(s): 0.8us, 0.8sy....
This section is a displays HOW the CPU has been used. Each suffix stands for something specific, and indicates how much time the CPU spent on that set of tasks. If you add up all of the numbers in that output row, it will add up to 100%.
-
The tasks are defined as... source
- us is the percentage of the CPU for user processes
- sy is the percentage of the CPU for system processes
- ni is the percentage of the CPU processes with priority upgrade nice Ni easter egg
- id is the percentage of the CPU not used
- wa is the percentage of the CPU processes waiting for I/O operations
- hi is the percentage of the CPU serving hardware interrupts
- si is the percentage of the CPU serving software interrupts
- st in a virtualized environment, a part of the CPU resources are given to each virtual machine (VM). The OS detects when it has work to do, but it cannot perform them because the CPU is busy on some other VM. The amount of time lost in this way is the steal time
Related videos on Youtube
user3198603
Updated on September 18, 2022Comments
-
user3198603 over 1 year
When I execute
top
command on my ubuntu system I see below resultstop - 07:58:58 up 1:21, 1 user, load average: 0.82, 0.73, 0.55 Tasks: 293 total, 1 running, 292 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.8 us, 0.8 sy, ....
I need to understand
load average
and%cpu
.My understanding based on my knowledge and high-cpu-utilization-but-low-load-average
Load Average
Load average is a measurement of how many tasks are waiting in a kernel run queue (not just CPU time but also disk activity) over a period of time. Does it mean .83 tasks are waiting per above results ? How it can be decimal number ? Also what is three different figures
0.83 0.73, 0.55
?%CPU
This represent the for how much time in last x seconds, CPU was working. For example :- if CPU utilization displays 60%, it means in last x seconds cpu was working 60% of time in x seconds.Is my understanding correct ? If yes what
%Cpu(s): 0.8 us
represents ?Also if I have 4 CPU processor, and %CPU displays 50% does it mean either all cores are working 50% or 2 CPU are working 100% ?
-
user3198603 about 5 yearsThanks DrZoo for such a descriptive answer. You said
Load is the measure of the amount of computational work a system performs
I believe another clear statement can beLoad is the measure of the amount of computational work a system performs or need to perform (for the processes in queue)
When you say%Cpu(s) section is a displays HOW the CPU has been used
, so its kind of CPU load only where it is measure of actual work done not need to perform for the tasks in queue. -
user3198603 about 5 yearsAlso when stats says
%Cpu(s): 0.5us
does it mean 50% CPU utilization (for user process) including all cores. I mean if it is quad core processor, doet mean all 4 cores are working for 50% time or it can also be 2 cores working at 100% time for last x seconds? If yes what is value of x for ubuntu/linux os ? -
DrZoo about 5 years@user3198603
0.5us
means less than 1% of the tasks the CPU did were user processes. If you add up all of the numbers in the%Cpu(s)
output line, it will add up to 100%. This simply refers to all of the work the CPU has done, regardless of which core, or cores did the work. I think the%Cpu(s)
output does not refer to a time frame of the last x seconds, but rather it's entire up timetop - 07:58:58 up
-
user3198603 about 5 yearsThanks a lot @DrZoo. Is my understanding under first comment correct ?
-
DrZoo about 5 years@user3198603 yeah the %Cpu(s) section is the work that has already been performed. Not what is in queue.