Explanation of the Linux View Memory command

Source: Internet
Author: User

The commands used are:

Free-m

M to view the memory in megabytes. Of course, if you like, you can use K.

Such as:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/72/wKioL1cfFYLAqDgJAAAa-sS8vaI480.png "title=" Free.png "alt=" Wkiol1cffylaqdgjaaaa-ss8vai480.png "/>

In the first part of the MEM line there are the following parameters.

Total: Memory count, i.e. 3881MB

Used: The number of memory already in use, i.e. 3745MB

Free: The number of idle memory, which is 135MB

Shared: Currently obsolete no, always 0

Buffers Buffer: The number of cache memory, which is 216MB

Cached Page: Cache memory, 435MB

Where the total amount of memory is related to the number of memory used and the number of free memory:

Total (3881M) =used (3745M) +free (135M)

In the second part (-/+buffers/cache), the parameters are as follows.

(-buffers/cache): Used memory, or 286MB (refers to the first part of the Mem line in the used-buffers-cached).

(+buffers/cache): free memory, or 715MB (refers to free+buffers+cached in the first part of the Mem line).

The visible-buffers/cache reflects the memory that is actually used by the program, and +buffers/cache reflects the total amount of memory that can be appropriated.

The third part refers to the swap partition, which everyone should understand, like Windows.

It is possible that we have read the above explanation or not quite understand. For example: The first part (MEM) is related to the result of Part Two (-/+buffers/cache), why is used and free so strange? In fact, we can analyze from two aspects. For the operating system, these two are mem parameters, buffers/cached are used, so it thinks free is only 232MB, for the application +buffers/cached equivalent to the available memory, because buffer/ Cached can improve the performance of program execution, and when the program uses memory, buffer/cached will soon be used. So from the application point of view, should be (-/+buffers/cache) of the free and used-based, that is, we mainly look at it and the relevant used. In addition to tell you some common sense, in order to improve the disk and memory access efficiency, the Linux has done a lot of careful design, in addition to the Dentry cache (for VFS, accelerated file path name to Inode conversion), but also adopted two main cache mode: Buffer Cache and Page cache. The former is used to read and write to the disk block, which is used to read and write to the file inode. These caches can effectively shorten the time for I/O system calls (such as read, write, getdents).

In Linux, the memory is used, not taken to see. In Windows, no matter how much real physical memory you have, it will be read with hard disk swap files, even if there is a large portion of memory. This is why Windows often prompts for insufficient virtual space. As you can see, the hard drive is faster than memory, so when we look at the memory usage of Linux, we don't have to worry about too little memory if we don't find swap space. If you often see a lot of swap, then you need to consider adding physical memory. This is also the standard to see if the memory is sufficient on a Linux server.

This article, for reference part.


This article is from the "Gaara_xu" blog, make sure to keep this source http://gaaraxu.blog.51cto.com/9569152/1767889

Explanation of the Linux View Memory 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.