Difference between Buffering and Caching in OS
Both the term buffering and caching is related to storage and then access of data, but there are some key difference that makes them different. First let’s see what both these term means and after that we will see the differences.
1. Buffering :
In computer system when the speed in which data is received and the speed in which data is processed are different, then there we use the buffer. Buffer is a memory space which stores the input data and pass it on to the system according to this speed in this way there is no need to hold the input device until it is processed. simply the data will be stored in buffer and the used by the system. The buffer can be of any type, hardware or software, but in general software buffer are used widely.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Example – In printers spoolers, we can pass a large no of pages to print as input, but the processing/printing is slow. Here buffering is used.
2. Caching :
Caching is storing data in a separate disk (very fast speed disk). The data which is to be used many times results in wastage of time if it is in hard disk, but storing the data in cache reduces this time wastage.
Example – Cache is used in system to speed up the access of data frequently used.
Difference between buffering and caching :
BASIS BUFFERING CACHING Basic Buffer stores data till it is processed Caching fastens the data access speed of repeatedly used data Storage Buffer stores original data Cache stores copy of the data. Location Buffer is a memory space in ram Cache is in processor, and can be also implemented with ram and disk. Type Buffer can be hardware as well as software buffer. Cache is a fast disk and hence it is hardware. Policy First in First out Least recently used Behavior Buffer is in block sizes like 4, 8, 16 so on, i.e, reading a single character will be same as reading the whole block Read and write is same as the normal storage