Chapter 3 V6.01

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 110

Chapter 3

Transport Layer

A note on the use of these ppt slides:


We’re making these slides freely available to all (faculty, students, readers). Computer
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs. Networking: A Top
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach
 If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
6th edition
 If you post any slides on a www site, that you note that they are adapted Jim Kurose, Keith Ross
from (or perhaps identical to) our slides, and note our copyright of this Addison-Wesley
material.
March 2012
Thanks and enjoy! JFK/KWR

All material copyright 1996-2013


J.F Kurose and K.W. Ross, All Rights Reserved

Transport Layer 3-1


Chapter 3: Transport Layer
our goals:
 understand  learn about Internet
principles behind transport layer
transport layer protocols:
services:  UDP: connectionless
 multiplexing, transport
demultiplexing  TCP: connection-
 reliable data oriented reliable
transfer transport
 flow control  TCP congestion control
 congestion control
Transport Layer 3-2
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-3
Transport services and protocols
application
transport
 provide logical network
data link
communication between app physical

processes running on
different hosts

lo
gi
ca
transport protocols run in

l

en
d-
end systems

en
d
 send side: breaks app

tra
ns
po
messages into

rt
segments, passes to application

network layer transport


network
data link

 rcv side: reassembles physical

segments into
messages, passes to
app layer
Transport Layer 3-4
 more than one transport
Transport vs. network layer
 network layer: household analogy:
logical
communication 12 kids in Ann’s house sending
letters to 12 kids in Bill’s
between hosts house:
 transport layer:  hosts = houses

logical  processes = kids


 app messages = letters in
communication envelopes
between processes  transport protocol = Ann
 relies on, enhances, and Bill who demux to in-
network layer house siblings
services  network-layer protocol =
postal service

Transport Layer 3-5


Internet transport-layer protocols
application
 reliable, in-order transport
network

delivery (TCP)
data link
physical
network
network data link
 congestion control

lo
data link physical

gi
physical

ca
network
 flow control

l
data link

en
physical

d-
en
 connection setup network

d
data link

tra
physical

ns
 unreliable,

po
network

rt
data link

unordered delivery: network


data link
physical

application

UDP physical
network
data link
transport
network
data link
physical
 no-frills extension of physical

“best-effort” IP
 services not
available: Transport Layer 3-6
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-7
Multiplexing/demultiplexing
multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket

application

application P1 P2 application socket


P3 transport P4
process
transport network transport
network link network
link physical link
physical physical

Transport Layer 3-8


How demultiplexing works
 host receives IP 32 bits

datagrams source port # dest port #


 each datagram has
source IP address, other header fields
destination IP address
 each datagram carries application
one transport-layer data
segment (payload)
 each segment has
source, destination port TCP/UDP segment format
number
 host uses IP addresses
& port numbers to Transport Layer 3-9
Connectionless demultiplexing
 recall:
created socket has  recall: when creating
host-local port #: datagram to send into UDP
DatagramSocket mySocket1 socket, must specify
= new  destination IP address
DatagramSocket(12534);
 destination port #

 when host receives IP datagrams with same


dest. port #, but different
UDP segment: source IP addresses and/or
 checks destination source port numbers will
port # in segment be directed to same socket
 directs UDP segment at dest
to socket with that
port # Transport Layer 3-10
Connectionless demux: example
DatagramSocket
DatagramSocket serverSocket = new
DatagramSocket DatagramSocket
mySocket2 = new mySocket1 = new
DatagramSocket (6428); DatagramSocket
(9157); application
(5775);
application P1 application
P3 P4
transport
transport transport
network
network link network
link physical link
physical physical

source port: 6428 source port: ?


dest port: 9157 dest port: ?

source port: 9157 source port: ?


dest port: 6428 dest port: ?

Transport Layer 3-11


Connection-oriented demux
 TCP socket  server host may
identified by 4- support many
tuple: simultaneous TCP
 source IP address sockets:
 source port number  each socket identified
 dest IP address by its own 4-tuple
 dest port number  web servers have
 demux: receiver different sockets for
uses all four values each connecting
to direct segment to client
appropriate socket  non-persistent HTTP
will have different
Transport Layer 3-12
Connection-oriented demux: example

application
application P4 P5 P6 application
P3 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

host: IP source IP,port: B,80 host: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80
three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets Transport Layer 3-13
Connection-oriented demux: example
threaded server
application
application application
P4
P3 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

host: IP source IP,port: B,80 host: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80

Transport Layer 3-14


Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-15
UDP: User Datagram Protocol [RFC 768]
 “no frills,” “bare bones”  UDP use:
Internet transport protocol  streaming multimedia
 “best effort” service, UDP apps (loss tolerant, rate
segments may be: sensitive)
 lost  DNS
 delivered out-of-  SNMP
order to app  reliable transfer over
 connectionless: UDP:
 no handshaking  add reliability at
application layer
between UDP
 application-specific error
sender, receiver recovery!
 each UDP segment
handled
independently of Transport Layer 3-16
UDP: segment header
length, in bytes of
32 bits UDP segment,
source port # dest port # including header

length checksum
why is there a UDP?
 no connection
application establishment (which can
data add delay)
(payload)  simple: no connection
state at sender, receiver
 small header size
