Reliable data transfer: stop-and-wait, Go-Back-N and Selective Repeat

A sender sends packets over a channel that can lose them, corrupt them or delay them; the receiver must deliver the data once and in order. Click on any packet or ACK of the diagram to lose it and watch how each protocol recovers.

Scenario

Protocol

Stop-and-wait
Pipelined

Parameters

Extension (not covered in class): window and sequence numbers

Incidents in the channel

Click (or Enter) on a packet or an ACK of the diagram: lost ✕ → bit errors ⚡ → delayed ⏱ → normal. Each incident affects only that transmission; retransmissions go through unless you click on them too.

    Mode

    Practice

    A random protocol with one or two incidents, in prediction mode.

    View

    Space-time diagram · time runs downwards, in units of L/R

    Sender utilization with pipelining · U = N·(L/R) / (RTT + L/R), at most 1

    Events

    Model assumptions
    • Time is measured in units of L/R, the transmission time of a data packet. The propagation delay is the same in both directions, so RTT = 2·(propagation delay). ACKs are small: their transmission time is negligible and they travel in the opposite direction, which does not compete with the data.
    • Sender and receiver only see sequence numbers modulo 2^k (pkt0, pkt1…). dN is the N-th piece of data from the application: it is shown only when sequence numbers repeat, to see which data each packet carries.
    • Stop-and-wait is rdt3.0 (alternating bit): k = 1 and N = 1. The receiver of rdt3.0 and GBN sends, for anything that is not the expected packet, the ACK of the last one received in order; a corrupted ACK or one that acknowledges nothing new is ignored by the sender.
    • rdt2.0, rdt2.1 and rdt2.2 assume a channel with bit errors but no losses: there is no timer and the sender waits for the receiver’s reply to each packet. In rdt2.0 and rdt2.1 the reply is an ACK or a NAK without a sequence number; if it arrives corrupted, the sender cannot tell which one it was and retransmits (the option Kurose and Ross discuss). rdt2.0 has no sequence numbers, so its receiver delivers that retransmission as new data; rdt2.1 recognizes it with a one-bit sequence number. rdt2.2 has no NAK: the ACK carries the number of the last packet received correctly, and a duplicate ACK is equivalent to a NAK. Kurose and Ross, §3.4.1.
    • GBN: one timer, for the oldest unacknowledged packet; it is restarted with every ACK that moves the window. Cumulative ACKs. SR: one timer per packet, individual ACKs and a receiver buffer. Kurose and Ross, §3.4.
    • Bit errors are always detected by the checksum (in reality, some multi-bit errors go unnoticed, as seen in GG31). A delayed packet arrives 3·L/R later.
    • The timer starts when the packet starts being transmitted. “Adjust” sets it to RTT + L/R + 1: enough for the ACK to arrive in time. With a smaller value there are premature timeouts and needless retransmissions. TCP estimates it from the measured RTT (§3.5.3).
    • Extension (not covered in class). With k-bit sequence numbers, GBN is correct if N ≤ 2^k − 1 and SR if N ≤ 2^k / 2; with a larger window the receiver or the sender confuses old packets or ACKs with new ones (scenarios “window too large”). If a delay makes a packet overtake another one, the channel reorders: the protocols of §3.4 assume it does not, and they may fail.