Go-Back-N Protocol Simulation
Go-Back-N is a sliding window protocol that keeps the link busy by sending several packets before waiting for acknowledgements. Break it on purpose below to see how it recovers.
Interactive simulation
- base
- 0
- next_seq
- 0
- expected_seq
- 0
- Timer
- idle
- Speed
- 1x
Sender (window of 5)
Receiver (window of 1 packet (in order only))
Legend
- Inside window, ready
- Sent, waiting for ACK
- Retransmitted
- Acknowledged / delivered
- Packet in transit (click to select)
- ACK in transit (click to select)
- Selected (press Kill Selected)
- Destroyed in transit
Event log
How to use this simulation
- Press Send. The sender transmits up to 5 packets without waiting. Blue packets travel down; green ACKs travel up.
- Click a packet or press Kill Packet while it is in transit. Watch the receiver discard everything after the gap.
- Wait for the timer. When it reaches zero the sender goes back and resends every unacknowledged packet, shown in purple.
- Use Step to jump to the next event, Slower and Faster to change speed, and Reset to start again.
1. The sender fills its window
The sender may have at most N packets outstanding. Here N is 5. The outlined frame over the sender row is the window: it starts at base, the oldest unacknowledged packet, and extends N slots to the right. next_seq is the next packet that will be sent.
2. The receiver accepts only the packet it expects
The receiver keeps one number, expected_seq. A packet with that number is delivered and expected_seq moves up. Any other packet is discarded, because the receiver has no buffer for out-of-order data. That keeps the receiver tiny and simple.
3. Cumulative ACKs slide the window
Each ACK n means every packet up to n arrived in order. When the sender receives it, base jumps to n+1 and the window slides forward, making room for new packets. A lost ACK is often harmless because a later ACK covers it.
4. A timeout sends everything again
The sender runs one timer for the oldest unacknowledged packet. If it expires, the sender goes back to base and retransmits every packet in the window, including ones that may have arrived safely. This is simple, but wasteful when losses are frequent or the window is large.
5. Why use it?
Compared with stop-and-wait, Go-Back-N keeps the pipe full and raises throughput. Compared with Selective Repeat it needs far less receiver memory and logic, which is why the idea appears in real protocols.
Key takeaways
- The sender window is N; the receiver window is 1.
- ACKs are cumulative: ACK n confirms all packets up to n.
- One lost packet makes the receiver discard all later packets until the missing one is retransmitted.
- A single timer covers the oldest unacknowledged packet, and expiry resends the whole window.
- Simple receivers cost extra bandwidth when errors are common.
Related topics
Selective Repeat
Resend only what was actually lost.
Stop-and-Wait
The simplest ARQ: one packet at a time.
Coming soonSliding Window
The general idea behind flow control.
Coming soonTCP Handshake
How a reliable connection starts.
Coming soonARQ Protocols
Automatic repeat request, compared.
Coming soon