UDP segment format
 no congestion control:
UDP can blast away as
fast as desired

Transport Layer 3-17


UDP checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment
sender: receiver:
 treat segment contents,  compute checksum of
including header fields, received segment
as sequence of 16-bit
integers
 check if computed
checksum equals checksum
 checksum: addition
(one’s complement sum) field value:
of segment contents  NO - error detected
 sender puts checksum  YES - no error
value into UDP detected. But maybe
checksum field
errors nonetheless?
More later ….Transport Layer 3-18
Internet checksum: example
example: add two 16-bit integers
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1

sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1

Note: when adding numbers, a carryout from the most


significant bit needs to be added to the result

Transport Layer 3-19


Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-20
Principles of reliable data transfer
 important in application, transport, link
layers
 top-10 list of important networking topics!

 characteristics of unreliable channel will determine


complexity of reliable data transfer protocol (rdt)
Transport Layer 3-21
Principles of reliable data transfer
 important in application, transport, link
layers
 top-10 list of important networking topics!

 characteristics of unreliable channel will determine


complexity of reliable data transfer protocol (rdt)
Transport Layer 3-22
Principles of reliable data transfer
 important in application, transport, link
layers
 top-10 list of important networking topics!

 characteristics of unreliable channel will determine


complexity of reliable data transfer protocol (rdt)
Transport Layer 3-23
Reliable data transfer: getting started
rdt_send(): called from above, deliver_data(): called by
(e.g., by app.). Passed data to rdt to deliver data to upper
deliver to receiver upper layer

send receive
side side

udt_send(): called by rdt, rdt_rcv(): called when packet


to transfer packet over arrives on rcv-side of channel
unreliable channel to receiver

Transport Layer 3-24


Reliable data transfer: getting started
we’ll:
 incrementally develop sender, receiver sides
of reliable data transfer protocol (rdt)
 consider only unidirectional data transfer
 but control info will flow on both directions!
 use finite state machines (FSM) to specify
sender, receiver event causing state transition
actions taken on state transition
state: when in this
“state” next state state state
uniquely determined 1 event
by next event 2
actions

Transport Layer 3-25


rdt1.0: reliable transfer over a reliable channel
 underlying channel perfectly reliable
 no bit errors
 no loss of packets
 separate FSMs for sender, receiver:
 sender sends data into underlying channel
 receiver reads data from underlying channel
Wait for rdt_send(data) Wait for rdt_rcv(packet)
call from call from extract (packet,data)
above packet = make_pkt(data) below deliver_data(data)
udt_send(packet)

sender receiver

Transport Layer 3-26


rdt2.0: channel with bit errors
 underlying channel may flip bits in packet
 checksum to detect bit errors
 the question: how to recover from errors:
 acknowledgements (ACKs): receiver explicitly
tells sender that pkt received OK
 negative acknowledgements (NAKs): receiver
explicitly
How dotells senderrecover
humans that pkt from
had errors
“errors”
 sender retransmits pkt on receipt of NAK
 during conversation?
new mechanisms in rdt2.0 (beyond rdt1.0):
 error detection
 receiver feedback: control msgs (ACK,NAK)
rcvr->sender

Transport Layer 3-27


rdt2.0: channel with bit errors
 underlying channel may flip bits in packet
 checksum to detect bit errors
 the question: how to recover from errors:
 acknowledgements (ACKs): receiver explicitly
tells sender that pkt received OK
 negative acknowledgements (NAKs): receiver
explicitly tells sender that pkt had errors
 sender retransmits pkt on receipt of NAK
 new mechanisms in rdt2.0 (beyond rdt1.0):
 error detection
 feedback: control msgs (ACK,NAK) from
receiver to sender
Transport Layer 3-28
rdt2.0: FSM specification
rdt_send(data)
sndpkt = make_pkt(data, checksum) receiver
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L
call from
sender below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

Transport Layer 3-29


rdt2.0: operation with no errors
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

Transport Layer 3-30


rdt2.0: error scenario
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

Transport Layer 3-31


rdt2.0 has a fatal flaw!
what happens if handling duplicates:
ACK/NAK  sender retransmits current
corrupted? pkt if ACK/NAK
 sender doesn’t know what corrupted
happened at receiver!  sender adds sequence
 can’t just retransmit: number to each pkt
possible duplicate  receiver discards (doesn’t
deliver up) duplicate pkt
stop and wait
sender sends one packet,
then waits for receiver
response

Transport Layer 3-32


rdt2.1: sender, handles garbled ACK/NAKs
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for Wait for
ACK or
isNAK(rcvpkt) )
call 0 from
NAK 0 udt_send(sndpkt)
above
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt) && notcorrupt(rcvpkt)
&& isACK(rcvpkt)
L
L
Wait for Wait for
ACK or call 1 from
rdt_rcv(rcvpkt) && NAK 1 above
( corrupt(rcvpkt) ||
isNAK(rcvpkt) ) rdt_send(data)

udt_send(sndpkt) sndpkt = make_pkt(1, data, checksum)


udt_send(sndpkt)

Transport Layer 3-33


