从这里获取状态驱动代码:
# Initialization
cwnd = MSS # congestion window in bytes
ssthresh= swin # in bytes
# Ack arrival
if tcp.ack > snd.una : # new ack, no congestion
if cwnd < ssthresh :
# slow-start : increase quickly cwnd
# double cwnd every rtt
cwnd = cwnd + MSS
else:
# congestion avoidance : increase slowly cwnd
# increase cwnd by one mss every rtt
cwnd = cwnd+ mss*(mss/cwnd)
else: # duplicate or old ack
if tcp.ack==snd.una: # duplicate acknowledgement
dupacks++
if dupacks==3:
retransmitsegment(snd.una)
ssthresh=max(cwnd/2,2*MSS)
cwnd=ssthresh
else: # ack for old segment, ignored
dupacks=0
Expiration of the retransmission timer:
send(snd.una) # retransmit first lost segment
sshtresh=max(cwnd/2,2*MSS)
cwnd=MSS
有几件事我不明白。
cwnd 如何用“cwnd = cwnd + MSS”“指数地”加倍。当它只是一个线性增量时,我很难理解这是一个指数斜坡。
我也不明白“cwnd = cwnd+ mss*(mss/cwnd)”背后的数学原理。cwnd 应该是线性增加的,这个公式是如何实现这个结果的,当它看起来更像一个平方级数时(mss^2/cwnd)。
我对这些计算如何执行所描述的任务感到有点困惑。谁能解释一下他们是怎么做的?
谢谢