I know that the cache is used to store data so that future requests for that data can be served faster. Normally we have three level cache: L1, L2 and L3 in the current computer architecture. We can see the cache hardware.

enter image description here

Also, I've heard about the buffer, which is used to arrange the IO stream. But I don't know which hardware is used by the buffer. Is it simply the memory?

For example, in Linux system, free -m can show me the usage of cache/buff:

enter image description here

If I'm right, the buff/cache shows the size of cache + the size of buffer. So the size of cache comes from the L1, L2 and L3 cache, right? But what about the size of buffer? Which hardware is used by the buffer?

  • 4
    None of your last paragraph is correct. – Michael Homer Sep 27 '19 at 9:15
  • 5
    "Cache" is used for lots of different components. free shows you the disk cache, which is just normal RAM. Your picture shows CPU cache. There are hundreds of other kinds of caches in various application programs (and in the kernel as well). – dirkt Sep 27 '19 at 12:04

You're confusing two concepts here. The L1/2/3 caches are managed by the processor (that is, the hardware and its firmware/microcode) itself, the kernel (usually) has no control over them. The cache and buffer that free is referring to are managed by the kernel, and are located in RAM. However parts of it may be found in the processor caches, but that doesn't matter for the OS functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.