ELEC3506

Topics

Transport LayerLecture 7 PDF20 min

Stop-and-Wait and Go-Back-N ARQ

How Stop-and-Wait paces one frame at a time, why that wastes a full round trip per frame, and how Go-Back-N's sliding window keeps several frames in flight instead.

By the end of this page you should be able to

  • Explain how Stop-and-Wait ARQ paces transmission using acknowledgment and sequence numbers
  • State why Stop-and-Wait wastes a full round-trip time per frame
  • Give the maximum sliding window size in terms of the sequence number field width
  • State Go-Back-N's receive window size and explain why it differs from the send window

The idea

The previous topic named three ARQ protocols and left them unopened. Stop-and-Wait is the simplest of the three, and its main weakness — one frame in flight at a time — is exactly the problem Go-Back-N is built to fix, so the two belong on the same page.

How it works

Stop-and-Wait ARQ

Stop-and-Wait is the simplest form of flow control. The sending station sends one frame of data, then waits for an acknowledgment from the other station before sending anything further. The receiving party can stop the flow of data at any point, simply by withholding its acknowledgment.

The source may not send a new frame until either:

  • the receiver acknowledges the frame already sent, or
  • the sender’s timer times out.

Frames are numbered with a sequence number based on modulo-2 arithmetic — 0, 1, 0, 1, 0, 1, and so on. The receiver’s ACK carries the sequence number of the next frame it expects, also modulo-2.

How it works

Why Stop-and-Wait is inefficient

The sender has to wait a full round-trip time (RTT) before it can send another frame — the time required for a frame to travel from source to destination and back. One frame, one full RTT of dead time: that pairing is what makes Stop-and-Wait slow.

Aside

The slides’ case-by-case timeout and retransmission diagrams for Stop-and-Wait did not survive extraction, so this page does not reproduce specific scenario walkthroughs for it — only the mechanism above, which the lecture states in prose.

How it works

Go-Back-N ARQ

To improve on Stop-and-Wait’s efficiency, several frames need to be in transmission at once while the sender waits for acknowledgments. Go-Back-N ARQ can send several frames before receiving any acknowledgment, but it keeps a copy of every frame sent until that frame is acknowledged.

Frames are numbered sequentially, modulo 2^m, where m is the size of the sequence number field in bits.

How it works

Sliding window

The sliding window is an abstract concept defining the range of sequence numbers that concern the sender — the send window — and the receiver — the receive window.

Maximum sliding window size
N
Send window size, in frames
m
Number of bits in the sequence number field

How it works

Send window for Go-Back-N

The send window’s size and location are defined by three variables — Sf, Sn, and Ssize — dividing the possible sequence numbers into four regions. The window can slide forward by one or more slots at once when a valid acknowledgment arrives, because Go-Back-N acknowledgments are cumulative: one ACK can confirm several frames at once. With a 4-bit sequence number field (m = 4), an ACK covering frames 0 through 2 slides the window forward to accommodate the next set of frames.

How it works

Receive window for Go-Back-N

The receive window is 1. The receiver only ever expects one specific frame next.

Worked example

Go-Back-N: a lost frame in the middle of the window

  1. A cumulative ACK acknowledges packets 1 through 3 — the receiver would send an ACK numbered 4, meaning “I have everything up to and including packet 3.”

  2. Packet 1 is lost before it reaches the receiver.

  3. The receiver never generates that ACK, because it never received packet 1 in the first place — a packet arriving out of order is discarded, not buffered.

  4. The sender times out and goes back, resending packets 1, 2 and 3 — every outstanding frame from the lost one onward, whether or not the later ones were originally received intact.

AnswerThe sender goes back and resends frames 1, 2 and 3.

How it works

Send window size

The send window size must be strictly less than 2^m, where m is the sequence number field width in bits.

Where marks get lost

The window is 2^m − 1, not 2^m

It is tempting to size the window at exactly 2^m, since that is how many distinct sequence numbers the field can represent. The lecture is explicit that the window must stay strictly below 2^m — the maximum usable size is 2^m − 1. With m = 2, for instance, the maximum window size is 2^2 − 1 = 3, not 4.

Aside

The slides’ full worked demonstration of why the window has to stay below 2^m — walking through a concrete 4-value example — did not survive extraction. The rule itself (N ≤ 2^m − 1) is stated directly and is safe to use; the worked justification for it is not reproduced here.

Stop-and-WaitGo-Back-N
Frames in flightOne at a timeSeveral at once
Idle time per frameA full RTTOverlapped across the window
AcknowledgmentConfirms one frameCumulative — confirms several at once
On a lost frameRetransmit that one frameResend everything from the lost frame onward
Go-Back-N trades Stop-and-Wait's idle RTT for the risk of resending frames that already arrived correctly.

Aside

Lecture 3 names Stop-and-Wait, Go-Back-N and Selective-Repeat as ARQ terms without developing their window mechanics. This is the lecture where those mechanics actually get taught.

In the exam

  • Stop-and-Wait’s cost is a full RTT per frame. Define RTT precisely if asked: time for a frame to travel source to destination and back.
  • Sequence numbers under Stop-and-Wait are modulo-2: 0, 1, 0, 1, …
  • Maximum window size is 2^m − 1, strictly, not 2^m. This is the most common place to lose a mark in this topic.
  • Go-Back-N’s receive window is 1. An out-of-order frame is discarded, not buffered — that is what forces the sender to resend everything from the lost frame forward.
  • Go-Back-N acknowledgments are cumulative — one ACK can slide the window by more than one slot.

Check yourself

  • Stop-and-Wait sends one frame, waits a full RTT for its ACK, and numbers frames modulo-2.
  • Go-Back-N keeps several frames in flight, numbered modulo 2^m, and keeps copies until each is acknowledged.
  • The send window’s maximum size is 2^m − 1, never 2^m.
  • Go-Back-N’s receive window is 1: anything out of order is discarded, and a lost frame means resending it and everything sent after it.

Check yourself

  1. Under Stop-and-Wait ARQ, why can the sender not simply send the next frame immediately after transmitting one?
  2. What does RTT stand for in the context of Stop-and-Wait's inefficiency?
  3. With a 4-bit sequence number field (m = 4), what is the maximum size of the sliding window?
  4. A Go-Back-N receiver is waiting for frame 5. Frame 6 arrives before frame 5 does. What does the receiver do with frame 6?
  5. A Go-Back-N sender has frames 1, 2 and 3 outstanding. It receives a cumulative ACK covering frames 1 through 3, then frame 1 turns out to have been lost before that ACK was generated. What does the sender do?