The difference between cache and buffer (reproduced)

Source: Internet
Author: User

1. Cache: Buffer, is a cache, is located between the CPU and the main memory of small but fast memory, because the CPU speed is much higher than the speed of main memory, the CPU from memory to read the data to wait a long time, and The cache holds the data that the CPU has just used or the part of the data that is recycled, and it is faster to read the data from the cache, reducing the CPU wait time and improving the performance of the system.

The cache is not a cache file, but rather a buffer block (block is the smallest unit of I/O reading and writing), the cache is generally used on I/O requests, if more than one process to access a file, you can read this file into the cache, This allows the next process to gain CPU control and access this file directly from the cache to improve system performance.

2. Buffer: buffers, which are used to transfer data between devices that are not synchronized, or between devices with different priority levels, buffer can reduce the time between interprocess communication, when the storage speed of the device and storage slow devices to communicate, the storage of slow data first store data in Buffer, A device that reaches a certain level of storage and then reads the data from buffer, during which the CPU of the device that stores it quickly can do other things.

Buffer: Typically used to write to disk, for example: a process requires multiple fields to be read in, and fields that have been read before all required fields are read into buffer are first placed

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 allocated by various processes and is used in areas such as input queues, a simple example where a process requires multiple fields to be read, and before all fields are read into full, the process saves the previously read-in fields in buffer.
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.

The difference between cache and buffer (reproduced)

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.