rdt2.1: receiver, handles garbled ACK/NAKs
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq0(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) && rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) (corrupt(rcvpkt)
sndpkt = make_pkt(NAK, chksum) sndpkt = make_pkt(NAK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
Wait for Wait for
rdt_rcv(rcvpkt) && 0 from 1 from rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) && below below not corrupt(rcvpkt) &&
has_seq1(rcvpkt) has_seq0(rcvpkt)
sndpkt = make_pkt(ACK, chksum) sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)

Transport Layer 3-34


rdt2.1: discussion
receiver:
sender:
 must
seq # check
added iftoreceived
pkt packet is duplicate
 state
 two indicates
seq. whether
#’s (0,1) 0 or 1 is expected
will suffice. Why? pkt
seq #
 must check if received ACK/NAK
 note: receiver can not know if its last
corrupted
 ACK/NAK received
twice as many states OK at sender
 state must “remember” whether “expected” pkt
should have seq # of 0 or 1

Transport Layer 3-35


rdt2.2: a NAK-free protocol
 same functionality as rdt2.1, using ACKs
only
 instead of NAK, receiver sends ACK for last
pkt received OK
 receiver must explicitly include seq # of pkt being
ACKed
 duplicate ACK at sender results in same
action as NAK: retransmit current pkt

Transport Layer 3-36


rdt2.2: sender, receiver fragments
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for Wait for
ACK isACK(rcvpkt,1) )
call 0 from
above 0 udt_send(sndpkt)
sender FSM
fragment rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
rdt_rcv(rcvpkt) && && isACK(rcvpkt,0)
(corrupt(rcvpkt) || L
has_seq1(rcvpkt)) Wait for receiver FSM
0 from
udt_send(sndpkt) below fragment
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK1, chksum)
udt_send(sndpkt) Transport Layer 3-37
rdt3.0: channels with errors and loss

new assumption: underlyingapproach:


channel
sender
can also
waits
lose packets (data, ACKs) “reasonable” amount
 checksum, seq. #, ACKs, of time for ACK
retransmissions will
 retransmits if no ACK
be of help … but not enough
received in this time
 if pkt (or ACK) just delayed
(not lost):
 retransmission will be
duplicate, but seq. #’s
already handles this
 receiver must specify
seq # of pkt being
ACKed
 requires countdownTransport
timerLayer 3-38
rdt3.0 sender
rdt_send(data)
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(0, data, checksum) ( corrupt(rcvpkt) ||
udt_send(sndpkt) isACK(rcvpkt,1) )
rdt_rcv(rcvpkt) start_timer L
L Wait for Wait
for timeout
call 0from
ACK0 udt_send(sndpkt)
above
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
timeout for call 1 from
udt_send(sndpkt) ACK1 above
start_timer rdt_rcv(rcvpkt)
rdt_send(data) L
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(1, data, checksum)
( corrupt(rcvpkt) || udt_send(sndpkt)
isACK(rcvpkt,0) ) start_timer
L

Transport Layer 3-39


rdt3.0 in action
sender receiver sender receiver
send pkt0 pkt0 send pkt0 pkt0
rcv pkt0 rcv pkt0
ack0 send ack0 ack0 send ack0
rcv ack0 rcv ack0
send pkt1 pkt1 send pkt1 pkt1
rcv pkt1 X
ack1 send ack1 loss
rcv ack1
send pkt0 pkt0
rcv pkt0 timeout
ack0 send ack0 resend pkt1 pkt1
rcv pkt1
ack1 send ack1
rcv ack1
send pkt0 pkt0
(a) no loss rcv pkt0
ack0 send ack0

(b) packet loss


Transport Layer 3-40
rdt3.0 in action
sender receiver
sender receiver send pkt0 pkt0
send pkt0 pkt0 rcv pkt0
ack0 send ack0
rcv pkt0
send ack0 rcv ack0
ack0 send pkt1 pkt1
rcv ack0 rcv pkt1
send pkt1 pkt1
rcv pkt1 send ack1
ack1 ack1
send ack1
X
loss timeout
resend pkt1 pkt1
rcv pkt1
timeout
resend pkt1 pkt1 rcv ack1 pkt0 (detect duplicate)
rcv pkt1 send pkt0 send ack1
(detect duplicate) ack1
ack1 send ack1 rcv ack1 rcv pkt0
rcv ack1 ack0 send ack0
pkt0 send pkt0 pkt0
send pkt0 rcv pkt0
rcv pkt0 ack0 (detect duplicate)
ack0 send ack0 send ack0

(c) ACK loss (d) premature timeout/ delayed ACK

Transport Layer 3-41


Performance of rdt3.0
 rdt3.0 is correct, but performance stinks
 e.g.: 1 Gbps link, 15 ms prop. delay, 8000 bit
packet: L 8000 bits
Dtrans = R = = 8 microsecs
109 bits/sec

 U sender: utilization – fraction of time sender busy sending


U L/R .008
sender = = = 0.00027
RTT + L / R 30.008

 if RTT=30 msec, 1KB pkt every 30 msec: 33kB/sec thruput


over 1 Gbps link
 network protocol limits use of physical resources!
Transport Layer 3-42
rdt3.0: stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK

ACK arrives, send next


packet, t = RTT + L / R

U L/R .008
sender = = = 0.00027
RTT + L / R 30.008

