The loadavg in Linux is rich in content. The following is an example of enhanced learning:
After 1 uptime, the results are analyzed as follows:
PM up 2 days, 2 users, loadaverage: 8.13, 5.90, 4.94
9/84 5662
The final content of the command output indicates the average number of processes in the queue in the past 1, 5, and 15 minutes.
Generally, as long as the number of active processes of each CPU is not greater than 3, the system performance is good. If the number of tasks of each CPU is greater than 5, it indicates that the performance of this machine has a serious problem. In the preceding example, if the system has two CPUs, the current number of tasks for each CPU is 8.13/2 = 4.065. This indicates that the system performance is acceptable.
The average system load is defined as the average number of processes in the running queue within a specific time interval. If a process meets the following conditions, it will be in the running queue:
It has no results waiting for I/O operations
It does not take the initiative to enter the waiting status (that is, it does not call wait)
Not stopped (for example, waiting for termination)
In the last two columns:
Nr_running (9) indicates the number of tasks running the queue at the sampling time, which is the same as the number of Running Processes in/proc/STAT's procs_running.
Nr_threads (84) Maximum number of active tasks in the system (excluding completed tasks) at the time of sampling last_pid (5662), including lightweight processes, namely threads
2 PS aux combination
Run PS aux to the following information:
PS aux
User PID % CPU % mem vsz RSS tty stat Start Time Command
....................................
The parameters in stat have the following meanings:
D. uninterruptible (usually Io) cannot be interrupted)
R is running or a process in the queue
S is in sleep state
T stop or be tracked
Z botnets
W enters the memory switch (it is invalid from kernel 2.6)
X Dead Process
<High priority
N Low priority
S contains sub-Processes
+ Process group in the background
Use PS to identify the number of processes in these two States
PS aux | awk '{print $8}' | grep '[d | r]' | WC-l