3rdedition Chapter3
3rdedition Chapter3
Transport Layer
lo
different hosts physical network physical
gi
data link
ca
transport protocols run in physical
l
network
en
end systems data link
d-
physical network
en
data link
send side: breaks app
d
physical
tr
messages into segments,
a
network
ns
data link
passes to network layer
po
physical
r t
rcv side: reassembles
applicatio
segments into messages, n
transport
passes to app layer network
data link
more than one transport physical
lo
physical network physical
gi
data link
ca
flow control physical
l
network
en
connection setup data link
d-
physical network
en
data link
unreliable, unordered
d
physical
tr
a
network
delivery: UDP
ns
data link
po
physical
r
no-frills extension of
t
applicatio
“best-effort” IP n
transport
services not available: network
data link
physical
delay guarantees
bandwidth guarantees
application P3 P1
P1 application P2 P4 application
host 2 host 3
host 1
Transport Layer 3-8
How demultiplexing works
host receives IP datagrams
each datagram has source IP
address, destination IP address 32 bits
each datagram carries 1
source port # dest port #
transport-layer segment
each segment has source,
destination port number other header fields
host uses IP addresses & port
numbers to direct segment to
appropriate socket
application
data
(message)
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
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:
NO - error detected
complement sum) of
segment contents YES - no error detected.
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-19
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-
services oriented transport:
3.2 Multiplexing and TCP
demultiplexing segment structure
3.3 Connectionless
reliable data transfer
flow control
transport: UDP
connection
3.4 Principles of
management
reliable data transfer 3.6 Principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-20
Principles of Reliable data
transfer
important in app., transport, link layers
top-10 list of important networking topics!
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)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
L/ R .008
U = = = 0.00027
sender 30.008
RTT +L / R microsec
onds
Increase utilization
by a factor of 3!
3*L/ R .024
U = = = 0.0008
sender 30.008
RTT +L / R microsecon
ds
Transport Layer 3-42
Go-Back-N
Sender:
k-bit seq # in pkt header
“window” of up to N, consecutive unack’ed pkts allowed
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new
in (a)
Q: what relationship
between seq # size
and window size?
Transport Layer 3-51
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-
services oriented transport:
3.2 Multiplexing and TCP
demultiplexing segment structure
3.3 Connectionless
reliable data transfer
flow control
transport: UDP
connection
3.4 Principles of
management
reliable data transfer 3.6 Principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-52
TCP: Overview RFCs: 793, 1122, 1323,
2018, 2581
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)
loop (forever) {
TCP
switch(event)
sender
event: data received from application above
create TCP segment with sequence number NextSeqNum
(simplified
if (timer currently not running) )
start timer
pass segment to IP
Comment:
NextSeqNum = NextSeqNum + length(data)
• SendBase-1: last
event: timer timeout cumulatively
retransmit not-yet-acknowledged segment with ack’ed byte
smallest sequence number Example:
start timer • SendBase-1 = 71;
y= 73, so the rcvr
event: ACK received, with ACK field value of y wants 73+ ;
if (y > SendBase) {
y > SendBase, so
SendBase = y
if (there are currently not-yet-acknowledged segments)
that new data is
start timer acked
}
Seq=9 Seq=9
2, 8 b 2, 8 b
y t es d y t es d
at a
Seq=92 timeout
at a Seq=
100,
20 b y
t es d
timeout
ata
=100
ACK 0
10
X CK
A AC
=
K =120
loss
Seq=9 Seq=9
2, 8 b 2, 8 b
y t es d Sendbase y t es d
at a
at a
Seq=92 timeout
= 100
SendBase
= 120 =1 20
K
CK =100 AC
A
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-64
TCP retransmission scenarios
(more)
Host A Host B
Seq=9
2, 8 b
y t es d
at a
=100
timeout
Seq=1 A CK
00 , 2 0
b y t es
dat a
X
loss
SendBase CK =120
A
= 120
time
Cumulative ACK scenario
timed wait
ACK
replies with ACK. Closes
connection, sends FIN.
closed
closed
TCP server
lifecycle
TCP client
lifecycle
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 (queueing in router buffers)
a top-10 problem!
infinite buffers
no
retransmission
large delays
when congested
maximum
achievable
throughput
R/3
out
out
out
R/4
a. b. c.
“costs” of congestion:
more work (retrans) for given “goodput”
unneeded retransmissions: link carries multiple copies of pkt
Host B
H
o
s
t
B
24 Kbytes
16 Kbytes
8 Kbytes
time
RTT
first loss event:
two segm
double CongWin every en ts
RTT
done by incrementing
four segm
CongWin for every ents
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 needed!
TCP connection 1
bottleneck
TCP
router
connection 2
capacity R
Connection 1 throughput R
First case:
WS/R > RTT + S/R: ACK for
first segment in window
returns before window’s
worth of data sent
Second case:
WS/R < RTT + S/R: wait
for ACK after sending
window’s worth of data
sent
P min{Q, K 1}
R
= 2S /R
third w indow
= 4S /R
P
O
delay 2 RTT idleTime p fourth w indow
= 8S /R
R p 1
P
O S S
2 RTT [ RTT 2 k 1 ]
R k 1 R R object
com plete
transm ission
delivered
O S S
2 RTT P[ RTT ] (2 P 1) tim e at
R R R tim e at
client
server
How do we calculate K ?
K min{k : 20 S 21 S 2 k 1 S O}
min{k : 20 21 2 k 1 O / S }
k O
min{k : 2 1 }
S
O
min{k : k log 2 ( 1)}
S
O
log 2 ( 1)
S