In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the example analysis of buffer and cache in linux. I hope you will get something after reading this article. Let's discuss it together.
The difference between Buffer and Cache is that buffer and cache operate on different objects.
Buffer (buffering) is designed to increase the speed of data exchange between memory and hard disk (or other Imax O devices).
Cache (cache) is designed to improve the speed of data exchange between cpu and memory, that is, the first-level cache, the second-level cache and the third-level cache. The instructions and read data used by cpu to execute the program are aimed at memory, that is, they are obtained from memory. Because the reading and writing speed of memory is slow, in order to improve the speed of data exchange between cpu and memory, cache is added between cpu and memory, which is faster than memory, but the cost is high, and because too many integrated circuits cannot be integrated in cpu, the cache is generally small. In order to further improve the speed, companies such as intel have added a second-level cache or even a third-level cache, which is designed according to the principle of locality of the program. That is, the instructions executed by cpu and the data accessed are often in a certain part of the set, so after putting this piece of content into cache, cpu no longer has to access memory, which improves the access speed. Of course, if you don't have what cpu needs in cache, you still have to access memory.
Buffers is designed according to the read and write of the disk, which centralizes the decentralized write operations to reduce disk fragmentation and repeated search of the hard disk, so as to improve system performance. Linux has a daemon that periodically clears the contents of the buffer (that is, writes to disk), or you can clear the buffer manually with the sync command.
To put it simply, buffer is about to be written to disk, while cache is read from disk. Buffer is allocated by various processes and is used in areas such as input queues. A simple example is that a process requires multiple fields to be read in, and the process saves the previously read fields in the buffer before all the fields are read completely.
Cache is often used in disk IUnip O requests. If multiple processes want to access a file, the file is made into cache to facilitate next access, which can improve system performance.
After reading this article, I believe you have some understanding of "sample Analysis of buffer and cache in linux". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.