Home  >  Article  >  Operation and Maintenance  >  How to check memory usage in Linux?

How to check memory usage in Linux?

PHP中文网
PHP中文网Original
2017-06-20 09:36:002910browse

Input: top

RESSHR##S##% CPU%MEM

##PID

Process ID

USER

Process Owner

PR

The priority level of the process, the smaller it is, the priority it will be executed

Ninice

##Value

##VIRT

##Virtual virtual space occupied by the process Memory

Physical memory occupied by the process

Shared memory used by the process

The status of the process. S means sleeping, R means running, Z means zombie state, N means the priority value of the process is negative

CPU usage occupied by the process

Percentage of physical memory and total memory used by the process

TIME+

The total CPU time occupied by the process after it is started, that is, the accumulated value of the CPU usage time.

##COMMAND

Process Start command name

Input: free

Free##Shared

##Total

Total physical memory size.

##Used

##Already How big to use.

##Available how many.

More The total amount of memory shared by processes.

##Buffers/cached

The size of the disk cache.

The third line (-/+ buffers/cached):

##Used

How big has it been used.

Free

##Available how many.

##The fourth line

swap:

#Total##UsedFree

Total size of physical memory.

##Already How big to use.

##Available how many.

Difference:
used/ in the second line (mem) The difference between free and used/free in the third line (-/+ buffers/cache)

The difference between these two lies in the perspective of use. The first line is from the OS ( From the perspective of the operating system), because for the OS (operating system), buffers/cached are all used, so its available memory is 434884KB and the used memory is 3489800KB,

The third line refers to the

application perspective

. For the application, buffers/cached is equal to available, because buffer/cached is to improve the performance of file reading. When the application When the program needs to use memory, buffer/cached will be recycled quickly.

So from the perspective of the application, available memory = free +buffers+cached.

As in the above example: 434884 + 36436 + 421856 = 893176 ##-/+ Calculation of the number of buffers/cache memory:

-The number of memory in buffers/cache: used - buffers - cached

The value of used: 3489800 - 36436 - 421856 = 3031508

+The number of memory in buffers/cache: free + buffers + cached

The value of free: 434884 + 36436 + 421856 = 893176

The above is the detailed content of How to check memory usage in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn