Flow Control in Computer Networks & Its Techniques Simplified
In a computer communication network, the sender sends the data, and the receiver receives it. But in a situation where the sender is sending the data or information at a speed higher than the receiver can receive and process, then the data will get lost. The flow control method will check that the senders send the data only at a speed suitable for the receiver.
In this, data can flow between computers or devices in a network so that it can be handled efficiently. If too much data arrives before a device can handle it, then it will cause an overflow, and the data will either be lost or must be retransmitted. Flow-control methods ensure that this doesn't happen.
What Is Flow Control In Computer Networks?
It is a set of procedures that tells the sender how much data can be transmitted before it overwhelms the receiver's system. A normal user's device usually has limited speed and memory, and it can't handle high volumes of data. Therefore, the receiving device must be able to inform the sending device to stop the transmission temporarily before the limits are reached. It requires a buffer- a block of memory for storing the information until they are processed.
Approaches to Flow Control In Computer Networks
Flow Control is classified into two categories:
- Feedback–based Flow Control: In this technique, the sender simply transmits the data to the receiver, and then the receiver transmits data back to the sender. It also allows the sender to transmit more amount of data as feedback, or tell the sender about how the receiver is processing the data.. This simply means that the sender can transmit the data or frames only after it has received acknowledgments from the user.
- Rate–based Flow Control: In this control technique, the sender sends or transfers the data at a speed that is faster than the receiver's capacity to receive it. When it happens, a built-in regulatory mechanism is initiated to optimize the data flow according to the user's capacity to receive. It happens automatically, without any feedback from the receiver.
To control the flow of data(flow control) across communication links, two methods have been developed :
- Stop and Wait Protocol
- Sliding Window Protocol
Stop-and-Wait Method Of Flow Control In Computer Networks
In this method, the sender waits for an acknowledgement after every frame it sends. When the acknowledgement is received, only then the next frame is sent. The process of alternately sending and waiting for a frame continues until the sender transmits the EOT (End of transmission) frame.
Explanation:
- In this method, the message or data is broken down into multiple frames first. After that, when the receiver indicates its readiness to start receiving, the first frame is transmitted. For each frame, the sender first seeks acknowledgement if the receiver is ready, and only then the transmission takes place.
- This process is continued until the sender has transmitted the EOT (End of Transmission) frame. In this method, only one frame can be in transmission at a time. It leads to high levels of inefficiency, i.e. less productivity if the propagation delay is longer than the transmission delay.
Transmission time(Td)
The time taken by the sender to send all the bits in a frame onto the wire is called transmission delay. This is calculated by dividing the data size(D) by the bandwidth(B) of the channel on which the data has to be sent.
Td = D / B
Propagation Delay(Tp)
The time taken by the last bit in a frame to reach from one side to the other is called propagation delay. It is calculated by dividing the distance between the sender and receiver by the wave propagation speed.
Tp = d / s ;
where d = distance between sender and receiver, s = wave propagation speed
The propagation delay for sending the data frame and the acknowledgement frame is the same as the distance, and the speed will remain the same for both frames. Hence, the total time required to send a frame is:
Total time= Td (Transmission Delay) + Tp (Propagation Delay for data frame) + Tp (Propagation Delay for acknowledgment frame)
The sender is doing work only for Td time, and for the rest 2Tp time, the sender is waiting for feedback.
Efficiency = Useful Time/ Total Time
η=Td / (Td+2Tp)
Advantage of Stop-and-wait
- This method is easy and simple, and each frame is checked and acknowledged before sending.
- It can also be used for noisy channels without any major issues
- This method is also very accurate, and there is very little risk of data loss
Disadvantage of Stop-and-wait
- The transmission is fairly slow and can be time-consuming
- Only one packet or frame can be sent at any point in time.
- There is low efficiency as constant feedback is needed after each step
Sliding Window Method Of Flow Control In Computer Networks
It is a method of flow control where a sender can transmit several frames before getting an acknowledgement. Multiple frames can be sent one after the other, and the capacity of the communication channel can be utilized efficiently. In this system, a single ACK acknowledges multiple frames and controls them accordingly.
Explanation
- Here, frames refer to imaginary boxes at both the sender's and receiver's end.
- The window can hold the frames at either end, and it provides the upper limit on the number of frames that can be transmitted before the acknowledgement.
- Frames can be acknowledged even when the window is not completely filled.
- The window has a specific size in which they are numbered as modulo-n means that they are numbered from 0 to n-1. For example, if n = 8, the frames are numbered from 0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1.
- The size of the window is represented as n-1. Therefore, a maximum of n-1 frames can be sent before acknowledgement.
- When the receiver sends the ACK, it includes the number of the next frame that it wants to receive. For example, to acknowledge the string of frames ending with frame number 4, the receiver will send the ACK containing the number 5. When the sender sees the ACK with the number 5, it gets to know that the frames from 0 to 4 have been received.
Sender Window
- At the beginning of a transmission, the sender window contains n-1 frames, and when they are sent out, the left boundary moves inward shrinking the size of the window. For example, suppose the size of the window is w if three frames are sent out, then the number of frames left out in the sender window is w-3.
- Once the ACK has arrived, then the sender window expands to the number which will be equal to the number of frames acknowledged by ACK.
- For example, the size of the window is 7, and if frames 0 through 4 have been sent out and no acknowledgement has arrived, then the sender window contains only two frames, i.e., 5 and 6. Now, if ACK arrives with number 4, it means that 0 through 3 frames have arrived undamaged and the sender window is expanded to include the next four frames. Now, the sender window contains six frames (5,6,7,0,1,2).
Receiver Window
- At the beginning of transmission, the receiver window does not contain n frames, but it contains n-1 spaces for frames.
- When the new frame arrives, the size of the window shrinks.
- The receiver window does not represent the number of frames received, but it represents the number of frames that can be received before an ACK is sent. For example, the size of the window is w, and if three frames are received, then the number of spaces available in the window is (w-3).
- Once the acknowledgement is sent, the receiver window expands by the number equal to the number of frames acknowledged.
- Suppose the size of the window is 7, then it means that the receiver window contains seven spaces for seven frames. If one frame is received, then the receiver window shrinks, and the boundary moves from 0 to 1. In this way, windows shrink one by one and will now contain six spaces. If frames from 0 through 4 have been sent, then the window contains two spaces before an acknowledgement is sent.
Advantages of Sliding Window
- It performs better than stop-and-wait flow control.
- This method is highly efficient
- Multiple frames can be sent one after another.
Disadvantages of Sliding Window
- The main issue is with the complexity as multiple frames are transferred.
- The receiver might receive data frames or packets out of sequence.
Purpose of Flow Control In Communication Network
In this process, the idea is to control the rate of data transmission between the two nodes. If the speed can't be controlled, then the data transmission process becomes very slow, and the receiver faces speed issues while receiving the data. To stop the overflow at the receiver's end, we use flow control techniques for data transmission.
Stop and wait sends one frame at a time, whereas the sliding window sends several.
Conclusion
As you can see, data flow can be controlled and regulated through the two techniques of flow control. For any advanced Computer Science student, this is an important topic with several practical applications. The idea is not just to mug up but to learn the hands-on applications of flow control in computer networks.
Read more articles related to Computer Science:
- Combinational Vs. Sequential Circuit: Understand the Difference Between Combinational and Sequential Circuit
- Difference Between C And Embedded C Decoded!
- Get a Job in Google, Apple And Meta With These Programming Languages
- 10 Best C++ IDEs That Developers Mention The Most!
- Top 18 Artificial Intelligence Project Ideas for 2022
Login to continue reading
And access exclusive content, personalized recommendations, and career-boosting opportunities.
Comments
Add comment