Open In App

Buffering in Computer Network

Last Updated : 15 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Buffer is a region of memory used to temporarily hold data while it is being moved from one place to another. A buffer is used when moving data between processes within a computer. Majority of buffers are implemented in software. Buffers are generally used when there is a difference between the rate at which data is received and the rate at which it can be processed. If we remove buffers, then either we will have data loss, or we will have lower bandwidth utilization.

What is Buffering ? In Buffering, Whether the communication is direct or indirect, message exchanged by communicating processes reside in a temporary queue. Buffering is typically used to manage data flow between devices and helps regulate the rate of data transfer. The buffer allows the sender to transmit data at a faster rate while the receiver processes the data at its own pace.

Types of Buffering :

  1. Zero Capacity – This queue cannot keep any message waiting in it. Thus it has maximum length 0. For this, a sending process must be blocked until the receiving process receives the message. It is also known as no buffering.
  2. Bounded Capacity – This queue has finite length n. Thus it can have n messages waiting in it. If the queue is not full, new message can be placed in the queue, and a sending process is not blocked. It is also known as automatic buffering.
  3. Unbounded Capacity – This queue has infinite length. Thus any number of messages can wait in it. In such a system, a sending process is never blocked.

Need of Buffering :

  • It helps in matching speed between two devices, between which the data is transmitted. For example, a hard disk has to store the file received from the modem.
  • It helps the devices with different data transfer size to get adapted to each other.
  • It helps devices to manipulate data before sending or receiving.
  • It also supports copy semantics.

How buffering works:

When a device receives a data packet, it first checks to see if there is enough space in its input buffer to store the packet. If there is not enough space, the packet may be dropped or lost, leading to performance issues.

Assuming there is enough space in the input buffer, the packet is stored temporarily until it can be processed or forwarded to its destination. The device may also apply certain policies or rules to the packet, such as quality of service (QoS) rules, before forwarding it.

Output buffering works in a similar way, with packets being stored temporarily in a buffer until they can be transmitted to their destination. In this case, the buffer ensures that packets are transmitted in the correct order and without delay.

Buffering provides several advantages, such as:

  • Regulating data flow between devices
  • Allowing the sender to transmit data at a faster rate
  • Preventing lost data due to network congestion

 some disadvantages, such as:

  • Increased latency due to the time it takes to store and retrieve data from the buffer
  • Increased memory usage due to the buffer’s storage requirements

Buffer Overflow and Underflow :

Buffer overflow occurs when more data is sent to a buffer than it can handle, leading to data loss or corruption. Buffer underflow occurs when there is not enough data in the buffer, leading to a delay in data transfer.

Buffering in Streaming Services:

Buffering is a critical component of streaming services, such as Netflix and YouTube. When you stream a video, the data is transmitted in packets and stored in a buffer before being displayed on your screen. Buffering ensures that the video plays


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads