What exactly is buffer and cache in Linux memory?

Source: Internet
Author: User

The free command in Linux will output:

Total

Used already in use

Free Idle

GKFX Shared Memory

Buffers

Cached

The first four items are better understood, I will know what the meaning of a look. But buffer and cached I have been not very understanding, finally saw an article written in very detailed, so write down;

·  A buffer is something that have yet to being "written" to disk. ---buffer write cache, save to disk buffer and then write to permanent space when data is stored

·   A cache is something that have been "reed" from the disk ADN stored for later use. --cache read cache, the data from the disk read out, persisted in the buffer, the preparation process next use,

English better, should have seen the clue,

Buffer is used to store data to be output to disk, while the cache is read from disk and stored in memory for future use. All of them are introduced to provide IO performance.

Memory: From the user's and operating system's point of view, there is a difference in size and space. Like the memory of buffer/cached, because this memory is actually used from the operating system angle, but if the user wants to use, this block of memory can be quickly recycled and used by the user space program, so from the user's point of view this memory should be marked as idle state.

Why does Linux have this mechanism?

In fact, this is a very good design, in order to improve the performance of disk IO, the data read from the low-speed block device is temporarily saved in memory, even if the data is no longer needed at the time, but the next time the application accesses the data, it can be directly read from memory, thus bypassing the low-speed block device, thereby improving the overall performance of the system.

What exactly is buffer and cache in Linux 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.