![]() |
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. Types of Buffering in OSThere are mainly three types of Buffering that are used in OS:
Single BufferingThis is the simplest type of Buffering where only one system buffer is allocated by the Operating System for the system to work with. The producer(I/O device) produces only one block of data in the buffer for the consumer to receive. After one complete transaction of one block of data, the buffer memory again produces the buffer data. Double BufferingThis is an upgrade over Single Buffering as instead of using one buffer data here two are used. The working of this is similar to the previous one, the difference is that the data is first moved to the first buffer then it is moved to the second buffer. Then retrieved by the consumer end. Here on one hand the data is inserted into one buffer while the data in the other buffer is processed into the other one. Circular BufferingDouble Buffering is upgraded to this, in this process more than two buffers are used. The mechanism which was used earlier is a bit enhanced here, where one buffer is used to insert the data while the next one of it used to process the data that was earlier inserted. This chain of processing is done until the last buffer in the queue and then the data is retrieved from the last buffer by the consumer. This mechanism is used where we need faster data transfers and more bulky data is transferred. Function of Buffering in OS
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:
Advantages of Buffering
Disadvantages of Buffering
FAQs on Buffering in OS1. What is the importance of Buffering in OS?
2. Can Buffering influence the performance of the system in any way?
3. How does Buffering manage the difference in speed between the Devices and the CPU?
4. Does buffering improve operating system data reliability?
|
Reffered: https://www.geeksforgeeks.org
Operating Systems |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 17 |