Professional Documents
Culture Documents
Transport Layer
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
connection setup
unreliable, unordered
network
data link
physicalnetwork
delivery: UDP data link
physical
no-frills extension of network
data link
“best-effort” IP
application
physical network transport
data link network
services not available: physical data link
physical
delay guarantees
bandwidth guarantees
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
P3 P1
P1 P2 P4 application
application application
host 2 host 3
host 1
Transport Layer 3-8
How demultiplexing works
host receives IP datagrams
each datagram has source 32 bits
IP address, destination IP
address source port # dest port #
P2 P1
P1
P3
P1 P4 P5 P6 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
P1 P4 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
Sender: Receiver:
treat segment contents compute checksum of
as sequence of 16-bit received segment
integers check if computed checksum
checksum: addition (1’s equals checksum field value:
complement sum) of NO - error detected
segment contents YES - no error detected.
sender puts checksum But maybe errors
value into UDP checksum nonetheless? More later
field ….
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Transport Layer 3-20
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
flow control
3.3 Connectionless
connection management
transport: UDP
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
What to do?
Q?
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link
network protocol limits use of physical resources!
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R
Increase utilization
by a factor of 3!
U 3*L/R .024
= = = 0.0008
sender 30.008
RTT + L / R
Principle:
if it’s the expected data packet, send ACK
Else, send NAK
Making it ACK-only:
Send ACK for correctly-received packet with highest in-order
sequence #
• Need to remember expectedseqnum
For corrupted or out-of-order packet:
• discard (don’t buffer) -> no receiver buffering!
• ACK packet with highest in-order sequence #
Transport Layer 3-50
GBN in
action
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new
in (a)
Q: what relationship
between sequence #
size and window size?
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
time
simple telnet scenario
350
300
250
RTT (milliseconds)
200
150
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
Seq=92 timeout
Seq=100 timeout
Seq=92 timeout
timeout
X
loss
Sendbase
= 100
SendBase
Seq=120 timeout = 120
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-71
TCP retransmission scenarios (more)
Host A Host B
timeout
X
loss
SendBase
= 120
time
Cumulative ACK scenario
timeout
time
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
speed-matching
service: matching the
send rate to the
receiving app’s drain
rate
app process may be
slow at reading from
buffer
Transport Layer 3-78
TCP Flow control: how it works
Rcvr advertises spare
room by including value
of RcvWindow in
segments
Sender limits unACKed
(Suppose TCP receiver data to RcvWindow
discards out-of-order guarantees receive
segments) buffer doesn’t overflow
spare room in buffer
= RcvWindow
= RcvBuffer-[LastByteRcvd -
LastByteRead]
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
seq. #s no data
timed wait
FIN, replies with ACK.
Closes connection, sends
FIN.
closed
timed wait
Note: with small
closed
modification, can handle
simultaneous FINs.
closed
TCP server
lifecycle
TCP client
lifecycle
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
Congestion:
informally: “too many sources sending too much
data too fast for network to handle”
different from flow control!
manifestations:
lost packets (buffer overflow at routers)
long delays (queuing in router buffers)
a top-10 problem!
receivers
one router,
Host B unlimited shared
output link buffers
infinite buffers
no retransmission
maximum
achievable
throughput
large delays
when congested
Transport Layer 3-87
Causes/costs of congestion: scenario 2
“costs” of congestion:
more work (retransmission) for given “goodput”
unneeded retransmissions: link carries multiple copies of pkt
Transport Layer 3-89
Causes/costs of congestion: scenario 3
Four senders
Q: what happens as
Multi-hop paths in
and increase ?
Timeout/retransmit in
Host A out
in : original data
'in : original data, plus
retransmitted data
Host B
H
o
s
t
B
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
16 Kbytes
8 Kbytes
time
RTT
double CongWin every
RTT
done by incrementing
CongWin for every ACK
received
Summary: initial rate
is slow but ramps up
exponentially fast
time
Implementation:
Variable Threshold
At loss event, Threshold is
set to 1/2 of CongWin just
before loss event
1.22 MSS
RTT L
➜ L = 2·10-10 Wow
New versions of TCP for high-speed
TCP connection 1
bottleneck
TCP
router
connection 2
capacity R
Connection 1 throughput R