Linux Memory Management Guide

Source: Internet
Author: User
In Linux, we usually use commandfree [root @ nonamelinux ~] to view memory. FreetotalusedfreesharedbufferscachedMem: 3860243771168908021280155468-

In Linux, we usually use command free to view memory.

  1. [Root @ nonamelinux ~] # Free
  2. Total used free shared buffers cached
  3. Mem: 386024 377116 8908 0 21280 155468
  4. -/Buffers/cache: 200368 185656
  5. Swap: 393552 0 393552

The following is an explanation of these values:

Row 2 (mem ):

Total: total physical memory size.

Used: used.

Free: available.

Shared: the total memory Shared by multiple processes.

Buffers/cached: disk cache size.

Row 3 (-/buffers/cached ):

Used: used.

Free: available.

The fourth line won't be explained much.

Differences:The difference between used/free in the second row (mem) and used/free in the third row (-/buffers/cache.

The difference between the two is that from the usage perspective, the first line is from the OS perspective, because for OS, buffers/cached is used, so its available memory is 8908KB, the memory in use is kb, including the buffers cached used by the kernel (OS) using Application (X, oracle, etc.

The third line indicates that, from the application perspective, for applications, buffers/cached is equivalent to available, because buffer/cached is designed to improve file read performance, when the application needs to use the memory, buffer/cached will be quickly recycled.

From the application perspective, the available memory = system free memory buffers cached.

For example, 185656 = 8908 21280 155468

Next, we will explain when the memory will be exchanged and by which side.

When the available memory is less than the rated value, a meeting will be held for exchange.

Rating (RHEL4.0 ):

# Cat/proc/meminfo

Switching reduces the number of physical pages used in the system in three ways:

1. reduce the cache size and page cache size.

2. swap out the V-type memory page.

3. swap out or discard the page. (The Memory page occupied by the Application, that is, the physical memory is insufficient ).

In fact, using swap in a small amount affects the system performance.

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.