HACKER Q&A
📣 boppo1

What's the difference between a cache and a buffer?


Is it a physical hardware difference? Is it just a convention? I haven't read 'What every programmer should know about memory' yet, but I've read K&R and Stroustrup's principles, and while that lifted the curtain on a lot of things for me, this one is still elusive.


  👤 db48x Accepted Answer ✓
In what context? What cache(s) and what buffer(s) are you talking about?

👤 greenbit
A buffer is just a logical place in the address space, whereas a cache is a physical device that uses a relatively small amount of fast but costly technology to allow a much larger amount of cheaper, slower memory to just seem faster. I say "seem", because the trick only works by taking advantage of locality of reference