Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between buffer and cache in linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail "what are the differences between buffer and cache in linux", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the difference between buffer and cache in linux" can help you solve your doubts.

Differences: 1, buffer refers to the buffer, while cache refers to the cache area; 2, Buffer is used to speed up the data "written" to the hard disk, while cache is used to speed up the data "read" from the hard disk; 3, buffer can reduce the waiting time for inter-process communication, and Cache can reduce the waiting time for CPU.

The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Buffer in linux (buffer)

Buffer: buffer used to store data transfer between devices whose speeds are out of sync or between devices with different priorities Through buffer, the waiting time for inter-process communication can be reduced. When the device with fast storage speed communicates with the device with slow storage speed, the data with slow storage speed is first stored in buffer, and to a certain extent, the device with fast storage speed reads the data from buffer. During this period, the device with fast storage speed, CPU, can do other things.

Buffer: generally used for writing to disk, for example, a process requires multiple fields to be read, and when all the required fields are read in, the fields that have been read before will be put into the buffer first.

Cache (cache area) in linux

Cache: cache area, is a cache, is a small but fast memory located between CPU and main memory, because the speed of CPU is much higher than that of main memory, CPU needs to wait a long time to read data from memory, while Cache keeps the data just used by CPU or part of the data that is recycled, so it is faster to read data from Cache, which reduces the waiting time of CPU and improves the performance of the system.

Cache is not for caching files, but for caching blocks (blocks are the smallest read and write units for Cache); Cache is generally used in Imax O requests. If multiple processes want to access a file, they can read the file into Cache, so that the next process acquires control of CPU and accesses the file to read directly from Cache, which improves system performance.

The difference between buffer and cache:

Cache means that when reading the data in the hard disk, the most commonly used data is saved in the cache area of memory. When the data is read again, it is not read in the hard disk, but in the cache.

Buffer is when writing data to the hard disk, first put the data into the buffer, and then write to the hard disk together, centralize the scattered write operations, reduce disk fragments and repeated searching of the hard disk, so as to improve the performance of the system.

To put it simply, cache is used to accelerate the "reading" of data from the hard disk, while buffer is used to speed up the "writing" of data to the hard disk.

After reading this, the article "what is the difference between buffer and cache in linux" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report