Upload
others
View
39
Download
0
Embed Size (px)
Citation preview
Ch
apter 3
Transport L
ayer
Transport L
ayer
3-1
Com
puter Netw
orking A
Top D
own A
pproach
5th
ed
ition J
im K
urose K
eith
Ross
Ad
dison-W
esle
y April
20
09
A n
ote
on
the
use
of th
ese
pp
t slid
es
Wersquore
ma
kin
g th
ese
slid
es fre
ely
ava
ilab
le to
all (fa
cu
lty stu
de
nts
rea
de
rs)
Th
eyrsquore
in P
ow
erP
oin
t form
so
yo
u c
an
ad
d m
od
ify an
d d
ele
te s
lide
s
(inclu
din
g th
is o
ne
) an
d s
lide
co
nte
nt to
su
it yo
ur n
ee
ds T
he
y o
bvio
usly
rep
rese
nt a
lot
of w
ork
on
ou
r pa
rt In re
turn
for u
se
we
on
ly a
sk th
e
follo
win
g
If y
ou
use
the
se
slid
es (e
g in
a c
lass) in
su
bsta
ntia
lly u
na
ltere
d fo
rm
tha
t yo
u m
en
tion
the
ir so
urc
e (a
fter a
ll we
rsquod lik
e p
eo
ple
to u
se
ou
r bo
ok)
If y
ou
po
st a
ny s
lide
s in
su
bsta
ntia
lly u
na
ltere
d fo
rm o
n a
ww
w s
ite th
at
yo
u n
ote
tha
t the
y a
re a
da
pte
d fro
m (o
r pe
rha
ps id
en
tica
l to) o
ur s
lide
s a
nd
no
te o
ur c
op
yrig
ht o
f this
ma
teria
l
Th
an
ks a
nd
en
joy J
FK
KW
R
All m
ate
rial c
op
yrig
ht 1
99
6-2
009
JF
Ku
rose
an
d K
W R
oss A
ll Rig
hts
Re
se
rve
d
Ch
apter 3
Transport L
ayer
Our goals
rund
erstand
principles
beh
ind transport
layer se
rvices
mm
ultiplex
ingdem
ultiplex
ing
rle
arn about transport
layer protocols in th
e
Interne
tm
UD
P connectionle
ss transport
Transport L
ayer
3-2
ex
ing
mre
liable
data transfe
r
mflow
control
mconge
stion control
transport
mT
CP conne
ction-oriente
d
transport
mT
CP conge
stion control
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Transport se
rvices and
protocols
rprovid
elogical com
munication
betw
een app proce
sses
running on diffe
rent h
osts
rtransport protocols run in end
system
s
mse
nd sid
e b
reaks app
message
s into segm
ents
applicationtransportnetw
orkd
ata linkph
ysical
Transport L
ayer
3-4
message
s into segm
ents
passes to ne
twork laye
r
mrcv sid
e re
assem
ble
s se
gments into m
essage
s passe
s to app layer
rm
ore th
an one transport
protocol available
to apps
mInte
rnet T
CP and
UD
P
applicationtransportnetw
orkd
ata linkph
ysical
Transport vs ne
twork laye
r
rnetw
ork layerlogical
comm
unication b
etw
een h
osts
rtransport layer
logical com
munication
House
hold
analogy
12 kid
s sending letters to
12 kid
s
rproce
sses = kid
s
rapp m
essage
s = lette
rs
Transport L
ayer
3-5
comm
unication b
etw
een proce
sses
mre
lies on e
nhance
s ne
twork laye
r service
s
rapp m
essage
s = lette
rs in e
nvelope
s
rh
osts = house
s
rtransport protocol = A
nn and B
ill
rne
twork-laye
r protocol = postal se
rvice
Inte
rnet transport-laye
r protocols
rre
liable
in-order
delive
ry (TC
P)m
congestion control
mflow
control
mconne
ction setup
runre
liable
unordere
d
applicationtransportnetw
orkd
ata linkph
ysicalnetw
orkd
ata linkph
ysical
network
network
data link
physical
Transport L
ayer
3-6
runre
liable
unordere
d
delive
ry UD
Pm
no-frills ex
tension of
ldquobest-e
ffortrdquo IP
rse
rvices not availab
le
md
elay guarante
es
mb
andw
idth
guarantees
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
applicationtransportnetw
orkd
ata linkph
ysical
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Multiple
xingd
em
ultiplex
ing
= process
= socket
delive
ring rece
ived
segm
ents
to correct socke
t
Dem
ultiplex
ing at rcv host
gathering d
ata from m
ultiplesocke
ts enve
loping data w
ith
head
er (late
r used
for d
em
ultiplex
ing)
Multiple
xing at se
nd h
ost
Transport L
ayer
3-8
application
transport
netw
ork
link
physical
P1application
transport
netw
ork
link
physical
application
transport
netw
ork
link
physical
P2P3
P4P1
host 1
host 2
host 3
How
dem
ultiplex
ing works
rh
ost rece
ives IP d
atagrams
meach
datagram
has source
IP ad
dre
ss destination IP
add
ress
meach
datagram
carries 1
transport-layer se
gment
meach
segm
ent h
as source
source port
dest port
32
bits
other h
ead
er fie
lds
Transport L
ayer
3-9
meach
segm
ent h
as source
destination port num
ber
rh
ost uses IP ad
dre
sses amp
port num
bers to d
irect se
gment to
appropriate socke
t
applicationd
ata (m
essage
)
TC
PUD
P segm
ent form
at
Conne
ctionless d
em
ultiplex
ing
rC
reate
sockets w
ith port
numb
ers
DatagramSocket mySocket1 = new
DatagramSocket(12534)
DatagramSocket mySocket2 = new
DatagramSocket(12535)
rW
hen h
ost rece
ives U
DP
segm
ent
mch
ecks d
estination port
numb
er in se
gment
md
irects U
DP se
gment to
socket w
ith th
at port
Transport L
ayer
3-1
0
DatagramSocket(12535)
rU
DP socke
t identifie
d b
y tw
o-tuple
(dest I
P add
ress d
est port num
ber)
socket w
ith th
at port num
ber
rIP d
atagrams w
ith
diffe
rent source
IP ad
dre
sses and
or source
port numb
ers d
irecte
d
to same socke
t
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Transport se
rvices and
protocols
rprovid
elogical com
munication
betw
een app proce
sses
running on diffe
rent h
osts
rtransport protocols run in end
system
s
mse
nd sid
e b
reaks app
message
s into segm
ents
applicationtransportnetw
orkd
ata linkph
ysical
Transport L
ayer
3-4
message
s into segm
ents
passes to ne
twork laye
r
mrcv sid
e re
assem
ble
s se
gments into m
essage
s passe
s to app layer
rm
ore th
an one transport
protocol available
to apps
mInte
rnet T
CP and
UD
P
applicationtransportnetw
orkd
ata linkph
ysical
Transport vs ne
twork laye
r
rnetw
ork layerlogical
comm
unication b
etw
een h
osts
rtransport layer
logical com
munication
House
hold
analogy
12 kid
s sending letters to
12 kid
s
rproce
sses = kid
s
rapp m
essage
s = lette
rs
Transport L
ayer
3-5
comm
unication b
etw
een proce
sses
mre
lies on e
nhance
s ne
twork laye
r service
s
rapp m
essage
s = lette
rs in e
nvelope
s
rh
osts = house
s
rtransport protocol = A
nn and B
ill
rne
twork-laye
r protocol = postal se
rvice
Inte
rnet transport-laye
r protocols
rre
liable
in-order
delive
ry (TC
P)m
congestion control
mflow
control
mconne
ction setup
runre
liable
unordere
d
applicationtransportnetw
orkd
ata linkph
ysicalnetw
orkd
ata linkph
ysical
network
network
data link
physical
Transport L
ayer
3-6
runre
liable
unordere
d
delive
ry UD
Pm
no-frills ex
tension of
ldquobest-e
ffortrdquo IP
rse
rvices not availab
le
md
elay guarante
es
mb
andw
idth
guarantees
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
applicationtransportnetw
orkd
ata linkph
ysical
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Multiple
xingd
em
ultiplex
ing
= process
= socket
delive
ring rece
ived
segm
ents
to correct socke
t
Dem
ultiplex
ing at rcv host
gathering d
ata from m
ultiplesocke
ts enve
loping data w
ith
head
er (late
r used
for d
em
ultiplex
ing)
Multiple
xing at se
nd h
ost
Transport L
ayer
3-8
application
transport
netw
ork
link
physical
P1application
transport
netw
ork
link
physical
application
transport
netw
ork
link
physical
P2P3
P4P1
host 1
host 2
host 3
How
dem
ultiplex
ing works
rh
ost rece
ives IP d
atagrams
meach
datagram
has source
IP ad
dre
ss destination IP
add
ress
meach
datagram
carries 1
transport-layer se
gment
meach
segm
ent h
as source
source port
dest port
32
bits
other h
ead
er fie
lds
Transport L
ayer
3-9
meach
segm
ent h
as source
destination port num
ber
rh
ost uses IP ad
dre
sses amp
port num
bers to d
irect se
gment to
appropriate socke
t
applicationd
ata (m
essage
)
TC
PUD
P segm
ent form
at
Conne
ctionless d
em
ultiplex
ing
rC
reate
sockets w
ith port
numb
ers
DatagramSocket mySocket1 = new
DatagramSocket(12534)
DatagramSocket mySocket2 = new
DatagramSocket(12535)
rW
hen h
ost rece
ives U
DP
segm
ent
mch
ecks d
estination port
numb
er in se
gment
md
irects U
DP se
gment to
socket w
ith th
at port
Transport L
ayer
3-1
0
DatagramSocket(12535)
rU
DP socke
t identifie
d b
y tw
o-tuple
(dest I
P add
ress d
est port num
ber)
socket w
ith th
at port num
ber
rIP d
atagrams w
ith
diffe
rent source
IP ad
dre
sses and
or source
port numb
ers d
irecte
d
to same socke
t
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Transport vs ne
twork laye
r
rnetw
ork layerlogical
comm
unication b
etw
een h
osts
rtransport layer
logical com
munication
House
hold
analogy
12 kid
s sending letters to
12 kid
s
rproce
sses = kid
s
rapp m
essage
s = lette
rs
Transport L
ayer
3-5
comm
unication b
etw
een proce
sses
mre
lies on e
nhance
s ne
twork laye
r service
s
rapp m
essage
s = lette
rs in e
nvelope
s
rh
osts = house
s
rtransport protocol = A
nn and B
ill
rne
twork-laye
r protocol = postal se
rvice
Inte
rnet transport-laye
r protocols
rre
liable
in-order
delive
ry (TC
P)m
congestion control
mflow
control
mconne
ction setup
runre
liable
unordere
d
applicationtransportnetw
orkd
ata linkph
ysicalnetw
orkd
ata linkph
ysical
network
network
data link
physical
Transport L
ayer
3-6
runre
liable
unordere
d
delive
ry UD
Pm
no-frills ex
tension of
ldquobest-e
ffortrdquo IP
rse
rvices not availab
le
md
elay guarante
es
mb
andw
idth
guarantees
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
applicationtransportnetw
orkd
ata linkph
ysical
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Multiple
xingd
em
ultiplex
ing
= process
= socket
delive
ring rece
ived
segm
ents
to correct socke
t
Dem
ultiplex
ing at rcv host
gathering d
ata from m
ultiplesocke
ts enve
loping data w
ith
head
er (late
r used
for d
em
ultiplex
ing)
Multiple
xing at se
nd h
ost
Transport L
ayer
3-8
application
transport
netw
ork
link
physical
P1application
transport
netw
ork
link
physical
application
transport
netw
ork
link
physical
P2P3
P4P1
host 1
host 2
host 3
How
dem
ultiplex
ing works
rh
ost rece
ives IP d
atagrams
meach
datagram
has source
IP ad
dre
ss destination IP
add
ress
meach
datagram
carries 1
transport-layer se
gment
meach
segm
ent h
as source
source port
dest port
32
bits
other h
ead
er fie
lds
Transport L
ayer
3-9
meach
segm
ent h
as source
destination port num
ber
rh
ost uses IP ad
dre
sses amp
port num
bers to d
irect se
gment to
appropriate socke
t
applicationd
ata (m
essage
)
TC
PUD
P segm
ent form
at
Conne
ctionless d
em
ultiplex
ing
rC
reate
sockets w
ith port
numb
ers
DatagramSocket mySocket1 = new
DatagramSocket(12534)
DatagramSocket mySocket2 = new
DatagramSocket(12535)
rW
hen h
ost rece
ives U
DP
segm
ent
mch
ecks d
estination port
numb
er in se
gment
md
irects U
DP se
gment to
socket w
ith th
at port
Transport L
ayer
3-1
0
DatagramSocket(12535)
rU
DP socke
t identifie
d b
y tw
o-tuple
(dest I
P add
ress d
est port num
ber)
socket w
ith th
at port num
ber
rIP d
atagrams w
ith
diffe
rent source
IP ad
dre
sses and
or source
port numb
ers d
irecte
d
to same socke
t
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Multiple
xingd
em
ultiplex
ing
= process
= socket
delive
ring rece
ived
segm
ents
to correct socke
t
Dem
ultiplex
ing at rcv host
gathering d
ata from m
ultiplesocke
ts enve
loping data w
ith
head
er (late
r used
for d
em
ultiplex
ing)
Multiple
xing at se
nd h
ost
Transport L
ayer
3-8
application
transport
netw
ork
link
physical
P1application
transport
netw
ork
link
physical
application
transport
netw
ork
link
physical
P2P3
P4P1
host 1
host 2
host 3
How
dem
ultiplex
ing works
rh
ost rece
ives IP d
atagrams
meach
datagram
has source
IP ad
dre
ss destination IP
add
ress
meach
datagram
carries 1
transport-layer se
gment
meach
segm
ent h
as source
source port
dest port
32
bits
other h
ead
er fie
lds
Transport L
ayer
3-9
meach
segm
ent h
as source
destination port num
ber
rh
ost uses IP ad
dre
sses amp
port num
bers to d
irect se
gment to
appropriate socke
t
applicationd
ata (m
essage
)
TC
PUD
P segm
ent form
at
Conne
ctionless d
em
ultiplex
ing
rC
reate
sockets w
ith port
numb
ers
DatagramSocket mySocket1 = new
DatagramSocket(12534)
DatagramSocket mySocket2 = new
DatagramSocket(12535)
rW
hen h
ost rece
ives U
DP
segm
ent
mch
ecks d
estination port
numb
er in se
gment
md
irects U
DP se
gment to
socket w
ith th
at port
Transport L
ayer
3-1
0
DatagramSocket(12535)
rU
DP socke
t identifie
d b
y tw
o-tuple
(dest I
P add
ress d
est port num
ber)
socket w
ith th
at port num
ber
rIP d
atagrams w
ith
diffe
rent source
IP ad
dre
sses and
or source
port numb
ers d
irecte
d
to same socke
t
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
How
dem
ultiplex
ing works
rh
ost rece
ives IP d
atagrams
meach
datagram
has source
IP ad
dre
ss destination IP
add
ress
meach
datagram
carries 1
transport-layer se
gment
meach
segm
ent h
as source
source port
dest port
32
bits
other h
ead
er fie
lds
Transport L
ayer
3-9
meach
segm
ent h
as source
destination port num
ber
rh
ost uses IP ad
dre
sses amp
port num
bers to d
irect se
gment to
appropriate socke
t
applicationd
ata (m
essage
)
TC
PUD
P segm
ent form
at
Conne
ctionless d
em
ultiplex
ing
rC
reate
sockets w
ith port
numb
ers
DatagramSocket mySocket1 = new
DatagramSocket(12534)
DatagramSocket mySocket2 = new
DatagramSocket(12535)
rW
hen h
ost rece
ives U
DP
segm
ent
mch
ecks d
estination port
numb
er in se
gment
md
irects U
DP se
gment to
socket w
ith th
at port
Transport L
ayer
3-1
0
DatagramSocket(12535)
rU
DP socke
t identifie
d b
y tw
o-tuple
(dest I
P add
ress d
est port num
ber)
socket w
ith th
at port num
ber
rIP d
atagrams w
ith
diffe
rent source
IP ad
dre
sses and
or source
port numb
ers d
irecte
d
to same socke
t
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Conne
ctionless d
em
ux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428)
P2P1P1
P3
Transport L
ayer
3-11
Clie
ntIPB
client
IP Ase
rver
IP C
SP 6
42
8
DP 9
157
SP 9
157
DP 6
42
8
SP 6
42
8
DP 5
77
5
SP 5
77
5
DP 6
42
8
SP provid
es ldquore
turn add
ressrdquo
Conne
ction-oriente
d d
em
ux
rT
CP socke
t identifie
d
by 4
-tuple
msource
IP add
ress
msource
port numb
er
md
est IP ad
dre
ss
rS
erve
r host m
ay support m
any simultane
ous TC
P socke
tsm
each
socket id
entifie
d b
y its ow
n 4-tupleT
ransport Laye
r3-1
2
md
est IP ad
dre
ss
md
est port num
ber
rre
ceiving h
ost uses all
four values to d
irect
segm
ent to appropriate
socke
t
rW
eb
serve
rs have
d
iffere
nt sockets for
each
connecting clie
ntm
non-persiste
nt HT
TP w
ill h
ave d
iffere
nt socket for
each
reque
st
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Conne
ction-oriente
d d
em
ux
(cont)
P1P1
P2P4
P5P6
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
3
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Conne
ction-oriente
d d
em
ux
Th
read
ed
Web
Serve
r
P1P1
P2P4
P3
SP 5
77
5
DP 8
0
Transport L
ayer
3-1
4
Clie
ntIPB
client
IP Ase
rver
IP C
SP 9
157
DP 8
0
SP 9
157
DP 8
0
D-I
PC
S-I
P A
D-I
PC
S-I
P B
DP 8
0
D-I
PC
S-I
P B
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-1
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
UD
P Use
r Datagram
Protocol [RF
C 7
68
]
rldquono frillsrdquo ldquob
are b
onesrdquo
Interne
t transport protocol
rldquob
est e
ffortrdquo service
UD
P se
gments m
ay be
mlost
Wh
y is there
a UD
Pr
no connection
estab
lishm
ent (w
hich
can ad
d d
elay)
rsim
ple no conne
ction state
Transport L
ayer
3-1
6
lost
md
elive
red
out of order
to app
rconnectionless
mno h
andsh
aking betw
een
UD
P send
er re
ceive
r
meach
UD
P segm
ent
hand
led
indepe
ndently
of others
rsim
ple no conne
ction state
at send
er re
ceive
r
rsm
all segm
ent h
ead
er
rno conge
stion control UD
P can b
last away as fast as
desire
d
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
UD
P more
rofte
n used
for stream
ing m
ultimed
ia apps
mloss tole
rant
mrate
sensitive
roth
er U
DP use
sm
DN
S
source port
dest port
32
bits
length
checksum
Length
inb
ytes of U
DP
segm
ent
including
head
er
Transport L
ayer
3-1
7
mD
NS
mS
NM
P
rre
liable
transfer ove
r UD
P ad
d re
liability at
application layer
mapplication-spe
cific error re
covery
Application
data
(message
)
UD
P segm
ent form
at
head
er
UD
P checksum
Send
er
rtre
at segm
ent conte
nts as se
quence
of 16-b
it
Rece
iver
rcom
pute ch
ecksum
of re
ceive
d se
gment
Goal
dete
ct ldquoerrorsrdquo (e
g flipped
bits) in transm
itted
se
gment
Transport L
ayer
3-1
8
as seque
nce of 16
-bit
intege
rs
rch
ecksum
add
ition (1rsquos com
plem
ent sum
) of se
gment conte
nts
rse
nder puts ch
ecksum
value
into UD
P checksum
fie
ld
rece
ived
segm
ent
rch
eck if com
puted
checksum
equals ch
ecksum
field
value
mN
O -
error d
ete
cted
mY
ES
-no e
rror dete
cted
B
ut mayb
e errors nonetheless
More
later
hellip
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Inte
rnet C
hecksum
Ex
ample
rN
ote
mW
hen ad
ding num
bers a carryout from
the
most significant b
it need
s to be ad
ded
to the
result
rE
xam
ple ad
d tw
o 16-b
it intege
rs
Transport L
ayer
3-1
9
11 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
11 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
10 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-2
0
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
1
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
2
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Principles of R
eliab
le d
ata transfer
rim
portant in app transport link layers
rtop-10
list of important ne
tworking topics
Transport L
ayer
3-2
3
rch
aracteristics of unre
liable
channe
l will d
ete
rmine
com
plex
ity of reliab
le d
ata transfer protocol (rd
t)
Reliab
le d
ata transfer ge
tting started
send
rece
ive
rdt_send()
called
from ab
ove
(eg b
y app) Passed
data to
delive
r to rece
iver uppe
r layer
deliver_data()
called
by
rdt
to delive
r data to uppe
r
Transport L
ayer
3-2
4
send
side
rece
ivesid
e
udt_send()
called
by rd
tto transfe
r packet ove
r unre
liable
channe
l to rece
iver
rdt_rcv()
called
wh
en packe
t arrive
s on rcv-side of ch
annel
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Reliab
le d
ata transfer ge
tting started
Wersquoll
rincre
mentally d
eve
lop send
er re
ceive
r sides of
reliab
le d
ata transfer protocol (rd
t)
rconsid
er only unid
irectional d
ata transfer
mb
ut control info will flow
on both
dire
ctions
use finite
state m
achine
s (FS
M) to spe
cify
Transport L
ayer
3-2
5
ruse
finite state
mach
ines (F
SM
) to specify
send
er re
ceive
rstate1
state2
eve
nt causing state transition
actions taken on state
transition
state
wh
en in th
is ldquostate
rdquo nex
t state
uniquely d
ete
rmine
d
by ne
xt e
vent
eve
ntactions
Rd
t10 re
liable
transfer ove
r a reliab
le ch
annel
rund
erlying ch
annel pe
rfectly re
liable
mno b
it errors
mno loss of packe
ts
rse
parate F
SM
s for send
er re
ceive
rm
send
er se
nds d
ata into underlying ch
annel
mre
ceive
r read
data from
underlying ch
annel
Transport L
ayer
3-2
6
mre
ceive
r read
data from
underlying ch
annel
Wa
it for
ca
ll from
a
bo
ve
pa
cke
t = m
ake
_p
kt(d
ata
)u
dt_
se
nd
(pa
cke
t)
rdt_
se
nd
(da
ta)
extra
ct (p
acke
tda
ta)
de
live
r_d
ata
(da
ta)
Wa
it for
ca
ll from
b
elo
w
rdt_
rcv(p
acke
t)
send
er
rece
iver
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Rd
t20
channe
l with
bit e
rrors
rund
erlying ch
annel m
ay flip bits in packe
tm
checksum
to dete
ct bit e
rrors
rth
eque
stion how
to recove
r from e
rrorsm
acknowled
gements (A
CK
s)re
ceive
r ex
plicitly tells se
nder
that pkt re
ceive
d O
K
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
Transport L
ayer
3-2
7
mnegative acknow
ledgem
ents (NA
Ks)
rece
iver e
xplicitly
tells se
nder th
at pkt had
errors
mse
nder re
transmits pkt on re
ceipt of N
AK
rne
w m
ech
anisms in r
dt20
(beyond
rdt10
)m
error d
ete
ction
mre
ceive
r feed
back control m
sgs (AC
KN
AK
) rcvr-gtsend
er
rdt2
0 F
SM
specification
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rece
iver
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
8
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
wse
nder
Λ
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt2
0 ope
ration with
no errors
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-2
9
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 e
rror scenario
Wa
it for
ca
ll from
a
bo
ve
sn
kp
kt =
ma
ke
_p
kt(d
ata
ch
ecksu
m)
ud
t_se
nd
(sn
dp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
ampis
NA
K(rc
vp
kt)
ud
t_se
nd
(NA
K)
rdt_
rcv(rc
vp
kt) amp
amp
co
rrup
t(rcvp
kt)
Wa
it for
AC
K o
r N
AK
rdt_
se
nd
(da
ta)
Transport L
ayer
3-3
0
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
ud
t_se
nd
(AC
K)
rdt_
rcv(rc
vp
kt) amp
amp
no
tco
rrup
t(rcvp
kt)
rdt_
rcv(rc
vp
kt) amp
amp is
AC
K(rc
vp
kt)
Wa
it for
ca
ll from
b
elo
w
Λ
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt2
0 h
as a fatal flaw
Wh
at happe
ns if A
CK
NA
K corrupte
d
rse
nder d
oesnrsquot know
wh
at h
appene
d at re
ceive
r
rcanrsquot just re
transmit
possible
duplicate
Hand
ling duplicate
s r
send
er re
transmits curre
nt pkt if A
CK
NA
K garb
led
rse
nder ad
ds sequence
numb
erto e
ach pkt
rece
iver d
iscards (d
oesnrsquot
Transport L
ayer
3-3
1
possible
duplicate
rre
ceive
r discard
s (doe
snrsquot d
elive
r up) duplicate
pkt
Send
er se
nds one
packet
then w
aits for rece
iver
response
stop and w
ait
rdt2
1 send
er h
andle
s garble
d A
CK
NA
Ks
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
Wait fo
r A
CK
or
NA
K 0
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
rdt_
rcv(rc
vp
kt)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
Transport L
ayer
3-3
2
sn
dp
kt =
ma
ke
_p
kt(1
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isN
AK
(rcvp
kt) )
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcvp
kt)
Wait fo
rcall 1
from
above
Wait fo
r A
CK
or
NA
K 1
ΛΛ
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt2
1 rece
iver h
andle
s garble
d A
CK
NA
Ks
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq0(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp (c
orru
pt(rc
vpkt)
sndpkt =
make_pkt(N
AK
chksum
)udt_
send(s
ndpkt)
Transport L
ayer
3-3
3
Wait fo
r 0 fro
m
belo
w
udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq0(rc
vpkt)
rdt_
rcv(rc
vpkt) amp
amp n
otc
orru
pt(rc
vpkt)
ampamp
has_seq1(rc
vpkt)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
Wait fo
r 1 fro
m
belo
w
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt_
rcv(rc
vpkt) amp
amp
not c
orru
pt(rc
vpkt) amp
amphas_seq1(rc
vpkt)
sndpkt =
make_pkt(A
CK
chksum
)udt_
send(s
ndpkt)
rdt2
1 discussion
Send
er
rse
q ad
ded
to pkt
rtw
o seq
rsquos (01) w
ill suffice
Wh
y
rm
ust check if re
ceive
d
Rece
iver
rm
ust check if re
ceive
d
packet is d
uplicatem
state ind
icates w
heth
er
0 or 1 is e
xpe
cted
pkt
Transport L
ayer
3-3
4
rm
ust check if re
ceive
d
AC
KN
AK
corrupted
rtw
ice as m
any states
mstate
must ldquore
mem
berrdquo
wh
eth
er ldquocurre
ntrdquo pkt h
as 0 or 1 se
q
0 or 1 is e
xpe
cted
pkt se
q
rnote
rece
iver can not
know if its last
AC
KN
AK
rece
ived
OK
at se
nder
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt2
2 a N
AK
-free protocol
rsam
e functionality as rd
t21 using A
CK
s only
rinste
ad of N
AK
rece
iver se
nds A
CK
for last pkt re
ceive
d O
Km
rece
iver m
ust explicitly
include se
q of pkt b
eing A
CK
ed
rd
uplicate A
CK
at send
er re
sults in same action as
Transport L
ayer
3-3
5
rd
uplicate A
CK
at send
er re
sults in same action as
NA
K retransm
it current pkt
rdt2
2 se
nder re
ceive
r fragments
Wait fo
r call 0
from
above
sn
dp
kt =
ma
ke
_p
kt(0
da
ta c
he
cksu
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
se
nd
(da
ta)
ud
t_s
en
d(s
nd
pk
t)
rdt_
rcv(rc
vp
kt) amp
amp
( co
rrup
t(rcvp
kt) ||
isA
CK
(rcvp
kt1
))
rdt_
rcv(rc
vp
kt)
Wait fo
r A
CK
0
send
er F
SM
fragment
Transport L
ayer
3-3
6
rdt_
rcv(rc
vp
kt)
ampamp
no
tco
rrup
t(rcvp
kt)
ampamp
isA
CK
(rcv
pk
t0)
fragment
Wait fo
r 0 fro
m
belo
wrdt_
rcv(rc
vp
kt) amp
amp n
otc
orru
pt(rc
vp
kt)
ampamp
ha
s_
se
q1
(rcvp
kt)
extra
ct(rc
vp
ktd
ata
)
de
live
r_d
ata
(da
ta)
sn
dp
kt =
ma
ke
_p
kt(A
CK
1 c
hk
su
m)
ud
t_se
nd
(sn
dp
kt)
rdt_
rcv(rc
vp
kt) amp
amp
(co
rrup
t(rcvp
kt) ||
ha
s_
se
q1
(rcvp
kt))
ud
t_s
en
d(s
nd
pk
t)
rece
iver F
SM
fragment
Λ
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt3
0 ch
annels w
ith e
rrors andloss
New
assumption
underlying ch
annel can
also lose packe
ts (data
or AC
Ks)
mch
ecksum
seq
AC
Ks
Approach
se
nder w
aits ldquore
asonable
rdquo amount of
time for A
CK
r
retransm
its if no AC
K
rece
ived
in this tim
e
Transport L
ayer
3-3
7
mch
ecksum
seq
AC
Ks
retransm
issions will b
e
of help b
ut not enough
rif pkt (or A
CK
) just delaye
d
(not lost)
mre
transmission w
ill be
duplicate
but use
of seq
rsquos alre
ady h
andle
s this
mre
ceive
r must spe
cify seq
of pkt b
eing A
CK
ed
rre
quires countd
own tim
er
rdt3
0 se
ndersndpkt =
make_pkt(0
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
Wait
for
AC
K0
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt1
) )
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
rdt_
rcv(rc
vpkt)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt1
)
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
rdt_
rcv(rc
vpkt)
Wait fo
r call 0
from
above
Λ
Λ
Transport L
ayer
3-3
8
Wait fo
r call 1
from
above
sndpkt =
make_pkt(1
data
checksum
)udt_
send(s
ndpkt)
sta
rt_tim
er
rdt_
send(d
ata
)
ampamp
notc
orru
pt(rc
vpkt)
ampamp
isA
CK
(rcvpkt0
)
rdt_
rcv(rc
vpkt) amp
amp
( corru
pt(rc
vpkt) ||
isA
CK
(rcvpkt0
) )
ampamp
isA
CK
(rcvpkt1
)
sto
p_tim
er
sto
p_tim
er
udt_
send(s
ndpkt)
sta
rt_tim
er
timeout
Wait
for
AC
K1
Λ
rdt_
rcv(rc
vpkt)
Λ
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
rdt3
0 in action
Transport L
ayer
3-3
9
rdt3
0 in action
Transport L
ayer
3-4
0
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Perform
ance of rd
t30
rrd
t30
works b
ut perform
ance stinks
rex
1 Gb
ps link 15 m
s prop delay 8
00
0 b
it packet
ds
micro
secon
8b
ps
10
bits
80
009
==
=R L
dtr
ans
Transport L
ayer
3-4
1
mU
send
er utilization
ndashfraction of tim
e se
nder b
usy send
ing
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
m1K
B pkt e
very 3
0 m
sec -gt 3
3kB
sec th
ruput over 1 G
bps link
mne
twork protocol lim
its use of ph
ysical resource
s
bp
s1
0R
rdt3
0 stop-and
-wait ope
ration
first p
acke
t bit tra
nsm
itted
t = 0 se
nd
er
rece
ive
r
RT
T
last p
acke
t bit tra
nsm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
Transport L
ayer
3-4
2
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
U send
er =
0
08
30
00
8
=
00
00
27
microse
c
L R
RT
T + L
R
=
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Pipeline
d protocols
Pipelining
send
er allow
s multiple
ldquoin-flightrdquo ye
t-to-b
e-acknow
led
ged
pktsm
range of se
quence
numb
ers m
ust be incre
ased
mb
uffering at se
nder and
or rece
iver
Transport L
ayer
3-4
3
rT
wo ge
neric form
s of pipeline
d protocols go-B
ack-N
selective repeat
Pipelining incre
ased
utilization
first p
acke
t bit tra
nsm
itted
t = 0
se
nd
er
rece
ive
r
RT
T
last b
it tran
sm
itted
t = L
R
first p
acke
t bit a
rrive
s
last p
acke
t bit a
rrive
s s
en
d A
CK
last b
it of 2
nd
pa
cke
t arriv
es s
en
d A
CK
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
Transport L
ayer
3-4
4
AC
K a
rrive
s s
en
d n
ext
pa
cke
t t = R
TT
+ L
R
last b
it of 3
rdp
acke
t arriv
es s
en
d A
CK
U send
er =
0
24
30
00
8
=
00
00
8
microse
con
3
L R
RT
T + L
R
=
Increase
utilizationb
y a factor of 3
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Pipelining Protocols
Go-b
ack-N ove
rview
rsend
erup to N
unA
CK
ed
pkts in pipe
liner
receiveronly se
nds
cumulative
AC
Ks
Sele
ctive R
epe
at overvie
wr
sender
up to N unA
CK
ed
packe
ts in pipeline
rreceiver
AC
Ks ind
ividual
pktssend
erm
aintains timer
Transport L
ayer
3-4
5
receiveronly se
nds
cumulative
AC
Ks
md
oesnrsquot A
CK
pkt if th
ere
rsquos a gap
rsend
erh
as timer for
oldest unA
CK
ed
pktm
if timer e
xpire
s re
transmit all unA
CK
ed
packe
ts
pktsr
sender
maintains tim
er
for each
unAC
Ked
pktm
if timer e
xpire
s retransm
it only unA
CK
ed
packet
Go-B
ack-NS
end
er
rk-b
it seq
in pkt head
er
rldquow
indow
rdquo of up to N conse
cutive unA
CK
ed
pkts allowed
Transport L
ayer
3-4
6
rA
CK
(n) AC
Ks all pkts up to includ
ing seq
n -ldquocum
ulative A
CK
rdquo
mm
ay rece
ive d
uplicate A
CK
s (see re
ceive
r)
rtim
er for e
ach in-fligh
t pkt
rtim
eout(n)re
transmit pkt n and
all high
er se
q pkts in w
indow
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
GB
N se
nder e
xte
nded
FS
Mrd
t_send(d
ata
)
if (nexts
eqnum
lt b
ase+
N)
sndpkt[n
exts
eqnum
] = m
ake_pkt(n
exts
eqnum
data
chksum
)udt_
send(s
ndpkt[n
exts
eqnum
])if (b
ase =
= n
exts
eqnum
)sta
rt_tim
er
nexts
eqnum
++
els
ere
fuse_data
(data
)base=
1
Λ
Transport L
ayer
3-4
7
Wa
itsta
rt_tim
er
udt_
send(s
ndpkt[b
ase])
udt_
send(s
ndpkt[b
ase+
1])
hellipudt_
send(s
ndpkt[n
exts
eqnum
-1])
timeout
base =
geta
cknum
(rcvpkt)+
1If (b
ase =
= n
exts
eqnum
)sto
p_tim
er
els
esta
rt_tim
er
rdt_
rcv(rc
vpkt) amp
amp
notc
orru
pt(rc
vpkt)
base=
1nexts
eqnum
=1
rdt_
rcv(rc
vpkt)
ampamp
corru
pt(rc
vpkt)
GB
N re
ceive
r ex
tend
ed
FS
M
Wa
it
udt_
send(s
ndpkt)
defa
ult
rdt_
rcv(rc
vpkt)
ampamp
notc
urru
pt(rc
vpkt)
ampamp
hasseqnum
(rcvpkte
xpecte
dseqnum
)
extra
ct(rc
vpktd
ata
)deliv
er_
data
(data
)sndpkt =
make_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)udt_
send(s
ndpkt)
expecte
dseqnum
++
expecte
dseqnum
=1
sndpkt =
m
ake_pkt(e
xpecte
dseqnum
AC
Kc
hksum
)
Λ
Transport L
ayer
3-4
8
AC
K-only alw
ays send
AC
K for corre
ctly-rece
ived
pkt w
ith h
ighest in-ord
erse
q m
may ge
nerate
duplicate
AC
Ks
mne
ed
only rem
em
ber e
xpectedseqnum
rout-of-ord
er pkt
md
iscard (d
onrsquot buffe
r) -gt no rece
iver b
uffering
mR
e-A
CK
pkt with
high
est in-ord
er se
q
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
GB
N in
action
Transport L
ayer
3-4
9
Sele
ctive R
epe
at
rre
ceive
r individ
uallyacknow
led
ges all corre
ctly re
ceive
d pkts
mb
uffers pkts as ne
ed
ed
for eve
ntual in-order d
elive
ry to uppe
r layer
rse
nder only re
send
s pkts for wh
ich A
CK
not re
ceive
d
Transport L
ayer
3-5
0
rece
ived
mse
nder tim
er for e
ach unA
CK
ed
pkt
rse
nder w
indow
mN
consecutive
seq
rsquos
magain lim
its seq
s of sent unA
CK
ed
pkts
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Sele
ctive re
peat se
nder re
ceive
r wind
ows
Transport L
ayer
3-5
1
Sele
ctive re
peat
data from
above
r
if nex
t available
seq
in w
indow
send
pkt
timeout(n)
rre
send
pkt n restart tim
er
send
er
pkt n in [rcvbase
rcvbase
+N-1]
rse
nd A
CK
(n)
rout-of-ord
er b
uffer
rin-ord
er d
elive
r (also d
elive
r buffe
red
in-order
pkts) advance
wind
ow to
rece
iver
Transport L
ayer
3-5
2
rre
send
pkt n restart tim
er
AC
K(n) in [se
ndb
asese
ndb
ase+N
]
rm
ark pkt n as rece
ived
rif n sm
allest unA
CK
ed
pkt ad
vance w
indow
base
to ne
xt unA
CK
ed
seq
pkts) advance
wind
ow to
nex
t not-yet-re
ceive
d pkt
pkt n in [rcvbase
-Nrcvb
ase-1]
rA
CK
(n)
otherw
ise
rignore
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Sele
ctive re
peat in action
Transport L
ayer
3-5
3
Sele
ctive re
peat
dile
mm
a
Ex
ample
r
seq
rsquos 0 1 2
3
rw
indow
size=3
rre
ceive
r sees no
Transport L
ayer
3-5
4
rre
ceive
r sees no
diffe
rence
in two
scenarios
rincorre
ctly passes
duplicate
data as ne
w
in (a)
Q
wh
at relationsh
ip b
etw
een se
q size
and
wind
ow size
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-5
5
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Ove
rview
RF
Cs 7
93
1122
132
3 2
018
25
81
rfull d
uplex
data
mb
i-dire
ctional data flow
in sam
e conne
ction
mM
SS
max
imum
segm
ent
size
connection-orie
nted
rpoint-to-point
mone
send
er one
rece
iver
rre
liable
in-order b
yte steam
m
no ldquomessage
bound
ariesrdquo
Transport L
ayer
3-5
6
rconne
ction-oriente
d
mh
andsh
aking (ex
change
of control m
sgs) initrsquos se
nder re
ceive
r state
before
data e
xch
ange
rflow
controlled
m
send
er w
ill not ove
rwh
elm
rece
iver
mno ldquom
essage
bound
ariesrdquo
rpipe
lined
m
TC
P congestion and
flow
control set w
indow
size
rsend
amp receive b
uffers
socket
door
TC
P
send b
uffe
r
TC
P
receiv
e b
uffe
r
socket
door
se
gm
en
t
applic
atio
n
write
s d
ata
applic
atio
n
reads d
ata
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P segm
ent structure
source port
dest port
32
bits
seque
nce num
ber
acknowle
dge
ment num
ber
Rece
ive w
indow
Urg d
ata pointer
checksum
FS
RP
AU
head
len
notuse
d
UR
G urge
nt data
(gene
rally not used
)
AC
K A
CK
valid
PSH
push d
ata now(ge
nerally not use
d)
b
ytes
rcvr willing
countingb
y byte
s of d
ata(not se
gments)
Transport L
ayer
3-5
7
applicationd
ata (variab
le le
ngth)
Urg d
ata pointer
checksum
Options (variab
le le
ngth)
RS
T S
YN
FIN
conne
ction estab
(setup te
ardow
ncom
mand
s)
rcvr willing
to accept
Inte
rnet
checksum
(as in UD
P)
TC
P seq
rsquos and A
CK
sS
eq
rsquos
mb
yte stre
am
ldquonumb
errdquo of first
byte
in segm
entrsquos
data
AC
Ksse
q of ne
xt b
yte
Host A
Host B
Use
rtype
slsquoC
rsquoh
ost AC
Ks
rece
ipt oflsquoC
rsquo ech
oes
back lsquoC
rsquo
Transport L
ayer
3-5
8
mse
q of ne
xt b
yte
ex
pecte
d from
oth
er sid
e
mcum
ulative A
CK
Q
how
rece
iver h
andle
s out-of-ord
er se
gments
mA
TC
P spec d
oesnrsquot
say -up to
imple
mente
r
host A
CK
sre
ceipt
of ech
oed
lsquoCrsquo
back lsquoC
rsquotime
simple
telne
t scenario
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P Round
Trip T
ime and
Tim
eout
Q
how
to set T
CP
timeout value
r
longer th
an RT
Tm
but R
TT
varies
rtoo sh
ort prem
ature
timeout
Q
how
to estim
ate R
TT
r
SampleRTT
m
easure
d tim
e from
se
gment transm
ission until AC
K
rece
ipt
mignore
retransm
issions
rSampleRTT
will vary w
ant
Transport L
ayer
3-5
9
timeout
munne
cessary
retransm
issions
rtoo long slow
reaction
to segm
ent loss
SampleRTT
will vary w
ant estim
ated
RT
T ldquosm
ootherrdquo
mave
rage se
veral re
cent
measure
ments not just
current S
ampleRTT
TC
P Round
Trip T
ime and
Tim
eout
EstimatedRTT = (1-
ααα α)EstimatedRTT +
ααα αSampleRTT
rE
xpone
ntial weigh
ted
moving ave
rage
rinflue
nce of past sam
ple d
ecre
ases e
xpone
ntially fast
rtypical value
ααα α=
012
5
Transport L
ayer
3-6
0
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ex
ample
RT
T e
stimation
RT
T g
aiacsum
assed
u to
fantasiaeu
recom
fr
250
300
350
RTT (milliseconds)
Transport L
ayer
3-6
1
100
150
200
18
15
22
29
36
43
50
57
64
71
78
85
92
99
106
time (seco
nn
ds)
RTT (milliseconds)
Sam
ple
RT
TE
stim
ate
d R
TT
TC
P Round
Trip T
ime and
Tim
eout
Setting th
e tim
eout
rEstimtedRTT
plus ldquosafety m
arginrdquom
large variation in E
stimatedRTT -gt
larger safe
ty margin
rfirst e
stimate
of how
much
Sam
pleR
TT
deviate
s from
Estim
ated
RT
T
Transport L
ayer
3-6
2
TimeoutInterval = EstimatedRTT + 4DevRTT
DevRTT = (1-
βββ β)DevRTT +
βββ β|SampleRTT-EstimatedRTT|
(typically
βββ β= 025)
Th
en se
t timeout inte
rval
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-6
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P reliab
le d
ata transfer
rT
CP cre
ates rd
t se
rvice on top of IPrsquos
unreliab
le se
rvice
rpipe
lined
segm
ents
rcum
ulative A
CK
s
rre
transmissions are
trigge
red
by
mtim
eout e
vents
md
uplicate A
CK
s
rinitially consid
er
Transport L
ayer
3-6
4
rcum
ulative A
CK
s
rT
CP use
s single
retransm
ission timer
rinitially consid
er
simplifie
d T
CP se
nder
mignore
duplicate
AC
Ks
mignore
flow control
congestion control
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P send
er e
vents
data rcvd
from app
rcre
ate se
gment w
ith
seq
rse
q is b
yte-stre
am
numb
er of first d
ata b
yte in se
gment
timeout
rre
transmit se
gment
that cause
d tim
eout
rre
start timer
AC
K rcvd
rif acknow
led
ges
Transport L
ayer
3-6
5
byte
in segm
ent
rstart tim
er if not
alread
y running (think
of timer as for old
est
unAC
Ked
segm
ent)
rex
piration interval
TimeOutInterval
rif acknow
led
ges
previously unA
CK
ed
se
gments
mupd
ate w
hat is know
n to b
e A
CK
ed
mstart tim
er if th
ere
are
outstanding se
gments
TC
P se
nder
(simplifie
d)
Ne
xtS
eq
Nu
m =
Initia
lSe
qN
um
Se
nd
Ba
se
= In
itialS
eq
Nu
m
loo
p (fo
reve
r)
sw
itch
(eve
nt)
eve
nt
da
ta re
ce
ive
d fro
m a
pp
lica
tion
ab
ove
cre
ate
TC
P s
eg
me
nt w
ith s
eq
ue
nce
nu
mb
er N
extS
eq
Nu
m
if (time
r cu
rren
tly n
ot ru
nn
ing
)
sta
rt time
r
pa
ss s
eg
me
nt to
IP
Ne
xtS
eq
Nu
m =
Ne
xtS
eq
Nu
m +
len
gth
(da
ta)
eve
nt
time
r time
ou
t
Com
ment
bullS
end
Base
-1 last cum
ulatively
Transport L
ayer
3-6
6
eve
nt
time
r time
ou
t
retra
nsm
it no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nt w
ith
sm
alle
st s
eq
ue
nce
nu
mb
er
sta
rt time
r
eve
nt
AC
K re
ce
ive
d w
ith A
CK
field
va
lue
of y
if (y gt
Se
nd
Ba
se
)
Se
nd
Ba
se
= y
if (the
re a
re c
urre
ntly
no
t-ye
t-ackn
ow
led
ge
d s
eg
me
nts
)
sta
rt time
r
en
d o
f loo
p fo
reve
r
cumulative
ly A
CK
ed
byte
Ex
ample
bull
Send
Base
-1 = 71
y= 73
so the rcvr
wants 7
3+
y gt Send
Base
soth
at new
data is
AC
Ked
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P retransm
ission scenarios
Host A
Host B
Seq=92 timeout
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
7
time
prem
ature tim
eout
Seq=92 timeout
loss
lost AC
K sce
nariotim
e
Seq=92 timeout
Send
Base
= 100
Send
Base
= 120
Send
Base
= 120
Send
base
= 100
TC
P retransm
ission scenarios (m
ore)
Host Aloss
timeout
Host B
X
Transport L
ayer
3-6
8
loss
Cum
ulative A
CK
scenario
time
Send
Base
= 120
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P AC
K ge
neration
[RF
C 112
2 R
FC
25
81]
Event a
t Receiv
er
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
All d
ata
up to
expecte
d s
eq
alre
ady A
CK
ed
Arriv
al o
f in-o
rder s
egm
ent w
ith
TC
P R
eceiv
er a
ctio
n
Dela
yed A
CK
Wait u
p to
500m
s
for n
ext s
egm
ent If n
o n
ext s
egm
ent
send A
CK
Imm
edia
tely
send s
ingle
cum
ula
tive
Transport L
ayer
3-6
9
Arriv
al o
f in-o
rder s
egm
ent w
ith
expecte
d s
eq
One o
ther
segm
ent h
as A
CK
pendin
g
Arriv
al o
f out-o
f-ord
er s
egm
ent
hig
her-th
an-e
xpect s
eq
Gap d
ete
cte
d
Arriv
al o
f segm
ent th
at
partia
lly o
r com
ple
tely
fills g
ap
Imm
edia
tely
send s
ingle
cum
ula
tive
AC
K A
CK
ing b
oth
in-o
rder s
egm
ents
Imm
edia
tely
send d
uplic
ate
AC
K
indic
atin
g s
eq
of n
ext e
xpecte
d b
yte
Imm
edia
te s
end A
CK
pro
vid
ed th
at
segm
ent s
tarts
at lo
wer e
nd o
f gap
Fast R
etransm
it
rtim
e-out pe
riod ofte
n re
latively long
mlong d
elay b
efore
re
send
ing lost packet
rd
ete
ct lost segm
ents
rIf se
nder re
ceive
s 3
AC
Ks for sam
e d
ata it assum
es th
at segm
ent
after A
CK
ed
data w
as lost
Transport L
ayer
3-7
0
rd
ete
ct lost segm
ents
via duplicate
AC
Ks
mse
nder ofte
n send
s m
any segm
ents b
ack-to-b
ack
mif se
gment is lost th
ere
w
ill likely b
e m
any d
uplicate A
CK
s for that
segm
ent
lostm
fast retransm
itre
send
se
gment b
efore
timer
ex
pires
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Host A
Host B
X
seq
x1
seq
x2
seq
x3
seq
x4
seq
x5
AC
K x
1
AC
K x
1A
CK
x1
AC
K x
1
triple
Transport L
ayer
3-7
1
timeout
time
tripled
uplicateA
CK
s
event
AC
K re
ceiv
ed w
ith A
CK
field
valu
e o
f y
if (y gt
SendB
ase)
SendB
ase =
y
if (there
are
curre
ntly
not-y
et-a
ckno
wle
dg
ed s
egm
ents
)
sta
rt timer
Fast re
transmit algorith
mT
ransport Laye
r3-7
2
els
e in
cre
ment c
ount o
f dup A
CK
s re
ceiv
ed fo
r y
if (count o
f dup A
CK
s re
ceiv
ed fo
r y =
3)
resend s
egm
ent w
ith s
equence n
um
ber y
a duplicate
AC
K for
alread
y AC
Ked
segm
ent
fast retransm
it
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
3
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Flow
Control
rre
ceive
side of T
CP
connection h
as a re
ceive
buffe
r
rspeed
-match
ing
send
er w
onrsquot overflow
rece
iverrsquos b
uffer b
ytransm
itting too much
too fast
flow control
(currently)
Transport L
ayer
3-7
4
rspeed
-match
ing service
match
ing se
nd rate
to rece
iving applicationrsquos d
rain rate
rapp proce
ss may b
e
slow at re
ading from
b
uffer
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P Flow
control how
it works
(suppose T
CP re
ceive
r
rre
ceive
r adve
rtises
unused
buffe
r space b
y includ
ing rwnd value
in se
gment h
ead
er
rse
nder lim
its of
unAC
Ked
byte
s to
IP
datagram
sT
CP d
ata(in b
uffer)
(currently)
unused
buffe
rspace
applicationproce
ss
rwndR
cvBuffe
r
Transport L
ayer
3-7
5
(suppose T
CP re
ceive
r d
iscards out-of-ord
er
segm
ents)
runuse
d b
uffer space
= rwnd
= RcvBuffer-[LastByteRcvd -
LastByteRead]
unAC
Ked
byte
s to rwnd
mguarante
es re
ceive
rrsquos b
uffer d
oesnrsquot ove
rflow
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-7
6
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P Conne
ction Manage
ment
Recall
TC
P send
er re
ceive
r estab
lish ldquoconne
ctionrdquo b
efore
ex
changing d
ata se
gments
rinitialize
TC
P variable
s
mse
q s
mb
uffers flow
control info (e
g RcvWindow
)
Th
ree w
ay hand
shake
Ste
p 1clie
nt host se
nds T
CP
SY
N se
gment to se
rver
mspe
cifies initial se
q
mno d
ata
Ste
p 2
serve
r host re
ceive
s S
YN
replie
s with
SY
NA
CK
Transport L
ayer
3-7
7
info (eg R
cvWindow
)
rclient
connection initiator
Socket clientSocket = new
Socket(hostnameport
number)
rserver
contacted
by clie
ntSocket connectionSocket =
welcomeSocketaccept()
SY
N re
plies w
ith S
YN
AC
K
segm
ent
mse
rver allocate
s buffe
rs
mspe
cifies se
rver initial
seq
Ste
p 3
client re
ceive
s SY
NA
CK
re
plies w
ith A
CK
segm
ent
wh
ich m
ay contain data
TC
P Conne
ction Manage
ment (cont)
Closing a conne
ction
client close
s socket
clientSocketclose()
Ste
p 1clie
ntend
system
client
serve
r
close
close
Transport L
ayer
3-7
8
Ste
p 1clie
ntend
system
se
nds T
CP F
IN control
segm
ent to se
rver
Ste
p 2
serve
rre
ceive
s F
IN re
plies w
ith A
CK
C
loses conne
ction send
s F
IN
close
closed
timed wait
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P Conne
ction Manage
ment (cont)
Ste
p 3
client
rece
ives F
IN
replie
s with
AC
K
mE
nters ldquotim
ed
waitrdquo -
will re
spond w
ith A
CK
to re
ceive
d F
INs
client
serve
r
closing
closing
Transport L
ayer
3-7
9
to rece
ived
FIN
s
Ste
p 4
serve
r rece
ives
AC
K C
onnection close
d
Note
w
ith sm
all m
odification can h
andle
sim
ultaneous F
INs
closing
closed
timed wait
closed
TC
P Conne
ction Manage
ment (cont)
TC
P serve
rlife
cycle
Transport L
ayer
3-8
0
TC
P client
lifecycle
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-8
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6Principle
s of conge
stion control
r3
7 T
CP conge
stion control
Principles of C
ongestion C
ontrol
Conge
stionr
informally ldquotoo m
any sources se
nding too m
uch
data too fast for netw
orkto h
andle
rdquo
rd
iffere
nt from flow
control
manife
stations
Transport L
ayer
3-8
2
rm
anifestations
mlost packe
ts (buffe
r overflow
at routers)
mlong d
elays (que
ueing in route
r buffe
rs)
ra top-10
proble
m
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Cause
scosts of congestion sce
nario 1
rtw
o send
ers tw
o re
ceive
rs
rone
router
infinite b
uffers
rno re
transmission
unlim
ited s
hare
d
outp
ut lin
k b
uffe
rs
Host A
λin
orig
inal d
ata
Host B
λout
Transport L
ayer
3-8
3
rno re
transmission
rlarge
delays
wh
en conge
sted
rm
axim
um
achie
vable
th
roughput
Cause
scosts of congestion sce
nario 2
rone
router finite
buffe
rs
rse
nder re
transmission of lost packe
t
Ho
st A
λin
orig
inal
data
λout
λ
orig
inal d
ata
plu
s
Transport L
ayer
3-8
4
finite
sh
are
d o
utp
ut
link b
uffe
rs
Ho
st B
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Cause
scosts of congestion sce
nario 2r
always (good
put)
rldquope
rfectrdquo re
transmission only w
hen loss
rre
transmission of d
elaye
d (not lost) packe
t make
s larger
(than pe
rfect case
) for same
λin
λo
ut
=
λin
λo
ut
gt
λin
λo
ut
R2
R2
R2
Transport L
ayer
3-8
5
ldquocostsrdquo of congestion
rm
ore w
ork (retrans) for give
n ldquogoodputrdquo
runne
ed
ed
retransm
issions link carries m
ultiple copie
s of pkt
R2
λin
λout
b
R2
λin
λout
a
R2
λin
λout
c
R4
R3
Cause
scosts of congestion sce
nario 3
rfour se
nders
rm
ultihop path
s
rtim
eoutre
transmit
λin
Qw
hat h
appens as
and incre
ase
λin
Host A
λin
orig
inal d
ata
λout
λin
orig
inal d
ata
plu
s
retra
nsm
itted d
ata
Transport L
ayer
3-8
6
finite
sh
are
d o
utp
ut
link b
uffe
rs
Host B
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Cause
scosts of congestion sce
nario 3
Host A
Host B
λout
Transport L
ayer
3-8
7
another ldquocostrdquo of conge
stion
rw
hen packe
t droppe
d any ldquoupstre
am transm
ission capacity use
d for th
at packet w
as waste
d
Approach
es tow
ards conge
stion control
end
-end
congestion
controlr
no ex
plicit feed
back from
ne
twork
netw
ork-assisted
conge
stion controlr
routers provid
e fe
ed
back
to end
system
s
two b
road approach
es tow
ards conge
stion control
Transport L
ayer
3-8
8
netw
ork
rconge
stion inferre
d from
end
-system
obse
rved
loss d
elay
rapproach
taken b
y TC
P
to end
system
s
msingle
bit ind
icating conge
stion (SN
A
DE
Cb
it TC
PIP EC
N
AT
M)
mex
plicit rate se
nder
should
send
at
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Case
study A
TM
AB
R conge
stion control
AB
R availab
le b
it rate
rldquoe
lastic service
rdquo
rif se
nderrsquos path
ldquound
erload
ed
rdquo
mse
nder sh
ould use
availab
le b
andw
idth
RM
(resource
manage
ment)
cells
rse
nt by se
nder inte
rsperse
d
with
data ce
lls
rb
its in RM
cell se
t by sw
itches
(ldquonetwork-assisted
rdquo)
Transport L
ayer
3-8
9
available
band
wid
th
rif se
nderrsquos path
conge
sted
mse
nder th
rottled
to m
inimum
guaranteed
rate
(ldquonetwork-assisted
rdquo) m
NI b
itno incre
ase in rate
(m
ild conge
stion)
mC
I bit
congestion
indication
rR
M ce
lls returne
d to se
nder b
y re
ceive
r with
bits intact
Case
study A
TM
AB
R conge
stion control
Transport L
ayer
3-9
0
rtw
o-byte
ER
(ex
plicit rate) fie
ld in R
M ce
llm
congeste
d sw
itch m
ay lower E
R value
in cell
mse
nderrsquo se
nd rate
thus m
axim
um supportab
le rate
on path
rE
FC
I bit in d
ata cells se
t to 1 in congeste
d sw
itchm
if data ce
ll prece
ding R
M ce
ll has E
FC
I set se
nder se
ts CI
bit in re
turned
RM
cell
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Ch
apter 3
outline
r3
1 Transport-laye
r se
rvices
r3
2 M
ultiplex
ing and
dem
ultiplex
ing
r3
3 C
onnectionle
ss
r3
5 C
onnection-orie
nted
transport T
CP
mse
gment structure
mre
liable
data transfe
r
mflow
control
Transport L
ayer
3-9
1
r3
3 C
onnectionle
ss transport U
DP
r3
4 Principle
s of re
liable
data transfe
r
mflow
control
mconne
ction manage
ment
r3
6 Principle
s of conge
stion control
r3
7 T
CP conge
stion control
TC
P congestion control
rgoal T
CP se
nder sh
ould transm
it as fast as possible
b
ut with
out congesting ne
twork
mQ
h
ow to find
rate just
below
congestion le
vel
rd
ece
ntralized
each
TC
P send
er se
ts its own rate
b
ased
on implicit
feed
back
AC
K
segm
ent re
ceive
d (a good
thing) ne
twork not
Transport L
ayer
3-9
2
mA
CK
se
gment re
ceive
d (a good
thing) ne
twork not
congeste
d so incre
ase se
nding rate
mlost segm
entassum
e loss d
ue to conge
sted
ne
twork so d
ecre
ase se
nding rate
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P congestion control b
andw
idth
probing
rldquoprob
ing for band
wid
thrdquo incre
ase transm
ission rate
on rece
ipt of AC
K until e
ventually loss occurs th
en
decre
ase transm
ission rate
mcontinue
to increase
on AC
K d
ecre
ase on loss (since
available
b
andw
idth
is changing d
epe
nding on oth
er conne
ctions in ne
twork)
Transport L
ayer
3-9
3
netw
ork) A
CK
s being re
ceive
d
so increase
rate
X
X
X
X
Xloss so d
ecre
ase rate
sending rate
time
rQ
how
fast to increase
decre
ase
md
etails to follow
TC
Prsquosldquosaw
toothrdquo
beh
avior
TC
P Conge
stion Control d
etails
rse
nder lim
its rate b
y limiting num
ber
of unAC
Ked
byte
s ldquoin pipeline
rdquo
mcwnd
diffe
rs from rwnd
(how
wh
y)
mse
nder lim
ited
bymin(cwndrwnd)
LastByteSent-LastByteAcked
lelele lecwnd
cwnd
Transport L
ayer
3-9
4
send
er lim
ited
bymin(cwndrwnd)
rrough
ly
rcwnd
is dynam
ic function of pe
rceive
d ne
twork conge
stion
rate =
cwnd
RT
Tb
ytesse
c
cwnd
byte
s
RT
T
AC
K(s)
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P Conge
stion Control m
ore d
etails
segm
ent loss e
vent
red
ucing cwnd
rtim
eout no re
sponse
from re
ceive
rm
cut cwnd
to 1
AC
K re
ceive
d incre
ase
cwnd
rslow
start phase
m
increase
ex
ponentially
fast (despite
name) at
Transport L
ayer
3-9
5
mcut c
wnd
to 1
r3
duplicate
AC
Ks at
least som
e se
gments
getting th
rough (re
call fast re
transmit)
mcut c
wnd
in half le
ss aggre
ssively th
an on tim
eout
fast (despite
name) at
connection start or
following tim
eout
rconge
stion avoidance
m
increase
linearly
TC
P Slow
Start
rw
hen conne
ction begins c
wnd
= 1 M
SS
mex
ample
MS
S = 5
00
byte
s amp
RT
T = 2
00
mse
c
minitial rate
= 20
kbps
ravailab
le b
andw
idth
may b
e gtgt
MS
SR
TT
Host A
RTT
Host B
Transport L
ayer
3-9
6
MS
SR
TT
md
esirab
le to quickly ram
p up to re
spectab
le rate
rincre
ase rate
ex
ponentially
until first loss eve
nt or wh
en
thre
shold
reach
ed
md
ouble
cwnd
eve
ry RT
T
md
one b
y increm
enting c
wnd
by 1 for e
very A
CK
rece
ived
time
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Transitioning intoout of slow
start
ssthreshcwnd
thre
shold
maintaine
d b
y TC
P
ron loss e
vent se
t ssthresh
to cwnd2
mre
mem
ber (h
alf of) TC
P rate w
hen conge
stion last occurred
rw
hen c
wnd
gt= ssthresh
transition from slow
start to congestion
avoidance
phase
Transport L
ayer
3-9
7
slo
w
sta
rttim
eout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
KdupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0congestio
n
avoid
ance
TC
P congestion avoid
ance
rw
hen c
wnd gt ssthresh
grow cwnd
linearly
mincre
ase cwnd
by 1
MS
S pe
r RT
T
mapproach
possible
rA
CK
sincre
ase cwnd
by 1 M
SS
per R
TT
ad
ditive
increase
losscut c
wnd
in half
AIM
D
Transport L
ayer
3-9
8
mapproach
possible
conge
stion slower
than in slow
start
mim
plem
entation c
wnd
= cwnd + MSScwnd
for each
AC
K re
ceive
d
rloss
cut cwnd
in half
(non-timeout-d
ete
cted
loss ) m
ultiplicative
decre
ase
AIM
D A
dd
itive I
ncrease
Multiplicative
Decre
ase
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P congestion control F
SM
overvie
w
slo
w
sta
rtcongestio
n
avoid
ance
cw
nd
gt s
sth
resh
loss
time
ou
tlo
ss
time
ou
t
Transport L
ayer
3-9
9
fast
recovery
loss
time
ou
tn
ew
AC
Klo
ss
3d
up
AC
K
loss
3d
up
AC
K
loss
time
ou
t
TC
P congestion control F
SM
details
slo
w
sta
rtcongestio
n
avoid
ance
timeout
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
timeout
Λ
cw
nd gt
ssth
resh
cw
nd =
cw
nd+
MS
SdupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
Kcw
nd =
cw
nd +
MS
S (M
SS
cw
nd)
dupA
CK
count =
0tra
nsm
it new
segm
ent(s
)as a
llow
ed
new
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
dupA
CK
count+
+
duplic
ate
AC
K
Λ
cw
nd =
1 M
SS
ssth
resh =
64 K
BdupA
CK
count =
0
Transport L
ayer
3-1
00
fast
recovery
retra
nsm
it mis
sin
g s
egm
ent
ssth
resh =
cw
nd2
cw
nd =
1 M
SS
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
ssth
resh=
cw
nd2
cw
nd =
ssth
resh +
3re
transm
it mis
sin
g s
egm
ent
dupA
CK
count =
= 3
timeout
ssth
resh =
cw
nd2
cw
nd =
1
dupA
CK
count =
0re
transm
it mis
sin
g s
egm
ent
cw
nd =
cw
nd +
MS
Stra
nsm
it new
segm
ent(s
) as a
llow
ed
duplic
ate
AC
K
cw
nd =
ssth
resh
dupA
CK
count =
0
New
AC
K
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Popular ldquoflavorsrdquo of TC
P
ssthresh
TCP Renowindow size (in segments)
Transport L
ayer
3-1
01
ssthresh
TCP Tahoe
Transmission round
cwnd window size (in segments)
Sum
mary T
CP C
ongestion C
ontrol
rw
hen c
wnd lt ssthresh
send
er in slow
-startph
ase w
indow
grows e
xpone
ntially
rw
hen c
wnd gt= ssthresh
send
er is in conge
stion-avoid
anceph
ase w
indow
grows line
arly
Transport L
ayer
3-1
02
avoidance
phase
wind
ow grow
s linearly
rw
hen triple
duplicate
AC
Koccurs s
sthresh
set
to cwnd2 cwnd
set to ~
ssthresh
rw
hen tim
eout
occurs ssthresh
set to c
wnd2
cwnd
set to 1 M
SS
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
TC
P through
put
rQ
w
hatrsquos ave
rage th
roughout of T
CP as
function of wind
ow size
RT
T
mignoring slow
start
rle
t W b
e w
indow
size w
hen loss occurs
Transport L
ayer
3-1
03
let W
be w
indow
size w
hen loss occurs
mw
hen w
indow
is W th
roughput is W
RT
T
mjust afte
r loss wind
ow d
rops to W2
th
roughput to W
2R
TT
mave
rage th
roughout 7
5 W
RT
T
TC
P Future
s TC
P over ldquolong fat pipe
srdquo
rex
ample
150
0 b
yte se
gments 10
0m
s RT
T w
ant 10
Gb
ps through
put
rre
quires w
indow
size W
= 83
33
3 in-fligh
t se
gments
rth
roughput in te
rms of loss rate
Transport L
ayer
3-1
04
rth
roughput in te
rms of loss rate
r
L = 2
10-10
Wow
rne
w ve
rsions of TC
P for high
-speed
LR
TT
MSS
sdot22
1
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
fairness goal
if K T
CP se
ssions share
same
bottle
neck link of b
andw
idth
R e
ach sh
ould h
ave
average
rate of R
K
TC
P connection 1
TC
P Fairne
ss
Transport L
ayer
3-1
05
bottle
neck
router
capacity R
TC
P conne
ction 2
Wh
y is TC
P fair
Tw
o compe
ting sessions
rA
dd
itive incre
ase give
s slope of 1 as th
roughout incre
ases
rm
ultiplicative d
ecre
ase d
ecre
ases th
roughput proportionally
Requal b
andw
idth
share
Transport L
ayer
3-1
06
RC
onnection 1 th
roughput
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
congestion avoid
ance ad
ditive
increase
loss decre
ase w
indow
by factor of 2
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo
Fairne
ss (more
)
Fairne
ss and U
DP
rm
ultimed
ia apps often
do not use
TC
Pm
do not w
ant rate
throttle
d b
y congestion
control
rinste
ad use
UD
P
Fairne
ss and paralle
l TC
P conne
ctionsr
nothing pre
vents app from
ope
ning parallel
connections b
etw
een 2
h
ostsr
web
brow
sers d
o this
Transport L
ayer
3-1
07
rinste
ad use
UD
Pm
pump aud
iovideo at
constant rate tole
rate
packet loss
rw
eb
brow
sers d
o this
rex
ample
link of rate R
supporting 9
connections
mne
w app asks for 1 T
CP ge
ts rate
R10
mne
w app asks for 11 T
CPs
gets R
2
Ch
apter 3
Sum
mary
rprinciple
s beh
ind transport
layer se
rvices
mm
ultiplex
ing d
em
ultiplex
ing
mre
liable
data transfe
r
flow control
Transport L
ayer
3-1
08
mflow
control
mconge
stion control
rinstantiation and
im
plem
entation in th
e
Interne
t
mU
DP
mT
CP
Nex
t
rle
aving the ne
twork
ldquoed
gerdquo (application
transport layers)
rinto th
e ne
twork
ldquocorerdquo