当前位置:网站首页>CPU status information us, sy and other meanings

CPU status information us, sy and other meanings

2022-06-24 13:23:00 Chen Bucheng I

One . Overview overview

For example, there is... In one second 100 individual cpu Time slice , This cpu Time slice is cpu The smallest unit of work . So this 100 individual cpu Time slice is operated in different areas and purposes , It represents the area occupied by cpu Time ratio . That's what we get here cpu Time percentage .

The following for TOP Command to see the information , Each parameter will represent cpu The distribution of time slice occupied , All of the following add up to 100%.

as follows ,%Cpu(s) Calculate for all , How many cores are 100% Of the displayed process %CPU For a single core , Occupy a core for 100%,2 One is 200%

Two . Detailed explanation

us and sy

us User space occupancy CPU percentage sy Kernel space footprint CPU percentage

user CPU Usage rate , Including user status CPU Usage rate (user) And low priority user mode CPU Usage rate (nice), Express CPU Percentage of running time in user mode CPU High usage , It usually indicates that some applications are busy .

System CPU Usage rate , Express CPU Percentage of time in kernel mode ( Not including interruptions ). System CPU High usage , The kernel is busy .

4G The process address space of ( Memory ) Artificially divided into two parts – User space and kernel space . User space from 0 To 3G(0xc0000000), Kernel space occupied 3G To 4G. In general, a user process can only access the virtual address of the user space , Can't access the virtual address of kernel space . The exception is that only user processes make system calls ( Execute in kernel mode on behalf of the user process ) You can access the kernel space at any time .

So kernel operations take up kernel space , Process operation takes up process space

User space corresponding process , So whenever the process switches , The user space will change ; The kernel space is mapped by the kernel , It doesn't change with the process , Is constant . Kernel space address has its own page table , User processes have different page tables .

The user space of each process is completely independent 、 Irrelevant .

ni

Priority specifies

Within the user process space , Change the priority of the process occupied CPU percentage

Processes have priority , If you adjust the priority , Cost cpu Of the time period , Then consume this ni

If ni Very high , That is, processes may change priorities frequently ( Current understanding )

id

The rest id Except id To occupy cpu The free part of the time slice , Equivalent to space cpu Percent of .

wa

wa refer to CPU Time to wait for disk write to complete , That is, the premise is to IO operation .

It's going on IO During operation , If the program is blocked , He cpu Will wait for the data to be written to the disk to complete the write operation . So at this point cpu The waiting time is wa.

give an example : Use cp Copy , If there are multiple files in the folder , Every time he copies ,cpu Command file copying , But when the hard disk is read and written ,cpu Is to wait , Now cpu Don't act just wait .

So if a machine sees wa Very high , So the general description is disk IO Problems arise , have access to iostat Wait for the command to continue the detailed analysis .

hi and si

Specific description of software and hardware interrupt

If the program is OK , That's not true hi and si Of . When typing on the keyboard ,cpu We have to deal with this thing immediately , That's the interruption , This means that the current operation is interrupted to handle something that needs to be handled immediately .

The theory of soft interrupt is the same as that of hard interrupt , But the software , See the detailed description for details

st

st The explanation is real-time , But it's about virtualization

such as centos on kvm( virtual machine , similar win Of vmver), Then check on this computer st Very high

Currently understood as , For virtual machines cpu Number of time slices used . For example, open 2 A virtual machine , The virtual machine is used cpu It is also provided by the real machine , Here should be the number of virtualization applications .

View each cpu The state of mpstat mpstat -P ALL

irq: Hardware interrupt CPU The dosage ; sofr: Software interrupt CPU The dosage ; iowait: That's what it says wa steal: Time spent serving other tenants ( Don't understand, ); guest: Time spent on guest virtual machines ( Don't understand, );

3、 ... and . summary

user CPU and Nice CPU high , Indicates that the user state process takes up more CPU, So we should focus on troubleshooting process performance problems

System CPU high , It shows that kernel state takes up more CPU So we should focus on checking the performance of kernel threads or system calls

if %iowait The value of is too high , Indicates that the hard disk exists I/O bottleneck ;

if %idle When the value of is high but the system response is slow , It could be CPU Waiting to allocate memory , At this time, the memory capacity should be increased ;

if %idle The value of continues to be lower than 1, It's systematic CPU Processing power is relatively low , Indicates that the most important resource to be solved in the system is CPU;

原网站

版权声明
本文为[Chen Bucheng I]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/05/20210524135807775d.html