Lab Assign 5
Lab Assign 5
Lab Assign 5
COMPUTER NETWORKS
KIRAN TRIPATHY
22BDS0172
Question 3 : Analyze the role of flow control and congestion control in TCP. Explain the
mechanisms TCP uses to avoid congestion, such as the slow start and congestion avoidance
algorithms.
Answer:
Flow Control and Congestion Control are two critical mechanisms in TCP
(Transmission Control Protocol) that ensure efficient and reliable data transmission
over the network.
1. Flow Control :
- The primary purpose of flow control is to prevent the sender from overwhelming
the receiver by sending more data than it can process or store.
- TCP achieves flow control through the use of a receiver window (often called the
receive window size ), which informs the sender how much buffer space is available at
the receiver. The sender adjusts its transmission rate to ensure it does not exceed the
receiver’s capacity.
2. Congestion Control :
- Congestion control aims to prevent the network itself from becoming overwhelmed,
as excessive data transmission can lead to packet loss, increased delays, and reduced
throughput. Unlike flow control, which is concerned with the capacity of the receiver,
congestion control focuses on the state of the entire network.
TCP implements a set of algorithms and mechanisms to detect and avoid congestion in
the network. The two key algorithms used for congestion control are Slow Start and
Congestion Avoidance . Together with additional mechanisms like Fast Retransmit
and Fast Recovery , these ensure that TCP can adapt to network conditions
dynamically.
1. Slow Start :
- The slow start algorithm is used to probe the network for available capacity in a
controlled manner, rather than sending a large burst of data all at once.
- When a new TCP connection is established or after a packet loss, the sender starts
with a congestion window (cwnd) of 1 Maximum Segment Size (MSS).
- For each acknowledgment (ACK) received, the congestion window is increased
exponentially (doubled) for each round-trip time (RTT). This continues until the slow
start threshold (ssthresh) is reached or packet loss is detected, signaling potential
congestion.
2. Congestion Avoidance :
- Once the congestion window reaches the slow start threshold (ssthresh), TCP
transitions to the congestion avoidance phase, where it increases the congestion
window more slowly to avoid overwhelming the network.
- Instead of exponential growth, the congestion window grows linearly by one MSS
for each RTT that passes without packet loss.
- This gradual increase allows TCP to cautiously probe for available bandwidth while
avoiding congestion.
Conclusion:
Flow control and congestion control in TCP work together to manage both the receiver's
capacity and the network's capacity. The flow control prevents overloading the
receiver, while congestion control prevents overloading the network, with TCP's slow
start, congestion avoidance, fast retransmit, and fast recovery being key mechanisms to
dynamically adjust to varying network conditions.