Bird
Raised Fist0
Computer Networksknowledge~6 mins

TCP congestion control in Computer Networks - Full Explanation

Choose your learning style10 modes available
Introduction
Imagine a busy highway where too many cars try to pass at once, causing traffic jams and slow movement. Networks face a similar problem when too much data is sent at the same time, leading to delays and lost information. TCP congestion control is the way computers manage this traffic to keep data flowing smoothly without overwhelming the network.
Explanation
Congestion Window (cwnd)
The congestion window is a limit set by the sender on how much data can be sent before waiting for an acknowledgment. It changes dynamically based on network conditions to avoid overwhelming the path between sender and receiver. When the network is clear, the window grows to allow more data; when congestion is detected, it shrinks to reduce traffic.
The congestion window controls the amount of data sent to prevent network overload.
Slow Start
Slow start is the initial phase where TCP begins sending data cautiously with a small congestion window. It increases the window size exponentially with each acknowledgment received, quickly probing the network capacity. This helps find the available bandwidth without causing sudden congestion.
Slow start rapidly increases data flow from a small base to find network capacity safely.
Congestion Avoidance
After slow start, TCP enters congestion avoidance to increase the congestion window more slowly, usually linearly. This cautious growth helps maintain stable data flow and prevents sudden congestion by carefully testing the network limits. It balances sending enough data while avoiding overload.
Congestion avoidance grows data flow steadily to maintain network stability.
Fast Retransmit and Fast Recovery
When TCP detects lost packets through duplicate acknowledgments, it quickly retransmits the missing data without waiting for a timeout (fast retransmit). Then, it reduces the congestion window but avoids going back to slow start by entering fast recovery, allowing data flow to continue smoothly. This speeds up recovery from packet loss.
Fast retransmit and recovery quickly fix lost data and keep traffic flowing.
Timeout and Window Reduction
If acknowledgments are not received in time, TCP assumes severe congestion and drastically reduces the congestion window, often resetting it to one segment. This forces the sender to slow down significantly and restart slow start to avoid worsening the congestion. It acts as a safety mechanism for heavy network traffic.
Timeout triggers a sharp slowdown to protect the network from heavy congestion.
Real World Analogy

Imagine a group of people trying to cross a narrow bridge. At first, only one person crosses to test if the bridge can hold more. If it holds well, more people cross quickly. But if the bridge starts shaking, fewer people cross at a time, and if it shakes badly, everyone stops and waits before trying again.

Congestion Window (cwnd) → The number of people allowed on the bridge at once
Slow Start → Starting with one person and quickly letting more cross as the bridge holds
Congestion Avoidance → Carefully adding people one by one to avoid shaking the bridge
Fast Retransmit and Fast Recovery → Quickly helping a person who slipped and letting others continue crossing
Timeout and Window Reduction → Stopping everyone when the bridge shakes badly and starting over slowly
Diagram
Diagram
┌───────────────────────────────┐
│          TCP Sender            │
│                               │
│  ┌───────────────┐            │
│  │ Congestion    │            │
│  │ Window (cwnd) │◄───────────┤
│  └───────────────┘            │
│         │                     │
│         ▼                     │
│  ┌───────────────┐            │
│  │ Slow Start    │            │
│  └───────────────┘            │
│         │                     │
│         ▼                     │
│  ┌───────────────┐            │
│  │ Congestion    │            │
│  │ Avoidance     │            │
│  └───────────────┘            │
│         │                     │
│         ▼                     │
│  ┌───────────────┐            │
│  │ Fast Retrans- │            │
│  │ mit & Recovery│            │
│  └───────────────┘            │
│         │                     │
│         ▼                     │
│  ┌───────────────┐            │
│  │ Timeout &     │            │
│  │ Window Reduce │            │
│  └───────────────┘            │
└─────────┬─────────────────────┘
          │
          ▼
┌───────────────────────────────┐
│          Network               │
│  (Data packets and ACKs flow) │
└───────────────────────────────┘
This diagram shows the TCP sender's congestion control phases and how the congestion window guides data flow through the network.
Key Facts
Congestion Window (cwnd) → A dynamic limit on the amount of data TCP can send before receiving acknowledgments.
Slow Start → TCP phase where the congestion window grows exponentially to quickly find network capacity.
Congestion Avoidance → TCP phase where the congestion window grows linearly to maintain stable data flow.
Fast Retransmit → TCP mechanism to resend lost packets quickly upon detecting duplicate acknowledgments.
Timeout → Event when TCP stops and reduces sending rate drastically due to missing acknowledgments.
Common Confusions
Believing slow start means TCP always sends data slowly.
Believing slow start means TCP always sends data slowly. Slow start begins cautiously but quickly increases sending rate exponentially to find available bandwidth.
Thinking congestion window size is fixed.
Thinking congestion window size is fixed. The congestion window changes dynamically based on network feedback to avoid congestion.
Assuming packet loss always means network failure.
Assuming packet loss always means network failure. Packet loss often signals congestion, prompting TCP to reduce sending rate to help the network recover.
Summary
TCP congestion control manages data flow to prevent network overload and packet loss.
It uses phases like slow start and congestion avoidance to adjust sending rates based on network feedback.
Fast retransmit and timeout mechanisms help recover from lost packets and maintain smooth communication.

