Professional Documents
Culture Documents
Packets received
• Assuming stop-and-wait
• Six different combinations
• (A) – Acknowledge
• (W) – write segment
to application
• (C) – crash
• Client states: S0 – no
segment outstanding, S1 –
segment outstanding
• Four different strategies for
client
• For any strategy – there exist
a sequence of events at
server that makes the
protocol fail! Different combinations of client and server strategy
12/3/2023 Dr. Ashraf S. Hasan Mahmoud 16
Elements of Transport Protocols –
Crash Recovery – cont’d
• Recovery from a layer N crash can only be done
by layer N+1
• Only if higher layer retains enough information to
reconstruct
• In light of the previous example – what does
receiving an end-to-end ack mean?
• Updating database example!
Congestion Control
• Focus – congestion control mechanism at the
transport layer
• Goals of the congestion control
• How can hosts regulate the rate at which they
send packets into the network
• The Internet relies heavily on the transport
layer congestion control and the specific
algorithms built into the TCP
• Any suggestions?
• Refer to textbook pages 551 and 552
• At what level to consider fairness – no clear
answers
• Connection
• Connections between a pair of hosts
• All connections per host
12/3/2023 Dr. Ashraf S. Hasan Mahmoud 22
Congestion Control - Convergence
• Criterion – congestion control algorithm should converge quickly to
a fair and efficient allocation of BW
• Example – change of BW allocations with time
• Bottom line:
• Total allocated BW is approximately 100%
• Competing flows get equal treatment – but not more than what they need!
• Issues:
1. Sender does not know about the
wireless link
2. Two mechanisms driven by loss at
work (a) frame retransmission at
link level, and (b) congestion
control algorithm at transport level
▪ TCP segment with FIN bit set ▪ Timed-Wait: Timer is set when FIN is sent
• To guarantee all packets from the connection have
died off, just in case the ACK (4) was lost
Transport Layer 3-37
TCP Connection Management Modeling (1)
client path
• Two exceptions:
• Urgent data (e.g. to kill a
process)
• Window probe – one-byte
segment to force receiver
to announce the next byte
expected and the window
size – used to prevent
deadlocks
• Senders are NOT required to
send data as soon it
becomes available
• Receivers are NOT required
to send ACKs immediately
after they receive data
12/3/2023 Dr. Ashraf S. Hasan Mahmoud 40
Slide by Kurose and Ross’s textbook
TCP seq. numbers, ACKs
Host A Host B
User
types (1)
‘C’ Seq=42, ACK=79, data = ‘C’
host ACKs
(2 & 3) receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed (4)
‘C’ Seq=43, ACK=80
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Slide by Kurose and Ross’s textbook
TCP fast retransmit
Host A Host B
ACK=100
timeout
ACK=100
ACK=100
fast retransmit after sender ACK=100
receipt of triple duplicate ACK Seq=100, 20 bytes of data
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Textbook author’s slides
TCP Congestion Control (3)
Slow start grows congestion window exponentially
• Doubles every RTT while keeping ACK clock going
• Slow start threshold
4 segments take up
entire RTT ➔ right
size for the
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 connection
Textbook author’s slides
TCP Congestion Control (4)
cnwd = cnwd +
MSSx(MSS/cnwd)
for each new ACK
➔ cwnd is incremented
every RTT
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Slide by Kurose and Ross’s textbook
Summary: TCP Congestion Control
New
New ACK!
ACK!
duplicate ACK
dupACKcount++ new ACK
new ACK
.
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
cwnd = cwnd+MSS transmit new segment(s), as allowed
dupACKcount = 0
L transmit new segment(s), as allowed
cwnd = 1 MSS
ssthresh = 64 KB cwnd > ssthresh
dupACKcount = 0 slow L congestion
start timeout avoidance
ssthresh = cwnd/2
cwnd = 1 MSS duplicate ACK
timeout dupACKcount = 0 dupACKcount++
ssthresh = cwnd/2 retransmit missing segment
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment New
timeout
ACK!
ssthresh = cwnd/2
cwnd = 1 New ACK
dupACKcount = 0
cwnd = ssthresh dupACKcount == 3
dupACKcount == 3 retransmit missing segment dupACKcount = 0
ssthresh= cwnd/2 ssthresh= cwnd/2
cwnd = ssthresh + 3 cwnd = ssthresh + 3
retransmit missing segment retransmit missing segment
fast
recovery
dupACKcount == 3 duplicate ACK
cwnd = cwnd + MSS
transmit new segment(s), as allowed
ssthresh = cwnd/2
cwnd = ssthresh + 3 Transport Layer 3-53
Textbook author’s slides
TCP Congestion Control (5)
Slow start followed by additive increase (TCP Tahoe)
• Threshold is half of previous loss cwnd
TCP Tahoe:
- Loss – Timeout → cwnd to 1
- Loss – 3 dup ACKs → cwndCN5E
to 1by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Textbook author’s slides
TCP Congestion Control (6)
With fast recovery, we get the classic sawtooth (TCP
Reno)
• Retransmit lost packet after 3 duplicate ACKs
• New packet for each dup. ACK until loss is repaired
TCP Reno:
- Loss – Timeout → cwnd = 1
- Loss – 3 dup ACKs → cwndCN5E
= cwnd/2
by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Textbook author’s slides
TCP Congestion Control (7)
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011