Transport Layer 3-43


Pipelined protocols
pipelining: sender allows multiple, “in-
flight”, yet-to-be-acknowledged pkts
 range of sequence numbers must be increased
 buffering at sender and/or receiver

 two generic forms of pipelined protocols: go-


Back-N, selective repeat
Transport Layer 3-44
Pipelining: increased utilization
sender receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK
last bit of 3rd packet arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R
3-packet pipelining increases
utilization by a factor of 3!

U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008

Transport Layer 3-45


Pipelined protocols: overview
Go-back-N: Selective Repeat:
 sender can have up  sender can have up to
to N unacked N unack’ed packets in
packets in pipeline pipeline
 receiver only sends  rcvr sends individual
cumulative ack ack for each packet
 doesn’t ack packet if
there’s a gap
 sender has timer for  sender maintains timer
oldest unacked for each unacked
packet packet
 when timer expires,  when timer expires,
retransmit all retransmit only that
unacked packet
Transport Layer 3-46
Go-Back-N: sender
 k-bit seq # in pkt header
 “window” of up to N, consecutive unack’ed pkts allowed

 ACK(n): ACKs all pkts up to, including seq # n - “cumulative


ACK”
 may receive duplicate ACKs (see receiver)
 timer for oldest in-flight pkt
 timeout(n): retransmit packet n and all higher seq # pkts in
window
Transport Layer 3-47
GBN: sender extended FSM
rdt_send(data)
if (nextseqnum < base+N) {
sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)
udt_send(sndpkt[nextseqnum])
if (base == nextseqnum)
start_timer
nextseqnum++
}
L else
refuse_data(data)
base=1
nextseqnum=1
timeout
start_timer
Wait
udt_send(sndpkt[base])
rdt_rcv(rcvpkt) udt_send(sndpkt[base+1])
&& corrupt(rcvpkt) …
udt_send(sndpkt[nextseqnum-
1])
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
base = getacknum(rcvpkt)+1
If (base == nextseqnum)
stop_timer
else
start_timer
Transport Layer 3-48
GBN: receiver extended FSM
default
udt_send(sndpkt) rdt_rcv(rcvpkt)
&& notcurrupt(rcvpkt)
L && hasseqnum(rcvpkt,expectedseqnum)
expectedseqnum=1 Wait extract(rcvpkt,data)
sndpkt = deliver_data(data)
make_pkt(expectedseqnum,ACK,chksum) sndpkt = make_pkt(expectedseqnum,ACK,chksum)
udt_send(sndpkt)
expectedseqnum++

ACK-only: always send ACK for correctly-


received pkt with highest in-order seq #
 may generate duplicate ACKs
 need only remember expectedseqnum
 out-of-order pkt:
 discard (don’t buffer): no receiver buffering!
 re-ACK pkt with highest in-order seq # Transport Layer 3-49
GBN in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
send pkt2 receive pkt0, send ack0
012345678
send pkt3 Xloss receive pkt1, send ack1
012345678
(wait)
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1
012345678 rcv ack1, send pkt5 receive pkt4, discard,
(re)send ack1
ignore duplicate ACK receive pkt5, discard,
(re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
012345678 send pkt4 rcv pkt2, deliver, send ack2
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5

Transport Layer 3-50


Selective repeat
 receiver individually acknowledges all
correctly received pkts
 buffers pkts, as needed, for eventual in-order
delivery to upper layer
 sender only resends pkts for which ACK
not received
 sender timer for each unACKed pkt
 sender window
 N consecutive seq #’s
 limits seq #s of sent, unACKed pkts

Transport Layer 3-51


Selective repeat: sender, receiver windows

Transport Layer 3-52


Selective repeat
sender receiver
data from above: pkt n in [rcvbase, rcvbase+N-1]
 send
if next available seq # in window, send pktACK(n)
 out-of-order: buffer
timeout(n):  in-order: deliver (also
 resend pkt n, restart timer
deliver buffered, in-order
ACK(n) in [sendbase,sendbase+N]: pkts), advance window to
 mark pkt n as received next not-yet-received pkt
 if n smallest unACKed pkt, advance pktwindow
n in [rcvbase-N,rcvbase-1]
base to next
unACKed seq #  ACK(n)

otherwise:
 ignore

Transport Layer 3-53


Selective repeat in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
send pkt2 receive pkt0, send ack0
012345678
send pkt3 Xloss receive pkt1, send ack1
012345678
(wait)
receive pkt3, buffer,
012345678 rcv ack0, send pkt4 send ack3
012345678 rcv ack1, send pkt5 receive pkt4, buffer,
send ack4
record ack3 arrived receive pkt5, buffer,
send ack5
pkt 2 timeout
012345678 send pkt2
012345678 record ack4 arrived
012345678 rcv pkt2; deliver pkt2,
record ack5 arrived
012345678 pkt3, pkt4, pkt5; send ack2

Q: what happens when ack2 arrives?

Transport Layer 3-54


sender window receiver window
Selective repeat: (after receipt) (after receipt)

dilemma 0123012 pkt0


pkt1 0123012
0123012
0123012 pkt2 0123012
example: 0123012 pkt3
0123012

 seq #’s: 0, 1, 2, 3 0123012


X
 window size=3 pkt0 will accept packet
with seq number 0
(a) no problem
 receiver sees no
difference in two receiver can’t see sender side.
scenarios! receiver behavior identical in both cases!
something’s (very) wrong!
 duplicate data
accepted as new in (b) 0123012 pkt0
0123012 pkt1 0123012
pkt2
Q: what relationship 0123012
X
0123012
0123012
between seq # size X
and window size to timeout
retransmit pkt0 X
avoid problem in (b)? 0123012 pkt0
will accept packet
with seq number 0
(b) oops!
Transport Layer 3-55
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-56
TCP: Overview RFCs: 793,1122,1323, 2018, 2581

 point-to-point:  full duplex data:


 one sender, one  bi-directional data
receiver flow in same
 reliable, in-order connection
byte steam:  MSS: maximum
 no “message segment size
boundaries”  connection-
 pipelined: oriented:
 TCP congestion and  handshaking
flow control set (exchange of control
window size msgs) inits sender,
receiver state before
data exchangeTransport Layer 3-57
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UAP R S F receive window
(generally not used) # bytes
checksum Urg data pointer
rcvr willing
RST, SYN, FIN: to accept
options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)

