Free command (buffer differs from cache/linux view idle memory)

Source: Internet
Author: User

Free
The free command provides a more concise view of system memory usage relative to top:

# free       total used       free     shared    buffers     cachedmem:        255988     231704      24284          0       6432     139292-/+ buffers/cache:      85980     170008Swap:       746980          0     746980

Mem: Indicates physical memory statistics
-/+ buffers/cached: Cache statistics representing physical memory
Swap: Indicates the usage of the swap partition on the hard disk, we don't care about it here.
Total physical memory of the system: 255988Kb (256M), but the actual memory currently available to the system is not the 24284Kb of the first line of the free tag, it represents only unallocated memory.

We use names such as Total1, Used1, Free1, Used2, and free2 to represent the values of the above statistics, and 1 and 2 represent the data for the first row and the second row respectively.

Total1: Represents the total amount of physical memory.
Used1: Represents the amount that the total is allocated to the cache (including buffers and cache), but may not be actually used in some of the caches.
FREE1: Memory that has not been allocated.
SHARED1: Shared memory, the general system will not be used, nor discussed here.
Buffers1: The number of buffers that are allocated but not used by the system.
Cached1: The number of caches that the system allocates but has not been used. The difference between buffer and cache is shown later.
USED2: The total amount of buffers and caches actually used, as well as the amount of memory actually used.
Free2: The sum of unused buffers with the cache and unallocated memory, which is the current actual memory available to the system.


You can sort out the following equation:

Total1 = used1 + free1

Total1 = Used2 + free2

used1 = buffers1 + cached1 + used2

Free2 = buffers1 + cached1 + free1

the difference between buffer and cache
A buffer is something that have yet to being "written" to disk. A cache is something that have been "read" from the disk and stored for later use. Both are data in RAM. In short, the buffer is about to be written to the disk, and the cache is read out of the disk.
Buffer is an area where data is transferred between devices that are not synchronized, or devices with different priority levels. Buffer (buffers) is based on the disk read-write design, the decentralized write operations centralized, reduce disk fragmentation and hard disk repeatedly seek, thereby improving system performance.
The cache is often used on disk I/O requests, and if more than one process accesses a file, the file is made into a cache for next access, which provides system performance. Cache (cached) is to save the read data, re-read if hit (find the required data) do not read the hard disk, if not hit the hard drive. The data will be organized according to the frequency of reading, the most frequently read content in the most easily found location, the content of the no longer read to the back row, until removed from

Free command (buffer differs from cache/linux view idle memory)

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.