Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buffer and cache Difference?

Can anybody detail - What is the difference between Buffer and Cache in system memory?

like image 680
Dhiva Avatar asked Jul 07 '10 07:07

Dhiva


People also ask

Is buffer a type of cache?

Buffer is a part of the primary memory. They are structures present and accessed from the primary memory (RAM). On the other hand, cache is a separate physical memory in a computer's memory hierarchy. Buffer is also sometimes called as - Buffer cache.

Is buffer size the same as cache?

1. Cache is a high-speed storage area while a buffer is a normal storage area on ram for temporary storage.

What is buffers and cache in Linux memory?

Buffers are the disk block representation of the data that is stored under the page cache. In addition, the buffer contains the metadata of the files or data which resides under the page cache. On the other hand, a cache is a temporary storage area to store frequently accessed data for rapid access.

What is the difference between buffer and memory?

Memory is a storage space where instructions and data, regarding programs, are stored. Buffer and stack both are the small section of the memory. Buffer stores data temporarily while execution of the program.


2 Answers

A buffer is a contemporary collection of location where a huge amount of data is managed or disassembled. This may be basic for interaction with a set of collection device that needs huge blocks of information, or when data must be given in a many way than that in which it is made, or rarely considerable when less blocks are not sufficient. The advantage is here even if the buffered data are stored to the buffer in one time and get from the buffer once.

A cache, on the other side, thinks that the data will be get from the cache more one time than they are written on them. Its aim is to less the accesses to the underlying stock. Buffer is a programmable cache managed by the operating system in the main storage and is used to have the most necessary data from disk, so that they don't have to be gotten again from the memory. This feature is available by the operating system. While cache is in real a hardware that the CPU uses to reduced the effective memory access time.

like image 36
Martin Fabik Avatar answered Oct 24 '22 12:10

Martin Fabik


A buffer is just a container to hold data for a short period of time when more comes in at any given time than a consumer can use / process. It's a first-in, first-out situation - the data comes in, might be buffered, and goes out in the same order it came in, after a while.

A cache is a storage for speeding up certain operations. Things get put in a cache, and should be retrieved from it multiple times, over and over again. There's no "flowing through the cache" kind of mechanism - data doesn't come in and go out in the same order - but it's just a holding container. The order might be anything, really - items are addressed via a key, they don't "flow through" but they are "put in" and stay there (until they're thrown out because of not being used, or because the system goes down).

like image 162
marc_s Avatar answered Oct 24 '22 11:10

marc_s