Академический Документы
Профессиональный Документы
Культура Документы
• IP
• UDP versus TCP
• UDP
• TCP
• TCP Segment
• Connection Establishment
• Connection Termination
• Reliable Transport
• Retransmission Timer
Overview (2)
Reliable
transmitted data has to be confirmed by the receiving end,
TCP uses checksums, acknowledgements en timers
Connection-Oriented
connection establishment ➾ data transfer ➾ connection termination
Byte-stream Service
TCP assigns byte sequence numbers
➘
TCP Segment (2)
• 6 Flag Bits
to indicate validity of other fields
for connection control
• Result is 1 connection
• Requires exchange of 4
segments
Collision Possibility
Connection Termination (1)
TCP connection is full-duplex
each direction must be shut down
independently
receipt of FIN means
• no more data flow in that direction
• but TCP can still send
Graceful Termination
Connection Termination (2)
Simultaneous Termination
Mechanism:
• When sending a new segment:
• seqnr in header
= seqnr of 1st byte of data carried in the segment
• calculate checksum of header and data
• if retransmission timer free, set timer
Reliable Transport (2)
44 24 4
4
64 44 24
4
24
Reliable Transport (5)
84 64 44
4
24 44
84 64
4
24 44 64
84
24
44 64
44
64 64
Reliable Transport (6)
64
64
64
64
Timer expires
64
64
Reliable Transport (7)
64
64
64
91
Reliable Transport (8)
• Remarks:
1-1 correspondence between segments and the acks is
not necessary
acks are cumulative :
problem of lost ack is solved by following ack
value of Retransmission Timer is critical
Retransmission Timer (1)
• Based on RTT
• How is RTT estimated ?
RTT value of segment is timed
only one counter per connection
no measurements on retransmitted segments
• Approach 1
update: (M = RTT measurement & R = RTT estimator)
R= α R + (1- α) M, with α = 0.9 (a smoothing factor)
RTO = β R, with β = 2 (a delay variance factor)
Retransmission Timer (2)
T1 T2 = 2 * T1
• Sliding window
Offered Window (advertised by receiver)
Usable Window
1 2 3 4 5 6 7 8 9 10 11 ...
Sent, Can send
not Acked ASAP
Send & Acked Can’t Send until window moves
Flow Control (2)
• Window size
allowed number of unacked segments (expressed in bytes)
advertised by the receiver based on buffer occupancy
relative to acknr
sender may transmit bytes in offered window
without waiting for acks
ack moves window to the right
1 2 3 4 5 6 7 8 9 10 11 ...
… 4 5 6 7 8 9 10 11 12 ...
… 5 6 7 8 9 10 11 12 13 14 ...
Flow Control (4)
• Window update
segment which doesn’t ack new data,
but contains a new window advertisement
• Window of 0
stops sender,
until ack with non zero window arrives
until window update
persist timer avoids waiting forever
if timer expires, window probe is transmitted
Congestion Control
• Consist of 4 algorithms :
Slow Start
Congestion Avoidance
Fast Recovery
Fast Retransmit
• Congestion Control
flow control imposed by the sender
to avoid overload in intermediate systems
Slow Start (1)
• Slow Start
idea:
rate at which new segments should be injected into the network
=
rate at which the acks are returned by other side
how :
• add congestion window, CWND
• sender can transmit up to the minimum of the congestion
window and the advertised window
Slow Start (2)
2
CWND = 2
1 2
3 2
2
Slow Start (4)
CWND = 3
3 2 4
4
CWND = 4
3 5 4
6 5 4
3 4
7 6 5
3 4 5
• Slow Start
- quickly attain max. transmission rates
25
After Time-out
CWND = 20
Congestion window
20
(segments)
15
10
SSThresh = 10
SSThresh = 8
5
0
0
15
22
12
20
25
Time (round trips)
Fast Retransmit/Recovery (1)
6
4
2
0
0 2 4 6 8 10 12 14
Time (round trips)
After fast retransmit and fast recovery, window size is reduced in half.
TCP Implementations (1)
• TCP Tahoe :
Slow start
Congestion avoidance
Fast retransmit
• TCP Reno
TCP Tahoe
Fast recovery
TCP Implementations (2)
• TCP with SACK
TCP Reno
Selective acknowledgement
• TCP Vegas
Better estimation of RTT
New congestion avoidance (react on
throughput)
Modified Slow Start
Acronyms
• ACK : Acknowledgment
• Ack Nr : Acknowledgment number in header of segment
• CWND : Congestion Window
• IP : Internet Protocol
• ISN : Initial Sequence Number
• MSS : Maximum Segment Size
• MTU : Maximum Transmission Unit
• RTO : Retransmission Time-Out value
• RTT : Round-Trip Time
• Seq Nr : Sequence number in header of segment
• SSThresh : Slow-Start Threshold
• TCP : Transmission Control Protocol
• UDP : User Datagram Protocol