Linux CPU management and monitoring and performance evaluation

1. CPU load

CPU load (cpu load) refers to the pressure generated by a process on the system at a certain point in time.

The operating capacity of the CPU, like the traffic capacity of a bridge, has states of full load, partial load, and overload. These states correspond to different cpu load values. When a single CPU is running at full load, cpu_load is 1. When there are multiple CPUs or multi-cores, it is equivalent to the bridge having multiple lanes. When running at full load, the value of cpu_load is the number of CPUs or the number of multi-cores.

Calculation of CPU load (taking a single CPU as an example), assuming that 10 tasks are executed in one minute represents full load, when 30 tasks are given in one minute, the CPU can only process 10 tasks, and the remaining 20 tasks cannot be processed, cpu_load=3 .

From the perspective of the system, the average load reflects the overall pressure faced by the system, and if we switch the perspective to the task itself, then in essence, the system load represents the task's thirst for system resources.

The definition of slave load is the average number of processes in the two states of runnable and uninterruptible, that is, the average number of active processes, which is not directly related to the use of CPU. The CPU usage is the statistics of CPU busyness per unit time, which does not necessarily correspond exactly to the average load. for example:

  • A CPU-intensive process that uses a large amount of CPU will lead to an increase in the average load, and the two are consistent at this time;
  • I/O-intensive processes, waiting for I/O will also lead to an increase in the average load, but the CPU usage is not necessarily high;

The scheduling of a large number of processes waiting for the CPU will also lead to an increase in the average load, and the CPU usage will be relatively high at this time.

So to be precise it is not only CPU load, but system load. If the load value seems to be high because there are many uninterruptible tasks, it may not be obvious in the actual system.

Guess you like

Origin blog.csdn.net/qq_35029061/article/details/132003014