Top: dynamically observe process changes. ps indicates the Process status at a certain time point, while top indicates dynamically observe the running status of the process in real time. We can divide the result of the top command into three parts, which is roughly like the following. The first part is the overall statistics of the system. The first line is the task queue information (top), which is the same as the execution result of the uptime command. The content is as follows: top-21: 50: 37 current time up2: 01
Top: dynamically observe process changes
Ps is the state of the process at a certain time point, while top is the dynamic real-time observation of the running state of the process.
We can divide the result of the top command into three parts, which is roughly like the following.
The first part is the overall statistics of the system.
The first line is the task queue information (top), which is the same as the execution result of the uptime command. The content is as follows:
Last-21:50:37 current time
Up system running time, format: minute
1 user current Login user count
Load average: 0.00, 0.00, 0.00 system load, that is, the average length of the task queue.
The three values are the average values from 1 minute, 5 minutes, and 15 minutes ago to the present.
What is the standard of this load? It seems that everyone's statement is not consistent. Some say that the number of CPU cores cannot exceed. If it exceeds, the load will be high.
It is also said that the three values are divided by 3 and cannot exceed 0.6. If the value is greater than, the load is high. What kind of standards can only be observed on the server? You can also discuss this issue.
The content of the second action process (Tasks) is as follows:
Tasks: 97 total process count
1. Number of running Processes of running
96 sleeping sleep Processes
0 stopped process count
0 zombie botnets
Cpu (s) information. The content is as follows:
Cpu (s): 0.7% us (user mode) CPU usage
0.3% sy (system mode) kernel CPU usage
0.0% CPU usage percentage of processes whose priorities have changed during ni (nice) User processes
99.7% idle task idle CPU percentage
0.0% wa (I/O waiting) Percentage of CPU time waiting for input and output (I/O problems, will seriously affect your server performance, because I/O consumes CPU)
0.0% hi (servicing IRQs)
0.3% si (servicing soft IRQs)
0.0% st (steal (time given to other DomU instances ))
The above three items are related to IRQ (the full name of IRQ is Interrupt Request, and the Translation into Chinese is "Interrupt Request"). Because I am not a computer professional, these items are for me, it is a little difficult, so I recommend an article: Work Load balancing with IRQ SMP Affinity, which can help you understand. The interrupt information in the system is in/proc/irq/, and the interrupt request is in/proc/interrupts. If you want to study it in depth, you can view other relevant information on your own.
The fourth line (Mem) is the memory information. The content is as follows:
Mem: 245408 k total physical memory
Total physical memory used by 215148 k used
30260 k free Memory Total
Memory usage of 58532 k buffers as kernel Cache
The fifth line (Swap) is the Swap zone information. The content is as follows:
Swap: 262136 k total number of Swap Areas
Total number of swap areas used by 0 k used
262136 k free swap zone total
The total number of swap areas of the 52320 k cached buffer.
The second part is the TOP Internal Command Prompt bar:
Top Internal commands can control the display mode of processes. In the top command status, enter the corresponding internal commands. The following are commonly used:
S. Change the top Command refresh frequency (default value: 3 seconds)
Change delay from 3.0 to: Enter the corresponding number at this time.
L disable or enable the first line of top information
T. Disable or enable the second line of Tasks and the third line of Cpus information.
M: Disable or enable the first part of the fourth line of Mem and the fifth line of Swap information.
N indicates the process list in the order of PID size
P lists processes in the order of CPU usage
M lists processes in the order of memory usage
R reverses the arrangement.
U displays the processes of the specified user. By default, all user processes are displayed.
C. display the full path of the process. By default, only the process name is displayed.
N or # set the number of processes displayed in the process list, but the maximum number is full screen.
F. Adjust the top command to display the list items. Such as adding a GROUP column or UID column. However, the next time you use the top command, it turns out to be the default one.
K. Terminate the process.
R adjusted the process priority (Linux and AIX are from-20 to 19, HP-UX is 0 to 39), as to how to get it, you can view through man nice.
H Show Help
Q: Exit top.
For the above internal commands, we recommend that you try them first, so it will be much easier to learn! Remember, you must learn more about Linux.