The relationship between hard disk, buffer, memory, cache, cpu

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

Insert picture description here

Cache is mainly designed for read operations, but the concept of Cache may be confusing. I understand that the CPU itself has Cache, including the first level cache, the second level cache, and the third level cache. We know that all the instruction operations of the CPU are connected to the memory. , And the processing power of the CPU is much higher than the memory speed, so in order to prevent the CPU resources from being idle, Intel and other companies have integrated some Cache inside the CPU, but after all, you can’t put too many circuits in it, so this part of the Cache is not very large. It is mainly used to store some commonly used instructions and commonly used data. The real most Cache data should occupy memory space to cache the requested data, that is, the Cache part above

Buffer is mainly designed for write operations. More specifically, it is designed for write operations between memory and hard disk. The purpose is to centralize write operations, reduce disk fragmentation and hard disk repeated addressing processes, and improve performance.

There is a daemon process inside the Linux system that periodically clears the contents of the Buffer and writes it to the hard disk. The above operation will also be triggered when the sync command is manually executed.

Guess you like

Origin blog.csdn.net/lianshaohua/article/details/111033775