Sliding Windows

The fact that reliable communications requires receipt of an acknowledgement could make it very inefficient. A simple acknowledgement would slow the network down completely, as packets would have to make the two-way trip before a new packet could be sent.

Consider a different strategy where we have a sequence of packets to be transmitted. We can allow up to eight packets to be transmitted before we receive an acknowledgement for packet 1. Now we can slide the window forward by one packet.

We can now transmit packet 9 as we receive the acknowledgement for packet 2. The number of packets which can be unacknowledged at any time is constrained by the window size. There are three sets of packets;

  1. Those to the left of the window have been sent and acknowledged.

  2. Those within the window are being sent

  3. Those to the right of the window have not yet been sent

The previous example of acknowledgement or retransmission was exactly the same as this, except with a window size of one. Sliding windows allow TCP to dynamically adjust the throughput of a link to match the latency and packet loss characteristics of a transmission medium.

A receiver may send a window advertisement that describes the size of its buffer and how many packets it can accept. This provides a form of end-to-end flow control and a receiver can send a window advertisement of zero to halt transmission of packets. Properly implemented, this allows for congestion control and mitigation.

Despite all the above, TCP may result in limited throughput on a link compared to a connectionless protocol. Be careful when testing link throughput as real throughput for TCP depends on bandwidth and latency!

Last updated