Advanced Computer Networks
Computer Networking: A Top-Down Approach (Kurose & Ross) - Chapter 3: Transport
Layer
Topics: Stop-and-Wait, Sliding Window, TCP Timers, TCP Congestion Control
Stop-and-Wait
Problem 1: In the Stop-and-Wait protocol, a sender transmits a packet and waits for an
acknowledgment before sending the next one. If the transmission time is 10 ms,
propagation delay is 20 ms, and ACK time is negligible, calculate the link utilization when
the packet size is 1000 bytes and the link rate is 1 Mbps.
Solution: Transmission time = 1000 bytes × 8 / 1 Mbps = 8 ms. Round-trip time (RTT)
= 2 × 20 ms = 40 ms. Utilization = 8 / (8 + 40) = 0.166 = 16.6%.
Problem 2: If a Stop-and-Wait sender times out after 60 ms without receiving an ACK, what
happens if the ACK is delayed by 70 ms?
Solution: The sender will retransmit the same packet after 60 ms, and when the
delayed ACK finally arrives, it will be discarded as it doesn’t match the expected
sequence number.
Problem 3: Explain how Stop-and-Wait ensures reliable data transfer even with lost
packets.
Solution: The sender uses sequence numbers and retransmissions after timeout.
Duplicate packets are detected by sequence numbers and ignored by the receiver.
Problem 4: If a link has 10% packet loss, explain the performance issue with Stop-and-Wait.
Solution: Since only one packet is in flight, each loss causes full retransmission delay.
Throughput drops significantly due to idle waiting times.
Problem 5: List one advantage and one disadvantage of Stop-and-Wait protocol.
Solution: Advantage: Simplicity. Disadvantage: Very low utilization on high-delay
networks.
Sliding Window
Problem 6: A Sliding Window protocol with window size = 4 and sequence numbers 0–7 is
used. If frames 0–3 are sent and ACK for frame 0 is lost, what will happen?
Solution: Sender will retransmit frame 0 after timeout even though receiver already
has it, but receiver will discard duplicates using sequence numbers.
Problem 7: For a window size of 3, show the range of frames that can be sent before an ACK
is received.
Solution: If base = 0, then frames 0, 1, 2 can be sent. Once ACK for 0 arrives, window
slides and allows frame 3.
Problem 8: Given RTT = 30 ms, transmission time per frame = 2 ms, and window size = 5,
compute channel utilization.
Solution: Utilization = (Window size × Frame transmission time) / (RTT + Frame
transmission time) = (5×2)/(30+2)=10/32=31.25%.
Problem 9: Explain the difference between Go-Back-N and Selective Repeat sliding window
protocols.
Solution: Go-Back-N retransmits all frames after a loss; Selective Repeat retransmits
only the lost ones, saving bandwidth.
Problem 10: Why does increasing window size improve performance in high-latency
networks?
Solution: Larger window keeps more packets in flight, reducing idle time and
increasing throughput despite high RTT.
TCP Timers
Problem 11: What is the purpose of the TCP Retransmission Timeout (RTO) timer?
Solution: It defines how long TCP waits for an ACK before retransmitting a packet.
Problem 12: If EstimatedRTT = 100 ms and DevRTT = 20 ms, calculate RTO using RTO =
EstimatedRTT + 4 × DevRTT.
Solution: RTO = 100 + 4×20 = 180 ms.
Problem 13: Why does TCP use adaptive timeout instead of fixed timeout?
Solution: Because network delays vary; adaptive timers adjust to avoid unnecessary
retransmissions or delays.
Problem 14: Explain how TCP handles delayed ACKs with its timer mechanism.
Solution: TCP’s timer ensures that even with delayed ACKs, retransmission happens if
ACK doesn’t arrive before timeout, ensuring reliability.
Problem 15: What happens when TCP detects packet loss through triple duplicate ACKs?
Solution: TCP performs a fast retransmission and reduces the congestion window size
without waiting for the timer to expire.
TCP Congestion Control
Problem 16: What is the initial congestion window (cwnd) in TCP typically set to?
Solution: Usually 1–10 MSS depending on implementation; traditionally 1 MSS.
Problem 17: Describe the phases of TCP congestion control.
Solution: Phases: Slow Start → Congestion Avoidance → Fast Retransmit → Fast
Recovery.
Problem 18: If TCP’s cwnd doubles every RTT during slow start, how many RTTs until cwnd
= 16 MSS starting from 1 MSS?
Solution: 1→2→4→8→16 → after 4 RTTs.
Problem 19: During congestion avoidance, cwnd increases linearly. If cwnd = 10 MSS, what
is the new cwnd after one RTT with all ACKs received?
Solution: Increase by 1 MSS per RTT, so cwnd = 11 MSS.
Problem 20: Explain why TCP reduces cwnd by half after packet loss.
Solution: Halving cwnd reduces sending rate to prevent further congestion and
stabilize the network.
What is TCP Congestion Control?
Imagine you are pouring water into a pipe (the network).
If you pour too fast, the pipe will overflow (that’s congestion).
If you pour too slowly, it will take forever to fill (that’s inefficient).
So, TCP’s job is to find the right speed to send data:
Not too fast (to avoid congestion)
Not too slow (to keep good performance)
⚙️ How TCP Controls Congestion
TCP uses a variable called cwnd (Congestion Window) —
it represents how many packets (segments) the sender can send at once before waiting
for acknowledgments (ACKs).
TCP keeps adjusting this window based on how the network behaves:
If the network seems fine → increase cwnd (send faster)
If packets are lost → decrease cwnd (slow down)
⚙️ The Four Main Phases
Let’s explain it like a simple story:
1️⃣ Slow Start
When a TCP connection begins, it doesn’t know how much the network can handle.
So it starts slowly, usually with a small window (like 1 MSS).
Each time it receives ACKs (which means packets arrived safely),
it doubles the window size — this makes growth very fast:
1 → 2 → 4 → 8 → 16 ...
This continues until TCP reaches a threshold ( ssthresh) or detects packet loss.
2️⃣ Congestion Avoidance
Once cwnd reaches that threshold, TCP becomes more careful.
It stops doubling and instead increases linearly —
for example, by +1 MSS per RTT:
10 → 11 → 12 → 13 ...
This prevents sudden overload on the network.
3️⃣ Fast Retransmit
If TCP notices three duplicate ACKs (meaning the receiver got out-of-order packets),
it assumes one packet was lost and resends it immediately,
without waiting for a timeout.
4️⃣ Fast Recovery
After detecting packet loss, TCP assumes the network is congested.
So it cuts cwnd in half to reduce the sending rate,
then slowly increases again if the connection becomes stable.
⚙️ Analogy: Driving a Car in Traffic
Think of it like driving:
At first, you start slowly (slow start).
When the road seems clear, you speed up carefully (congestion avoidance).
If you see heavy traffic, you slow down quickly (fast recovery).
Once traffic clears, you speed up again slowly.
⚙️ The Main Goal
TCP wants to:
Use the maximum possible speed,
Avoid congestion, and
Recover quickly when congestion happens.