How Buffering in OS works?
The different types of Buffering work a little differently as explained in brief earlier, but the baseline working is the same in all the types. This work is given further:
- The operating system starts with allocating memory for creating the Buffers which can be one or more, the size of each one depends on requirements.
- Then the data which is read from the input device is stored in the buffer, as the buffer act as the intermediate stage between the sender and receiver.
- The details of all the buffers that are present in the operating system, details include information like the amount of data stored in the buffer, etc. This information helps the Operating system to manage all the buffers.
- The data is processed and retrieved by the CPU, using this technique the CPU works independently and improves the device’s speed. This process helps in the Asynchronous functioning of the CPU in the device.
- Then the Data in the Buffer is Flushed i.e., it is deleted and the memory is freed. The temporary memory space is further used.
Buffering in OS
In Operating Systems I/O operations are one of the most fundamental tasks that is needed to be carried out correctly and with the utmost efficiency. One of the techniques that we can use to ensure the utmost efficiency of the I/O Operations is Buffering. So, Buffering is a process in which the data is stored in a buffer or cache, which makes this stored data more accessible than the original source. Buffer is an area in memory that is used to hold the data that is being transmitted from one place to another and store the data temporarily.
There are a number of data storage devices that are used in a system, like Hard Disks, network devices, pen drives, etc. So, there might be some waiting time faced by the processes or applications that are attempting to access that data from the storage devices. This problem is mainly caused when the devices from where device is slow or have low latency.
This problem is significantly solved using Buffering, as in this process the buffer acts as an intermediate between the storage device and the processes/applications. In this process, the data is already transferred to the Buffer so the data retrieval can be done from it which significantly reduces the waiting time and hence improves the performance of the system.