Buffering in Distributed Operating System

Buffering in OS:

A ‘Buffer‘ is a temporary storage area. Generally, a buffer stores the data when the data transferred between two devices or one device and one application. Buffering is done for three reasons:
1. If the producer device is at a high speed, and the consumer device is at a low speed at that time buffering is required.
2. If two devices have different data transfer sizes (Block size), then buffering required.
3. A third use of buffering is to support copy semantics for an application I/O.

Types of Buffering in OS:

There are three types of buffering in Operating System:

    1. Single Buffering
    2. Double Buffering
    3. Circular Buffering

Single Buffering:

In Single Buffering, only one buffer is used to transfer the data between two devices. The producer produces one block of data into the buffer after that the consumer consumes the buffer, only when the buffer is empty, the processor again produces the data.

Single Buffering

Double Buffering:

In Double Buffering, two scheme two buffers are used in the place of one. In this scheme, the producer produces one buffer, and at the same time, the consumer consumes another buffer. So, the producer need not wait for filling the buffer.

Double Buffering

Circular Buffering:

When more than two buffers are used, the collection of buffers is itself referred to as a circular buffer. Each buffer is one unit in the circular buffer. The data transfer rate will increase using the circular buffer rather than the double buffering.

Circular Buffering