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.

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 Bache 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

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.