Experience and command explanation of memory usage in Linux system

Source: Internet
Author: User
Tags memory usage

Linux memory management, in fact, with Windows memory management has a very similar place, are using the concept of virtual memory, said here have to scold MS, why in many times there is a lot of physical memory, but still used to pagefile. So I often have to argue with a bunch of people about the size of the pagefile, and how to allocate this problem, in Linux we will not have to fight any swap size problem, I personally think, swap set a 512M is enough, if you ask the 512M swap is not enough to do? Can only say eldest brother you still add memory, or check your application, is not really appear memory leak. The night is also deep, will not say nonsense.

View memory under Linux We generally use command free;

[Root@nonamelinux]# free total used free shared buffers cached;

mem:386024 377116 8908 0 21280 155468;

-/+ buffers/cache:200368 185656;

swap:393552 0 393552;

The following is an explanation of these values:

Total: The amount of physical memory.

Used: How big it has been used.

Free: How many are available.

Shared: The total amount of memory shared by multiple processes.

Buffers/cached: The size of the disk cache.

Third line (-/+ buffers/cached):

Used: How big it has been used.

Free: How many are available.

The line four is not much explained.

Difference: The difference between the used/free of the second line (MEM) and the used/free of the third row (-/+ Buffers/cache). The difference between the two is that the first line is from the OS point of view, because for os,buffers/cached is used, so his available memory is 8908KB, the used memory is 377116KB, which includes, the kernel (OS) uses + Application (X,ORACLE,ETC) uses the +buffers+cached.

The third line refers to the application from the point of view of the application, buffers/cached is equal to available, because buffer/cached is to improve the performance of file read, when the application needs to use memory, the buffer/cached will be quickly recycled.

So from an application perspective, the available memory = System Free memory+buffers+cached.

As in the previous example:

185656=8908+21280+155468 then explains when memory will be exchanged and by what side. When the available memory is less than the rated value, the meeting is exchanged.

How to look at the rating (RHEL4.0):


Related Article

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.