Reliability Mechanisms

[!NOTE] This module explores the core principles of Reliability Mechanisms, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.

1. How is TCP “Reliable”?

Reliability means the receiver gets exactly what the sender sent, in the correct order, without duplicates. TCP achieves this through four main mechanisms:

2. Error Detection (Checksum)

Every TCP segment includes a 16-bit checksum.

  • It covers the Header, the Data, and a “Pseudo-header” (which includes the Source/Dest IP addresses from Layer 3).
  • If the checksum fails, the segment is silently dropped.

3. Retransmission Timers

When a sender sends a segment, it starts a timer.

  • RTO (Retransmission TimeOut): If an ACK is not received before the timer expires, the sender resends the segment.
  • Rtt (Round Trip Time): The RTO is dynamic. TCP measures how long ACKs take to return and adjusts the timer accordingly.

4. Cumulative ACKs

TCP ACKs are “Cumulative.”

  • If a receiver sends ACK 1001, it means “I have received everything up to byte 1000, and I am ready for 1001.”
  • This is robust: if ACK 500 is lost but ACK 1000 arrives, the sender knows all 1000 bytes were received.

5. Selective Acknowledgement (SACK)

A modern extension to TCP.

  • If bytes 1-1000 and 2001-3000 arrive, but 1001-2000 is lost, a standard TCP ACK would keep asking for ACK 1001.
  • SACK allows the receiver to say: “I’m still missing 1001, but I already have 2001-3000. Don’t resend those!”

6. Interactive: The Lost Segment

Watch a retransmission occur.

Sender
Timer: OFF
SEQ 1
Receiver
Waiting...

7. The Ordering Guarantee

If segments arrive as SEQ 1, SEQ 3, SEQ 2, the receiver’s TCP stack holds 1 and 3 in the buffer. It does not give the data to the Application until SEQ 2 arrives and the stream is contiguous.