The difference between buffer and cache

Source: Internet
Author: User

The difference between buffer and cache buffer is different from the object that the cache operates on.

Buffer is designed to increase the speed of data exchange between memory and hard disk (or other I/O devices).

The cache is designed to increase the speed of data exchange between the CPU and memory
, which is the usual first-level cache, level two cache, and level three cache. The instructions and read data used by the CPU in executing the program are for memory, which is obtained from memory. Due to the slow memory read and write, in order to improve the speed of data exchange between the CPU and memory, the cache is increased between the CPU and memory, it is faster than memory, but the cost is high, and because the CPU can not integrate too many integrated circuits, so the general cache is relatively small, After Intel and other companies in order to further improve the speed, but also increased the level two cache, or even the three cache, it is based on the local principle of the program design, is the CPU execution of instructions and access to the data is often in a certain piece of the concentration, so put this piece of content into the cache, The CPU does not have to access the memory, which increases the speed of access. Of course, if the cache does not have the content required by the CPU, or access to memory.

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. Linux has a daemon that periodically empties the buffered content (that is, writes to disk) or manually empties the buffer via the Sync command.

In a nutshell, buffer is about to be written to disk, and the cache is read from disk. Buffer is allocated by various processes and is used in areas such as input queues. A simple example is when 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 improves system performance.

The difference between buffer and cache

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.