Sub topic 15
Stop-and-Wait Utilization and Window Sizing
Assume you know bits, bytes, bit rate, transmission delay, propagation delay, and round-trip time (RTT). This chapter uses an ideal link with no loss, processing delay, or queueing unless stated otherwise.
Stop-and-wait operation
In stop-and-wait flow control, a sender transmits one frame and then waits for an acknowledgment (ACK). It cannot send the next frame until the ACK arrives.
Let:
- \(L\) be the frame size in bits.
- \(R\) be the link rate in bits per second.
- \(T_t = L/R\) be the frame transmission time.
- \(RTT\) be the time from sending a frame until its ACK returns.
Ignoring ACK transmission time, one cycle takes:
\[ T{\text{cycle}} = Tt + RTT \]
The sender transmits during only \(T_t\) of that cycle. Therefore, link utilization is:
\[ U = \frac{Tt}{Tt + RTT} \]
The effective throughput is:
\[ \text{throughput} = U R \]
A long RTT or a small frame makes utilization low because the sender spends more time waiting.
Worked example
A link has a rate of 100 Mbps, an RTT of 20 ms, and 12,000-bit frames.
\[ T_t = \frac{12{,}000}{100{,}000{,}000} = 0.00012\text{ s} \]
Thus:
\[ U = \frac{0.00012}{0.00012 + 0.020} \approx 0.00597 \]
The utilization is about 0.597%, so the effective throughput is approximately:
\[ 100\text{ Mbps} \times 0.00597 \approx 0.597\text{ Mbps} \]
The link is fast, but stop-and-wait prevents the sender from keeping it busy.
def stop_and_wait_utilization(frame_bits, rate_bps, rtt_s):
transmission_s = frame_bits / rate_bps
return transmission_s / (transmission_s + rtt_s)
rate = 100_000_000
utilization = stop_and_wait_utilization(12_000, rate, 0.020)
print(f"utilization = {utilization:.5f}")
print(f"throughput = {utilization * rate / 1_000_000:.3f} Mbps")Sliding windows and required window size
A sliding-window protocol allows several frames to be unacknowledged at the same time. Let \(W\) be the window size in frames. Under the same ideal assumptions:
\[ U = \min\left(1,\frac{W Tt}{Tt + RTT}\right) \]
To reach full utilization, the sender must have enough frames in flight to cover the waiting period:
\[ W \geq \left\lceil \frac{Tt + RTT}{Tt} \right\rceil = \left\lceil 1 + \frac{RTT}{T_t} \right\rceil \]
The bandwidth-delay product gives the amount of data that can occupy the path:
\[ BDP = R \times RTT \]
A useful approximation is:
\[ W \geq \left\lceil \frac{BDP}{L} + 1 \right\rceil \]
| Quantity | Meaning |
|---|---|
| \(T_t\) | Time to transmit one frame |
| \(RTT\) | Round-trip time for a frame and ACK |
| \(W\) | Number of outstanding frames |
| \(BDP\) | Data that fits in the path during one RTT |
Common errors
- Use bits with a rate in bits per second. Convert bytes to bits first.
- Do not confuse propagation delay with RTT. If one-way propagation delay is \(Tp\), then RTT is approximately \(2Tp\).
- Stop-and-wait means \(W=1\), not \(W=0\).
- A window larger than the required value cannot produce utilization above 100%; use the minimum function.
Exercise
A 10 Mbps link has 10 ms RTT and 1000-bit frames. What window size is sufficient for full utilization?
Show answer
T_t = 1000 / 10,000,000 = 0.0001 s. Therefore W >= ceil(1 + 0.010 / 0.0001) = 101 frames.