Chapter 3 V6.01
Chapter 3 V6.01
Chapter 3 V6.01
Transport Layer
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
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
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
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
application P4 P5 P6 application
P3 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B
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
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
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
otherwise:
ignore
say, - up to A
checksum
rwnd
urg pointer
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
350
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)
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
SendBase=120
ACK=100
X
ACK=120
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
ACK=100
timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data
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
application application
network network
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
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
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
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
R/2
delay
lout
Host A
lout
sender sends only when
router buffers available
lin R/2
A no buffer space!
Host B
Transport Layer 3-89
Causes/costs of congestion: scenario 2
Idealization: known R/2
lout
retransmissions but
due to full buffers asymptotic goodput
sender only resends if is still R/2 (why?)
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
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
Host D
Host C
lin’ C/2
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
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
Implementation:
variable ssthresh
on loss event, ssthresh
is set to 1/2 of cwnd just
before loss event
W/2
bottleneck
router
capacity R
TCP connection 2
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