Open Naukri

Buffer Memory and the Difference in Buffer and Cache



What is Buffer Memory?

We know that speed of a processor is much higher than the speed of its attached input-output peripherals. So, most of the processor time is wasted being ideal while waiting for the IO peripherals to respond. To utilize the processor time properly we use buffer memory. A buffer is a temporary storage region, typically in RAM. The idea of the buffer was employed to prevent data congestion from an incoming port to an outgoing port of transfer. Most of the buffers are used for holding data to be forwarded to I/O devices and in the meantime CPU keeps on processing other requests or processes.  Since the processes of reading and writing data to a disk are comparatively slow, many programs track the data changes in a buffer and then this buffer data is copied to a disk.

Now, let us consider some examples where we see buffer memory being used.

What is a Cache?

Cache in computer science is defined as hardware or software which is used to hold data, temporarily. Cache is a high speed and expensive memory which can be a part of main memory or hard disk. Cache is used to improve the performance of a computer. To do so data or files which have been accessed or used frequently are stored temporarily in cache. We need cache because bulk memories such as RAM or hard disk have slow speed and cannot upkeep with demands of high speed clients such as the CPU, operating systems, applications or web browsers.  Thus, cache reduces the data access time and latency time thus improving the performance of I/O.

Difference between Buffer Memory and Cache

Both buffer memory and cache are memory spaces used to store data temporarily but there are many differences between them, such as:

Buffer Memory Cache Memory
The buffer memory is mainly located in Random Access Memory (RAM) of a computer. It is part of either main memory or hard disk
In this area CPU can store its data temporarily, like the data to be forwarded to other slow speed output devices or other secondary storage devices, to enable the computer to execute other processes. Information that is used and accessed by most of the programs while running is stored in cache to make them faster.
It is a normal storage area in dynamic RAM It is high-speed storage area of static RAM.
The buffer is normally used for input/output processes for sending or receiving data, for example, input from keyboard or output to printer. Cache is used to store data or files temporarily that are accessed frequently by processes
It stores or holds the actual copy of data. The cache holds the copy of original data.
It is implemented to match the speed of slow IO devices with processor. It is implemented to reduce the access time and improve the latency time of frequently used data.

Conclusion               

Both buffer memory and cache are memory spaces that are used to store data temporarily buffer being part of RAM and specifically dynamic RAM whereas cache is a high-speed memory which can be part of RAM (Static RAM) or hard disk and both buffer and cache have become an integral part of a computer system. Both of them aid in improving the speed of operations of the CPU. Think for a while what will happen if there is no buffer memory and cache?