Introduction
Error detection tells a receiver that a frame is damaged; it does not get the data through. Automatic repeat request (ARQ) protocols add acknowledgements, timers and retransmission so that every frame is eventually delivered once and in order. The same machinery also provides flow control: the sender may have only a limited number of unacknowledged frames, its window, so a slow receiver is not flooded.
There are three classic protocols. Stop-and-wait sends one frame and waits for its acknowledgement. Go-Back-N (GBN) keeps up to frames outstanding and, after a loss, resends the lost frame and everything after it. Selective Repeat (SR) also keeps a window outstanding but resends only the frames that were actually lost, at the price of buffering out-of-order frames at the receiver.
The quantities to compute are link utilisation from , the window needed to fill a link, the number of sequence-number bits, the maximum window for a given number of bits, and the number of transmissions under a stated loss pattern. TCP uses the same ideas with byte-numbered windows (TCP Flow Control).
Prerequisites
- Network Performance Metrics: Delay, Throughput and BDP: , , , bandwidth-delay product.
- Error detection by CRC: damaged frames are discarded, so a damaged frame behaves as a lost frame.
Core concepts
Terms
| Term | Meaning |
|---|---|
| ACK | In this note, cumulative GBN ACK acknowledges frames through . TCP ACK instead acknowledges bytes through and requests byte . Individual SR ACK acknowledges frame |
| NAK | Negative acknowledgement: asks for one frame again (optional in SR) |
| Timeout | Time after which an unacknowledged frame is resent; must exceed the round trip (plus ACK and processing time) |
| Sender window | Maximum number of frames sent but not yet acknowledged |
| Receiver window | Number of frame positions the receiver will accept and buffer |
| Sequence number field | bits; numbers run and wrap around |
| Piggybacking | Carrying an ACK inside a data frame going the other way instead of sending a separate ACK frame |
Efficiency convention used in all CN notes. Utilisation (efficiency) is the fraction of time the sender's link is busy sending new data frames. Unless a question states otherwise, ACK frames are taken to have negligible transmission time, processing and queueing are zero, and the round trip is . The ratio is (one-way propagation over frame transmission).
Stop-and-wait
Send a frame, start a timer, wait for its ACK, then send the next. One sequence bit (0 and 1, alternating) is enough: if an ACK is lost, the sender times out and resends, and the receiver recognises the duplicate by its sequence number, discards it and re-acknowledges it. Without sequence numbers a lost ACK would cause a duplicate to be delivered.
Go-Back-N
- Sender window ; receiver window : the receiver accepts only the next expected frame and discards every other frame (it may re-send the last cumulative ACK).
- ACKs are cumulative, so a lost ACK is covered by any later ACK.
- One timer, for the oldest unacknowledged frame. On timeout, resend every outstanding frame, starting from the oldest.
- Simple receiver, no buffering; wastes capacity on a lossy link with a large window.
Selective Repeat
- Sender window , receiver window (usually equal). The receiver buffers out-of-order frames inside its window and delivers them in order when the gap is filled.
- ACKs are individual. Each frame has its own timer; on timeout only that frame is resent. A NAK may trigger the resend before the timer expires.
- Fewer retransmissions; more receiver memory and bookkeeping.
How it works

