Linux Top Command

Source: Internet
Author: User

Linux view process The most used command should be the top command, we mainly explain today, the top command results in the meaning of the parameters, the top command results are as follows:

Visual results are divided into two parts, the upper part is the system information, the next part is the system process information, the following detailed description:

The first line represents the system run time, respectively:

System time, the system runs to the present time, the current number of users logged in the system, the system average load of three values, respectively, is 5 minutes, 10 minutes, 15 minutes.

Tip: Explain what is the system load, the lower the general load value is better, the value is also high indicates that the system may be a problem with the information, but it is not absolute

Borrow Netizen's article to explain: https://www.cnblogs.com/TaleG/p/6030992.html

A single-core processor can be figuratively likened to a single lane, the number is normal between 0-1, so a car, the car will not wait for direct passage;

0 means no cars on the road.

1.00 means the road is normal, but it is likely to worsen and cause congestion. At this time the system has no redundant resources, the administrator needs to optimize;

1.00-*** said the road is not very good, if the arrival of 2.00 means there is a bridge on the number of vehicles a few times the vehicle is waiting. You have to check the situation.

What if we have two lanes?

The number of full-load states is "1.00 * CPU Cores", that is, dual-core CPU is 2.00, quad-core CPU is 4.00

So:

The single-core load is safe below 0.7, and more than 0.7 needs to be optimized.

That should look at that parameter??

Look 5 minutes and 15 minutes better, that is, 2 digits behind.

How does the CPU's number of cores get??

' model name ' /proc/cpuinfo | Wc-l

Number of CPU cores N, see the following 2 digits, with the number/n, if the resulting value is less than 0.7 can be worry-free

Previous field description diagram:

Explain the first line, the second line what do you mean?

In fact, should be seen at a glance, should be the number of system processes, the first column indicates the total number of system processes followed by the running process, hibernation process, stop process and zombie process

This is followed by the system CPU uptime, "User space consumption CPU percentage", "CPU percentage consumed by kernel space", "percentage of CPU that has changed priority in user space", "Idle CPU percentage", "Waiting for input output CPU time percentage", " The total amount of time that the CPU is serving the hardware interrupt, the total time spent by the CPU service soft interrupt, and the steal times

So what does each CPU parameter mean?

Look at the official explanation:

Us:user CPU time (or)% CPU time spentinchUser Spacesy:system CPU Time (OR)% CPU Time spentinchkernel Spaceni:user Nice CPU time (or)%CPU time spent on Processesid:idle CPU time (OR)%CPU time spent Idlewa:io wait CPU time (or)% CPU Time spentinchwait (on disk) Hi:hardware IRQ (or)% CPU Time spent servicing/Handling Hardware Interruptssi:software IRQ (or)% CPU Time spent servicing/handling software Interruptsst:steal time--% CPU timeinchInvoluntary wait byVirtualCpu whileHypervisor isServicing another processor (or)% CPU time stolen fromAVirtualMachine

Simple translation:

US: User state uses more CPU time than SY: The system state uses more CPU time than NI: The user-configured CPU time for the nice-weighted process is allocated: Idle CPU time is longer than WA:CPU wait for disk write completion hi: Hard Interrupt Time si: Soft interrupt consumption time ST: virtual machine steal time

But the egg, still do not understand:

Let's see how the CPU percentage is calculated:

For example, there are 100 CPU time slices in a second, this CPU time slice is the smallest unit of CPU work. Then these 100 CPU time slices are used in different areas and for the purpose, which represents the CPU time ratio occupied by this area. This is the percentage of CPU time that is drawn here, such as

Copies the file from the SRC location of the disk to the DST location of the disk. The file is read into the kernel space from SRC, then read to the user space, then copy the data to the buf of the user space, then through the user space, the kernel space, the data to the disk DST

So from the above program, the CPU consumption in kernel space is the SY (System State CPU percentage), CPU consumption in user space is the US (User state CPU percentage used). そうか

Figure out the top two, say hi and si two parameters

If the program is not a problem, then there is no hi and Si, but there is actually a hard interrupt and soft interrupt concept. For example, a hard interrupt, the CPU in the execution of the program, suddenly peripheral hardware (such as hard disk problems) The machine needs to immediately notify the CPU for onsite storage work. This time the CPU will have a context switch. Is that the CPU will be a part of the time will be hard interrupt occupation, this time is hi. Similarly, SI is the CPU time of the soft interrupt, and the soft interrupt is triggered by the software's instruction mode.

The concepts of related soft interrupts and hard interrupts can be consulted:

http://blog.csdn.net/pxz_002/article/details/7327668

Here is the nice parameter

NI is nice, what is nice, every Linux process has a priority, high priority process has priority to execute the right, this is called the PRI. In addition to the priority, the process has a priority correction value. That is, if your original priority is 20, then the correction value is-2, then your final process priority is 18. This correction value is called the nice value of the process.

So the problem is, the value of the change is a number, how can it occupy the system time???

NI refers to the user-state CPU time ratio used for the nice-weighted process, and my understanding is that the so-called correction value of a process means allocating some CPU time to the user state of the process, and the CPU time allocated by this middle is our NI. (This understanding is not very sure, if you have the wrong trouble to help point out the next)

Then the memory:

Line five is the swap partition:

Finally, the process information:

Linux Top Command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.