Transport Layer: A Note On The Use of These PPT Slides
Transport Layer: A Note On The Use of These PPT Slides
Transport Layer
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
lo
gi
ca
transport protocols run in
le
nd
end systems
-e
nd
send side: breaks app
tr
a
messages into segments,
ns
po
passes to network layer
rt
rcv side: reassembles application
transport
segments into messages, network
data link
passes to app layer physical
lo
network
physical
gi
data link
flow control
ca
physical
le
connection setup
nd
-e
nd
unreliable, unordered network
tr
data link
a
physicalnetwork
delivery: UDP
ns
data link
po
physical
rt
no-frills extension of network
data link
application
“best-effort” IP physical network
data link
transport
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 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
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 received
as sequence of 16-bit segment
integers check if computed checksum
checksum: addition (1’s equals checksum field value:
complement sum) of 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-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
3.3 Connectionless flow control
connection management
transport: UDP
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
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)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
L 8000bits
d trans 9
8 microseconds
R 10 bps
U sender : utilization – fraction of time sender busy sending
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R microsec
onds
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link
network protocol limits use of physical resources!
U L/R .008
sender
= = = 0.00027
RTT + L / R 30.008 microsec
onds
Increase utilization
by a factor of 3!
U 3*L/R .024
sender
= = = 0.0008
RTT + L / R 30.008 microsecon
ds
Transport Layer 3-44
Pipelining Protocols
Go-back-N: big picture: Selective Repeat: big pic
Sender can have up to Sender can have up to
N unacked packets in N unacked packets in
pipeline pipeline
Rcvr only sends Rcvr acks individual
cumulative acks packets
Doesn’t ack packet if Sender maintains
there’s a gap timer for each
Sender has timer for unacked packet
oldest unacked packet When timer expires,
If timer expires, retransmit only unack
retransmit all unacked packet
packets
nextseqnum - send_base ≤Sender Window Size (SWS=N)
ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”
may receive duplicate ACKs (see receiver)
timer for each in-flight pkt
timeout(n): retransmit pkt n and all higher seq # pkts in window
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new in
(a)
Q: what relationship
between seq # size and
window size?
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
a p p lic a t io n a p p lic a t io n
w r ite s d a ta re a d s d a ta
socket socket
door door
TC P TC P
s e n d b u ffe r r e c e iv e b u f f e r
segm ent
3-58
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UA P R S F Receive window
(generally not used) # bytes
checksum Urg data pnter
rcvr willing
RST, SYN, FIN: to accept
Options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)
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=9 Seq=9
2, 8 b 2, 8 b y te
y te s d a s data
ta Seq=
Seq=92 timeout
1 00, 2
0 by t
es da
timeout
t a
=100
ACK 0
10
X CK=
A AC K = 120
loss
Seq=9 Seq=9
2, 8 b
2, 8 b
y t es da Sendbase y t es da
ta
ta
= 100
Seq=92 timeout
SendBase
= 120 = 120
0 K
=10 AC
ACK
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-69
TCP retransmission scenarios (more)
Host A Host B
Seq=9
2, 8 byte
s data
=100
timeout
Seq=1 A CK
00, 20
bytes
data
X
loss
SendBase C K =120
A
= 120
time
Cumulative ACK scenario
X
timeout
resen
d 2 nd s
egme
nt
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-76
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
timed wait
ACK
replies with ACK. Closes
connection, sends FIN.
closed
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 (queueing in router buffers)
a top-10 problem!
receivers
unlimited shared
one router,
Host B
output link buffers
infinite buffers
no retransmission
large delays
when congested
maximum
achievable
throughput
Transport Layer 3-85
Causes/costs of congestion: scenario 2
one router, finite buffers
sender retransmission of lost packet
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
Transport Layer 3-87
Causes/costs of congestion: scenario 3
four senders
Q: what happens as
multihop paths in
and increase ?
timeout/retransmit in
Host A out
in : original data
'in : original data, plus
retransmitted data
finite shared output
link buffers
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
2 4 K b y te s
Saw tooth
behavior: probing
1 6 K b y te s
for bandwidth
8 K b y te s
time
tim e
RTT
first loss event:
two segm
double CongWin every ents
RTT
done by incrementing
CongWin for every ACK four segm
ents
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