The figure uses time unit, units, a timeout of 8 units after the end of a frame's transmission, frames 0 to 6, and only the first transmission of frame 2 lost. Frames 0 to 3 go out back to back at times 0 to 4; ACK 0 returns at time 5, so frame 4 is sent at 5 and frame 5 at 6. Then the window is stuck on frame 2. Its timer expires at 11, and the two protocols diverge.
Mathematical explanation
Utilisation without errors
A frame sent at time 0 finishes at , its last bit arrives at , and the ACK is back at . Stop-and-wait sends one frame per cycle:
With a window of frames, the sender can send frames in each cycle of :
The smallest window that keeps the link fully busy is . In bits, this is the frame plus the round-trip bandwidth-delay product: . Throughput is .
If ACK time and processing are included, replace the cycle by .
Utilisation with errors (stop-and-wait)
If each frame is lost or damaged independently with probability and the timeout equals the round trip, the number of transmissions per frame is geometric with mean , so
Window limits from sequence-number bits
With -bit sequence numbers (modulus ):
Why GBN cannot use . Suppose . The sender sends frames numbered ; all arrive, the receiver now expects number 0 again, and all ACKs are lost. The sender times out and resends the old frame 0, which the receiver accepts as new. With the receiver expects after a full window, which is not among the resent numbers.
Why SR needs half. After the receiver accepts a full window of frames, its window moves to the next numbers. If the ACKs are lost, the sender resends the old numbers. The two sets of numbers must not overlap modulo , which needs .
Bits needed. For a target window : GBN needs the smallest with ; SR needs the smallest with , so SR usually needs one bit more than GBN for the same window (compute both; Example 3).
Worked examples
Example 1: stop-and-wait utilisation
A 1 Mbps link, 1000-bit frames, ms. ms, , , throughput about 47.6 kbps. If the ACK is also 1000 bits, . If each frame is lost with probability 0.2 (ACKs not counted), .
Example 2: utilisation with a window
Same link. A window of 5 frames gives . A window of 21 or more gives . In bits: bits must be in flight, which is 21 frames.
Example 3: sequence-number bits
For a window of 21 frames, GBN needs (, while is too small), and SR needs (, too small). If the field has only bits: GBN can use , ; SR can use , .
Example 4: counting transmissions under a loss pattern
Ten frames are sent with window 3, every 5th transmission (5th, 10th, 15th, ...) is lost, ACKs are never lost, , and the timeout is longer than the time to send a window.
| Protocol | Transmissions |
|---|---|
| Stop-and-wait | 12 |
| Selective Repeat, | 12 |
| Go-Back-N, | 18 |
| Go-Back-N, | 26 |
For SR and stop-and-wait each loss costs exactly one extra transmission: 12 transmissions deliver 10 frames because only the 5th and 10th are lost. For GBN each loss also costs the frames sent behind the lost one, and those extra transmissions shift which later frame is the 5th, 10th or 15th transmission. With nine frames instead of ten, GBN with window 3 needs 16 transmissions. Answers to such questions depend on the conventions (what counts as a transmission, whether the window fills before the timeout); state them, then trace frame by frame.
Example 5: the window-size limits in action
With (numbers 0 to 3): GBN with sends 0, 1, 2, 3; if all four ACKs are lost, the receiver expects 0 and wrongly accepts the resent old 0. With it expects 3, and the resent 0, 1, 2 are rejected. SR with : the receiver's window moves to after accepting 0, 1, 2, so resent old 0 and 1 are wrongly accepted as new; with the windows and are disjoint and the scheme is safe.
Example 6: piggybacking
Two stations exchange data in both directions. Without piggybacking each data frame needs a separate ACK frame; with piggybacking the ACK number rides in the header of the next data frame in the reverse direction. If no reverse data is ready within a short ACK timer, a stand-alone ACK is sent, so that the sender does not time out.
Example 7: ACK time and processing delay
The link of Example 1 ( ms, ms), now with a 100-bit ACK ( ms) and 0.4 ms of processing at the receiver before it sends the ACK. One cycle is
Stop-and-wait gives , and a window of 10 gives . Full utilisation now needs , so : the window of 21 that was enough in Example 2 reaches only .
Example 8: retransmissions when one frame is lost
Frames 1 to , window , only frame lost (once), ACKs never lost, and a timeout long enough for the sender to fill its window before the timer fires.
- GBN. By the timeout the sender has sent frames to ; the receiver discarded all of them, so all are resent: transmissions.
- SR. Only frame is resent: transmissions.
With and : losing frame 6 costs GBN transmissions (6, 7, 8 and 9 are sent again), losing frame 9 costs (only 9 and 10 are behind it), and SR needs 11 in both cases. If the timer fires before the window is full, fewer frames are outstanding and GBN resends fewer; the question must then give the timing, and the frames are traced one by one.
Example 9: unequal windows in Selective Repeat
With (numbers 0 to 7) and a receiver window , the rule allows . With it fails: the receiver accepts 0 to 5 and its window moves to ; if all six ACKs are lost, the resent old frame 0 falls inside the new window and is accepted as new. is the Go-Back-N case (); equal windows give .
Example 10: piggybacking with a one-bit window
Both stations always have data and use a one-bit sliding window with piggybacked ACKs only: a station sends its next frame, carrying the ACK, as soon as a frame from the other side has fully arrived. On the link of Example 1, A sends at 0; its frame has fully arrived at B at ms, when B sends its own frame with the ACK; that frame reaches A at 22 ms, when A sends its next frame. Each station sends one frame every ms, so each direction has , the same as stop-and-wait with an ACK as long as a data frame (Example 1): an ACK cannot be read until the whole frame carrying it has arrived. The gain is that no separate ACK frames are sent and both directions carry data.
Important properties and observations
- Stop-and-wait is GBN and SR with . All three formulas agree at : .
- Large needs large windows. Satellite links and fast long-haul links have ; stop-and-wait is hopeless there.
- Timeout choice. Too short: needless duplicates. Too long: idle link after a loss. It must exceed the full round trip.
- GBN versus SR under errors. On a clean link they perform the same. With losses, GBN wastes up to frames per loss; SR wastes one.
- Sequence numbers wrap. Every comparison is modulo ; window limits exist precisely to make the modular comparison unambiguous.
Common misconceptions.
- "GBN window is ." It is at most .
- "SR window is ." With equal windows it is at most .
- "Efficiency is ." With the round trip gives . A book that defines as the round-trip time over writes for the same thing.
- "The receiver window in GBN is ." It is 1.
GATE examination perspective
- Definition of first. Write and in the same unit, then ; efficiency capped at 1.
- Window to fill the pipe. frames; then convert to bits with the GBN or SR rule.
- Maximum window from bits. GBN , SR ; a question that gives for SR uses .
- Retransmission counting. Fix the conventions, then trace. GBN resends all outstanding frames after a loss; SR resends one.
- Throughput with losses. Multiply by for stop-and-wait with probability of losing a frame.
- Extra delays in the cycle. Add ACK transmission and processing times only when given, then recompute both and the window that fills the link (Example 7).
- One lost frame. GBN needs transmissions when the window fills before the timeout; SR needs (Example 8).
- Piggybacking saves ACK frames; it does not change the window limits.
Summary
Sources
- A. S. Tanenbaum, D. J. Wetherall, Computer Networks, 5th ed., Pearson, 2011, Section 3.3 (Elementary Data Link Protocols, including 3.3.3 A Simplex Stop-and-Wait Protocol for a Noisy Channel) and Section 3.4 (3.4.1 A One-Bit Sliding Window Protocol, 3.4.2 A Protocol Using Go-Back-N, 3.4.3 A Protocol Using Selective Repeat).
- J. F. Kurose, K. W. Ross, Computer Networking: A Top-Down Approach, 8th ed., Pearson, 2021: Section 3.4 (3.4.1 Building a Reliable Data Transfer Protocol, 3.4.2 Pipelined Reliable Data Transfer Protocols, 3.4.3 Go-Back-N (GBN), 3.4.4 Selective Repeat (SR)).
- B. A. Forouzan, Data Communications and Networking, 5th ed., McGraw-Hill, 2013: Chapter 11 (Data Link Control).