Practice

(1/5)
1. What is the main purpose of TCP congestion control in computer networks?
easy
A. To prevent network overload by adjusting data sending rates
B. To encrypt data packets for security
C. To assign IP addresses to devices
D. To increase the size of data packets

Solution

  1. Step 1: Understand TCP congestion control role

    TCP congestion control manages how much data is sent to avoid overwhelming the network.
  2. Step 2: Compare options with this role

    Only To prevent network overload by adjusting data sending rates describes adjusting sending rates to prevent overload, matching the purpose.
  3. Final Answer:

    To prevent network overload by adjusting data sending rates -> Option A
  4. Quick Check:

    TCP congestion control = prevent overload [OK]
Hint: Focus on network traffic management, not security or addressing [OK]
Common Mistakes:
  • Confusing congestion control with encryption
  • Thinking it assigns IP addresses
  • Believing it increases packet size
2. Which of the following is a correct description of the TCP Slow Start algorithm?
easy
A. It ignores network feedback and sends data at a fixed rate
B. It immediately sends the maximum possible data to the network
C. It decreases the data sending rate after every packet sent
D. It gradually increases the data sending rate to avoid congestion

Solution

  1. Step 1: Recall Slow Start behavior

    Slow Start begins with a low sending rate and increases it gradually to detect network capacity.
  2. Step 2: Match options to this behavior

    It gradually increases the data sending rate to avoid congestion correctly states the gradual increase to avoid congestion, unlike others.
  3. Final Answer:

    It gradually increases the data sending rate to avoid congestion -> Option D
  4. Quick Check:

    Slow Start = gradual increase [OK]
Hint: Slow Start means start slow, then speed up carefully [OK]
Common Mistakes:
  • Thinking Slow Start sends max data immediately
  • Believing it decreases rate after each packet
  • Assuming it ignores network feedback
3. Consider this simplified TCP congestion window size sequence during Slow Start: it starts at 1, then doubles each round (1, 2, 4, 8, ...). What will be the window size after 4 rounds?
medium
A. 16
B. 8
C. 4
D. 32

Solution

  1. Step 1: Understand doubling pattern

    The window size doubles each round: start at 1, then 2, 4, 8, 16...
  2. Step 2: Calculate after 4 rounds

    Start (0 rounds): 1, After 1st round: 2, 2nd: 4, 3rd: 8, 4th: 16.
  3. Final Answer:

    16 -> Option A
  4. Quick Check:

    1x2⁴ = 16 [OK]
Hint: Double window size each round; 2^4 = 16 [OK]
Common Mistakes:
  • Counting rounds incorrectly (off by one)
  • Choosing 8 instead of 16
  • Confusing doubling with adding
4. A TCP connection uses Slow Start but never reduces its congestion window size after packet loss. What problem will most likely occur?
medium
A. The connection will send data too slowly
B. The connection will close immediately
C. The connection will ignore congestion and cause network overload
D. The connection will encrypt data incorrectly

Solution

  1. Step 1: Understand congestion window reduction role

    Reducing window size after packet loss helps avoid network overload by slowing sending rate.
  2. Step 2: Analyze effect of not reducing window

    If window size never reduces, the sender keeps sending too much data, causing congestion and overload.
  3. Final Answer:

    The connection will ignore congestion and cause network overload -> Option C
  4. Quick Check:

    No window reduction = overload risk [OK]
Hint: Always reduce window on loss to prevent overload [OK]
Common Mistakes:
  • Thinking it causes slow sending
  • Assuming connection closes automatically
  • Confusing congestion control with encryption
5. In a network with frequent packet loss, which TCP congestion control strategy best balances throughput and congestion avoidance?
hard
A. Use Slow Start only, ignoring packet loss
B. Use Fast Retransmit and Fast Recovery to quickly recover from losses
C. Send data at maximum rate regardless of network state
D. Disable congestion control to improve speed

Solution

  1. Step 1: Identify strategies for packet loss

    Fast Retransmit and Fast Recovery help detect and recover from packet loss quickly without restarting Slow Start.
  2. Step 2: Evaluate options for balancing throughput and congestion

    Use Fast Retransmit and Fast Recovery to quickly recover from losses uses these algorithms to maintain good speed while avoiding overload, unlike others that ignore loss or disable control.
  3. Final Answer:

    Use Fast Retransmit and Fast Recovery to quickly recover from losses -> Option B
  4. Quick Check:

    Fast Retransmit + Recovery = balance throughput & avoid congestion [OK]
Hint: Fast Retransmit + Recovery handle loss efficiently [OK]
Common Mistakes:
  • Ignoring packet loss effects
  • Assuming max rate always best
  • Disabling congestion control harms network
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard