Sliding window可以填充满network pipe的capacity,比如bottleneck为10Mbps (Mega-bits per second), RTT(round trip time)为50ms,那么1s内能发送 1000/50 = 20次 rount trip,10Mbps/20 = 500Kbps, 每个Eternet frame大小为12bits,那么 500/12 ≈ 41 个 frame。每秒能发送约41
个frame。
The sliding window allows a “window” of unacknowledged packets in flight. (这里对比的stop and wait, which only allows one packet in flight,是一个极大的浪费)。
先发过去了再说,可以到了buffer然后确认,ACK。
也有三个变量:RWS, LAS, LSR, LAS-LSR ≤ RWS。
Last acceptable segment denotes the next segmente it can receive, e.g. RWS=5, LSR=3, it can receive 4,5,6,7,8, segment 10 will be discarded because the receiver cannot buffer it.
If received packet is < LAS, send ACK.
Note: Cumulative state
.这里有个advance,rather than sending the ACKs for the data you received, send what is the end of the contiguous data you received, that is cumulative. E.g.
acknowledge 3, for every data before 3, not just 3.
例外:
TCP acks是next expected data, say last received is n, 那么tcp表示的是n+1. Should keep this in mind.
RWS≤SWS,不然多余的buffer space就是浪费啊。
Go-back-N的意思是,因为Receiver window size是1,所以只能buffer当前segment,如果丢失,那么sender must retransmit the entire
window.
TCP is a protocol using sliding window.
对sliding window还有不懂的话,听听Sliding window Example
最后的部分。
Receiver: ACK3
Sender: data 4, data 5
…
data4 lost
Receiver: ACK3 (cumulative ACKs)
But buffered data 5
becasue RWS=2,能保存5.
Sender: send data 4 again
Receiver: ACK5 (5 already buffered thanks to receive window)
P.s. 这里不发送ACK 4,becasue of the principle of cumulative state
. Send what is the end of the contiguous data segments received.
What kind of retransmission protocol to use?
Go-back-N
v.s. selective repeat
: a trade-off between conservative and optimistic