Why TCP provides reliable delivery in Computer Networks - Performance Analysis
We want to understand how the time cost of TCP's reliable delivery grows as more data is sent.
Specifically, how does TCP handle sending many packets reliably over a network?
Analyze the time complexity of this simplified TCP sending process.
for each packet in data_to_send:
send(packet)
wait for acknowledgment
if acknowledgment not received:
resend(packet)
else:
move to next packet
This code shows TCP sending packets one by one, waiting for confirmation before moving on.
Look for repeated actions in the process.
- Primary operation: Sending each packet and waiting for its acknowledgment.
- How many times: Once per packet, but possibly more if resending is needed due to lost packets.
As the amount of data (number of packets) increases, the number of send and wait steps grows roughly in proportion.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 packets | About 10 sends and waits (plus some resends if needed) |
| 100 packets | About 100 sends and waits (plus resends) |
| 1000 packets | About 1000 sends and waits (plus resends) |
Pattern observation: The time grows roughly linearly with the number of packets sent.
Time Complexity: O(n)
This means the time to reliably send data grows directly with how many packets there are.
[X] Wrong: "TCP sends all packets at once and waits only once for all acknowledgments."
[OK] Correct: TCP sends packets in order and waits for acknowledgments to ensure each packet arrived, so it handles each packet step-by-step, not all at once.
Understanding how TCP manages reliable delivery helps you explain real network behavior clearly and shows you can think about how systems handle growing workloads.
"What if TCP sent multiple packets before waiting for acknowledgments? How would that affect the time complexity?"