Transport Layer 3-58


TCP seq. numbers, ACKs
outgoing segment from sender
sequence numbers: source port # dest port #
sequence number
byte stream “number” acknowledgement number
rwnd
of first byte in checksum urg pointer

segment’s data window size


N
acknowledgements:
seq # of next byte
sender sequence number space
expected from other
side sent sent, not- usable not
ACKed yet ACKed but not usable
cumulative ACK (“in-flight”) yet sent

Q: how receiver handles out- incoming segment to sender


of-order segments source port # dest port #
sequence number
A: TCP spec doesn’t acknowledgement number

say, - up to A
checksum
rwnd
urg pointer

implementor Transport Layer 3-59


TCP seq. numbers, ACKs
Host A Host B

User
types
‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80

simple telnet scenario

Transport Layer 3-60


TCP round trip time, timeout
Q: how to set TCP Q: how to estimate
timeout value? RTT?
 longer than RTT  SampleRTT: measured
time from segment
 but RTT varies transmission until ACK
 too short: receipt
premature timeout,  ignore
retransmissions
unnecessary  SampleRTT will vary,
retransmissions want estimated RTT
 too long: slow “smoother”
 average several recent
reaction to measurements, not
segment loss just current Transport Layer 3-61
TCP round trip time, timeout
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
 exponential weighted moving average
 influence of past sample decreases exponentially fast
 typical value:  = 0.125 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

350

RTT: gaia.cs.umass.edu to fantasia.eurecom.fr


RTT (milliseconds)

300

250
RTT (milliseconds)

200

sampleRTT
150

EstimatedRTT

100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
time (seconds) Transport Layer 3-62
SampleRTT Estimated RTT
TCP round trip time, timeout
 timeout interval: EstimatedRTT plus “safety
margin”
 large variation in EstimatedRTT -> larger safety margin
 estimate
DevRTTSampleRTT deviation
= (1-)*DevRTT + from EstimatedRTT:
*|SampleRTT-EstimatedRTT|
(typically,  = 0.25)

TimeoutInterval = EstimatedRTT + 4*DevRTT

estimated RTT “safety margin”

Transport Layer 3-63


Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-64
TCP reliable data transfer
 TCP creates rdt
service on top of IP’s
unreliable service
 pipelined segments let’s initially consider
 cumulative acks simplified TCP
 single retransmission sender:
timer  ignore duplicate acks
 retransmissions  ignore flow control,
triggered by: congestion control
 timeout events
 duplicate acks
Transport Layer 3-65
TCP sender events:
data rcvd from app: timeout:
 create segment with  retransmit segment
seq # that caused timeout
 seq # is byte-stream  restart timer
number of first data ack rcvd:
byte in segment  if ack
 start timer if not
acknowledges
already running previously unacked
 think of timer as for segments
oldest unacked  update what is
segment known to be ACKed
 expiration interval:  start timer if there
TimeOutInterval
are still unackedTransport Layer 3-66
TCP sender (simplified)
data received from application above
create segment, seq. #: NextSeqNum
pass segment to IP (i.e., “send”)
NextSeqNum = NextSeqNum + length(data)
if (timer currently not running)
L start timer
NextSeqNum = InitialSeqNum wait
SendBase = InitialSeqNum for
event timeout
retransmit not-yet-acked segment
with smallest seq. #
start timer
ACK received, with ACK field value y
if (y > SendBase) {
SendBase = y
/* SendBase–1: last cumulatively ACKed byte */
if (there are currently not-yet-acked segments)
start timer
else stop timer
} Transport Layer 3-67
TCP: retransmission scenarios
Host A Host B Host A Host B

SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeout

timeout
Seq=100, 20 bytes of data
ACK=100
X
ACK=100
ACK=120

Seq=92, 8 bytes of data Seq=92, 8


SendBase=100 bytes of data
SendBase=120
ACK=100
ACK=120

SendBase=120

lost ACK scenario premature timeout


Transport Layer 3-68
TCP: retransmission scenarios
Host A Host B

Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


