Skip to content
We areTOP 1%

Compare Stop-and-Wait, Go-Back-N and Selective Repeat.

HardConceptFlow & Congestion Control
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

These are ARQ (Automatic Repeat reQuest) protocols: they provide reliable delivery over a lossy link using sequence numbers, acknowledgements, timeouts and retransmission. They differ in how many frames may be unacknowledged and in what is resent after a loss.

  • Stop-and-Wait sends one frame and waits for its ACK. It is simple, but the link sits idle during every round trip; its efficiency is 1 / (1 + 2a), where a = propagation delay ÷ transmission time.
  • Go-Back-N allows up to N outstanding frames with cumulative ACKs. The receiver discards out-of-order frames, so after a loss the sender resends the lost frame and every frame after it. With k-bit sequence numbers, N ≤ 2^k − 1.
  • Selective Repeat buffers out-of-order frames and acknowledges each one, so only the lost frame is resent. It uses bandwidth best but needs more buffer space; its window is at most 2^(k−1).
  • TCP mixes both ideas: cumulative ACKs, plus buffering of out-of-order data and selective acknowledgements (SACK).

Example: Frames 0 to 6 are sent and frame 2 is lost.

Go-Back-N:         receiver discards 3, 4, 5, 6  -> sender resends 2, 3, 4, 5, 6
Selective Repeat:  receiver buffers 3, 4, 5, 6   -> sender resends only 2

For Stop-and-Wait with a 1 ms transmission time and 2 ms propagation delay, a = 2 and efficiency = 1 / (1 + 4) = 20%.

More in Flow & Congestion Control

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account