timeout

ACK=100
X
ACK=120

Seq=120, 15 bytes of data

cumulative ACK
Transport Layer 3-69
TCP ACK generation [RFC 1122, RFC 2581]
event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK

arrival of in-order segment with immediately send single cumulative


expected seq #. One other ACK, ACKing both in-order segments
segment has ACK pending

arrival of out-of-order segment immediately send duplicate ACK,


higher-than-expect seq. # . indicating seq. # of next expected byte
Gap detected

arrival of segment that immediate send ACK, provided that


partially or completely fills gap segment starts at lower end of gap

Transport Layer 3-70


TCP fast retransmit
 time-out period
often relatively TCP fast retransmit
long: if sender receives 3
ACKs for same data
 long delay before
resending lost (“triple
(“triple duplicate
duplicate ACKs”),
ACKs”),
packet resend unacked
segment with smallest
 detect lost seq #
segments via  likely that unacked
duplicate ACKs. segment lost, so don’t
 sender often sends wait for timeout
many segments
back-to-back
 if segment is lost, Transport Layer 3-71
TCP fast retransmit
Host A Host B

Seq=92, 8 bytes of data


Seq=100, 20 bytes of data
X

ACK=100
timeout

ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data

fast retransmit after sender


receipt of triple duplicate ACK
Transport Layer 3-72
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-73
TCP flow control
application
application may process
remove data from application
TCP socket buffers ….
TCP socket OS
receiver buffers
… slower than TCP
receiver is delivering
(sender is sending) TCP
code

IP
flow control code
receiver controls sender, so
sender won’t overflow receiver’s
buffer by transmitting too much, from sender
too fast
receiver protocol stack

Transport Layer 3-74


TCP flow control
 receiver “advertises” free
buffer space by including to application process
rwnd value in TCP header
of receiver-to-sender
segments RcvBuffer buffered data
 RcvBuffer size set via
socket options (typical default rwnd free buffer space
is 4096 bytes)
 many operating systems
autoadjust RcvBuffer TCP segment payloads
 sender limits amount of
unacked (“in-flight”) data to
receiver-side buffering
receiver’s rwnd value
 guarantees receive buffer
will not overflow
Transport Layer 3-75
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-76
Connection Management
before exchanging data, sender/receiver “handshake”:
 agree to establish connection (each knowing the other willing
to establish connection)
 agree on connection parameters

application application

connection state: ESTAB connection state: ESTAB


connection variables: connection Variables:
seq # client-to-server seq # client-to-server
server-to-client server-to-client
rcvBuffer size rcvBuffer size
at server,client at server,client

network network

Socket clientSocket = Socket connectionSocket =


newSocket("hostname","port welcomeSocket.accept();
number");
Transport Layer 3-77
Agreeing to establish a connection

2-way handshake:
Q: will 2-way
handshake always
Let’s talk work in network?
ESTAB
OK
 variable delays
ESTAB  retransmitted messages (e.g.
req_conn(x)) due to
message loss
 message reordering
choose x
req_conn(x)  can’t “see” other side
ESTAB
acc_conn(x)
ESTAB

Transport Layer 3-78


Agreeing to establish a connection
2-way handshake failure scenarios:

choose x choose x
req_conn(x) req_conn(x)
ESTAB ESTAB
retransmit acc_conn(x) retransmit acc_conn(x)
req_conn(x) req_conn(x)

ESTAB ESTAB
data(x+1) accept
req_conn(x)
retransmit data(x+1)
data(x+1)
connection connection
client x completes server x completes server
client
terminates forgets x terminates forgets x
req_conn(x)

ESTAB ESTAB
data(x+1) accept
half open connection! data(x+1)
(no client!)
Transport Layer 3-79
TCP 3-way handshake

client state server state


LISTEN LISTEN
choose init seq num, x
send TCP SYN msg
SYNSENT SYNbit=1, Seq=x
choose init seq num, y
send TCP SYNACK
msg, acking SYN SYN RCVD
SYNbit=1, Seq=y
ACKbit=1; ACKnum=x+1
received SYNACK(x)
ESTAB indicates server is live;
send ACK for SYNACK;
this segment may contain ACKbit=1, ACKnum=y+1
client-to-server data
received ACK(y)
indicates client is live
ESTAB

Transport Layer 3-80


TCP 3-way handshake:
FSM
closed

Socket connectionSocket =
welcomeSocket.accept();

L Socket clientSocket =
SYN(x) newSocket("hostname","port
number");
SYNACK(seq=y,ACKnum=x+1)
create new socket for listen SYN(seq=x)
communication back to client

SYN SYN
rcvd sent

SYNACK(seq=y,ACKnum=x+1)
ESTAB ACK(ACKnum=y+1)
ACK(ACKnum=y+1)
L

Transport Layer 3-81


TCP: closing a connection
 client, server each close their side of
connection
 send TCP segment with FIN bit = 1
 respond to received FIN with ACK
 on receiving FIN, ACK can be combined with
own FIN
 simultaneous FIN exchanges can be
handled

Transport Layer 3-82


TCP: closing a connection
client state server state
ESTAB ESTAB
clientSocket.close()
FIN_WAIT_1 can no longer FINbit=1, seq=x
send but can
receive data CLOSE_WAIT
ACKbit=1; ACKnum=x+1
can still
FIN_WAIT_2 wait for server send data
close

LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime

CLOSED

Transport Layer 3-83


Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-84
Principles of congestion control
congestion:
 informally: “too many sources sending too
much data too fast for network to handle”
 different from flow control!
 manifestations:
 lost packets (buffer overflow at routers)
 long delays (queueing in router buffers)
 a top-10 problem!

Transport Layer 3-85


Causes/costs of congestion: scenario 1
original data: lin throughput: lout
 two senders, two
receivers Host A

 one router, infinite unlimited shared


buffers output link buffers
 output link capacity: R
 no retransmission
Host B

R/2

delay
lout

lin R/2 lin R/2


 maximum per-connection  large delays as arrival rate,
throughput: R/2 lin, approaches capacity
Transport Layer 3-86
Causes/costs of congestion: scenario 2
 one router, finite buffers
 sender retransmission of timed-out packet
 application-layer input = application-layer
output: lin = lout ‘
 transport-layer input includes retransmissions :
lin lin lin : original data
l'in: original data, plus lout
retransmitted data

Host A

finite shared output


Host B
link buffers
Transport Layer 3-87
Causes/costs of congestion: scenario 2
R/2
idealization: perfect
knowledge

lout
 sender sends only when
router buffers available
lin R/2

lin : original data


copy l'in: original data, plus lout
retransmitted data

A free buffer space!

finite shared output


Host B
link buffers
Transport Layer 3-88
Causes/costs of congestion: scenario 2
Idealization: known
loss packets can be
lost, dropped at router
due to full buffers
 sender only resends if
packet known to be lost
lin : original data
copy lout
l'in: original data, plus
retransmitted data

A no buffer space!

Host B
Transport Layer 3-89
Causes/costs of congestion: scenario 2
Idealization: known R/2

loss packets can be when sending at R/2,


lost, dropped at router some packets are

lout
retransmissions but
due to full buffers asymptotic goodput
 sender only resends if is still R/2 (why?)

packet known to be lost lin R/2

lin : original data


lout
l'in: original data, plus
retransmitted data

A free buffer space!

Host B
Transport Layer 3-90
Causes/costs of congestion: scenario 2
Realistic: duplicates R/2
 packets can be lost, dropped at
router due to full buffers when sending at R/2,
some packets are

lout
 sender times out prematurely, retransmissions
including duplicated
sending two copies, both of that are delivered!
which are delivered R/2
lin

lin
timeout
copy lout
l'in

A free buffer space!

Host B
Transport Layer 3-91
Causes/costs of congestion: scenario 2
Realistic: duplicates R/2
 packets can be lost, dropped at
router due to full buffers when sending at R/2,
some packets are

lout
 sender times out prematurely, retransmissions
including duplicated
sending two copies, both of that are delivered!
which are delivered R/2
lin

“costs” of congestion:
 more work (retrans) for given “goodput”
 unneeded retransmissions: link carries multiple copies of pkt
 decreasing goodput

Transport Layer 3-92


Causes/costs of congestion: scenario 3
 four senders Q: what happens as lin and lin’
 multihop paths increase ?
 timeout/retransmit
A: as red lin’ increases, all arriving
blue pkts at upper queue are
dropped, blue throughput g 0
Host A
lin : original data lout
Host B
l'in: original data, plus
retransmitted data
finite shared output
link buffers

Host D
Host C

Transport Layer 3-93


Causes/costs of congestion: scenario 3
C/2
lout

lin’ C/2

another “cost” of congestion:


 when packet dropped, any “upstream transmission
capacity used for that packet was wasted!

Transport Layer 3-94


Approaches towards congestion control

two broad approaches towards congestion control:

end-end network-assisted
congestion congestion
control: control:
 no explicit feedback  routers provide feedback
from network to end systems
 congestion inferred  single bit
from end-system indicating
observed loss, delay
congestion (SNA,
 approach taken by DECbit, TCP/IP
TCP
ECN, ATM)
 explicit rate for
Transport Layer 3-95
Case study: ATM ABR congestion control

ABR: available bit RM (resource


rate: management) cells:
 “elastic service”  sent by sender, interspersed
 if sender’s path with data cells
“underloaded”:  bits in RM cell set by
 sender should use switches (“network-assisted”)
available  NI bit: no increase in
bandwidth rate (mild congestion)
 if sender’s path  CI bit: congestion
congested: indication
 sender throttled to  RM cells returned to sender
minimum by receiver, with bits intact
guaranteed rate
Transport Layer 3-96
Case study: ATM ABR congestion control

RM cell data cell

 two-byte ER (explicit rate) field in RM cell


 congested switch may lower ER value in cell
 senders’ send rate thus max supportable rate on
path
 EFCI bit in data cells: set to 1 in congested
switch
3-97
 if data cell preceding RM cell has EFCI set,Transport Layer
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
 reliable data transfer
3.4 principles of reliable data transfer
 flow control
 connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-98
TCP congestion control: additive increase
multiplicative decrease
 approach: sender increases transmission rate (window
size), probing for usable bandwidth, until loss occurs
 additive increase: increase cwnd by 1 MSS every
RTT until loss detected
 multiplicative decrease: cut cwnd in half after loss
additively increase window size …
…. until loss occurs (then cut window in half)
congestion window size
cwnd: TCP sender

AIMD saw tooth


behavior: probing
for bandwidth

time
Transport Layer 3-99
TCP Congestion Control: details
sender sequence number space
cwnd TCP sending rate:
 roughly: send cwnd
bytes, wait RTT for
last byte
ACKed sent, not-
last byte
sent ACKS, then send
yet ACKed
(“in-flight”) more bytes
cwnd
~
 sender limits rate ~
RTT
bytes/sec

transmission:
LastByteSent- < cwnd
LastByteAcked

 cwnd is dynamic,
function of perceived Transport Layer 3-100
TCP Slow Start
Host A Host B
 when connection
begins, increase rate
exponentially until one s e gm
ent

RTT
first loss event: two segm
 initially cwnd = 1 en ts

MSS
 double cwnd every four segm
ents
RTT
 done by incrementing
cwnd for every ACK
received time

 summary: initial rate


is slow but ramps up Transport Layer 3-101
TCP: detecting, reacting to loss
 loss indicated by timeout:
 cwnd set to 1 MSS;
 window then grows exponentially (as in slow start) to
threshold, then grows linearly
 loss indicated by 3 duplicate ACKs: TCP RENO
 dup ACKs indicate network capable of delivering
some segments
 cwnd is cut in half window then grows linearly
 TCP Tahoe always sets cwnd to 1 (timeout or 3
duplicate acks)

Transport Layer 3-102


TCP: switching from slow start to CA
Q: when should the
exponential
increase switch to
linear?
A: when cwnd gets
to 1/2 of its value
before timeout.

Implementation:
 variable ssthresh
 on loss event, ssthresh
is set to 1/2 of cwnd just
before loss event

Transport Layer 3-103


Summary: TCP Congestion Control
New
New ACK!
ACK!
duplicate ACK
dupACKcount++ new ACK
new ACK
.
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
cwnd = cwnd+MSS transmit new segment(s), as allowed
dupACKcount = 0
L transmit new segment(s), as allowed
cwnd = 1 MSS
ssthresh = 64 KB cwnd > ssthresh
dupACKcount = 0
slow L congestion
start timeout avoidance
ssthresh = cwnd/2
cwnd = 1 MSS duplicate ACK
timeout dupACKcount = 0 dupACKcount++
ssthresh = cwnd/2 retransmit missing segment
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment
timeout
New
ACK!
ssthresh = cwnd/2
cwnd = 1 New ACK
dupACKcount = 0
retransmit missing segment cwnd = ssthresh dupACKcount == 3
dupACKcount == 3 dupACKcount = 0
ssthresh= cwnd/2 ssthresh= cwnd/2
cwnd = ssthresh + 3 cwnd = ssthresh + 3
retransmit missing segment retransmit missing segment
fast
recovery
duplicate ACK
cwnd = cwnd + MSS
transmit new segment(s), as allowed

Transport Layer 3-104


TCP throughput
 avg. TCP thruput as function of window size, RTT?
 ignore slow start, assume always data to send
 W: window size (measured in bytes) where loss occurs
 avg. window size (# in-flight bytes) is ¾ W
 avg. thruput is 3/4W per RTT
3 W
avg TCP thruput = bytes/sec
4 RTT

W/2

Transport Layer 3-105


TCP Futures: TCP over “long, fat pipes”
 example: 1500 byte segments, 100ms RTT, want
10 Gbps throughput
 requires W = 83,333 in-flight segments
 throughput in terms of segment loss probability, L
[Mathis 1997]:
1.22 . MSS
TCP throughput =
RTT L

➜ to achieve 10 Gbps throughput, need a loss rate of L =


2·10-10 – a very small loss rate!
 new versions of TCP for high-speed

Transport Layer 3-106


TCP Fairness
fairness goal: if K TCP sessions share same
bottleneck link of bandwidth R, each
should have average rate of R/K
TCP connection 1

bottleneck
router
capacity R
TCP connection 2

Transport Layer 3-107


Why is TCP fair?
two competing sessions:
 additive increase gives slope of 1, as throughout increases
 multiplicative decrease decreases throughput proportionally
R equal bandwidth share
Connection 2 throughput

loss: decrease window by factor of 2


congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase

Connection 1 throughput R
Transport Layer 3-108
Fairness (more)
Fairness and UDP Fairness, parallel TCP
 multimedia apps connections
often do not use  application can open
TCP multiple parallel
 do not want rate connections between
throttled by two hosts
congestion control
 web browsers do this
 instead use UDP:
 e.g., link of rate R with
 send audio/video at
constant rate, 9 existing connections:
tolerate packet loss  new app asks for 1 TCP, gets rate
R/10
 new app asks for 11 TCPs, gets R/2
Transport Layer 3-109
Chapter 3: summary
 principles behind
transport layer
services: next:
 multiplexing,
 leaving the
demultiplexing
 reliable data transfer network “edge”
 flow control (application,
 congestion control transport layers)
 into the network
 instantiation,
implementation in the “core”
Internet
 UDP
Transport Layer 3-110

You might also like