Professional Documents
Culture Documents
Chapter3 - NS Transport Layer - P Hoang
Chapter3 - NS Transport Layer - P Hoang
Transport Layer
lo
gi
ca
transport protocols run in end
le
nd
systems
-e
nd
send side: breaks app
tr
an
messages into segments,
pos
passes to network layer
rt
rcv side: reassembles application
transport
segments into messages, network
data link
passes to app layer physical
lo
physical network
gi
data link
flow control
ca
physical
le
connection setup
nd
-e
nd
unreliable, unordered network
tr
data link
an
physicalnetwork
delivery: UDP
s
data link
po
physical
r
t
no-frills extension of network
data link
application
“best-effort” IP physical network
data link
transport
network
services not available: physical data link
physical
delay guarantees
bandwidth guarantees
P3 P1
P1 P2 P4 application
application application
host 2 host 3
host 1
Transport Layer 3-8
How demultiplexing works
host receives IP datagrams
each datagram has source IP
address, destination IP address 32 bits
each datagram carries 1
source port # dest port #
transport-layer segment
each segment has source,
destination port number other header fields
host uses IP addresses & port
numbers to direct segment to
appropriate socket
application
data
(message)
P2 P1
P1
P3
P1 P4 P5 P6 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
P1 P4 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
Sender: Receiver:
treat segment contents as compute checksum of received
sequence of 16-bit segment
integers check if computed checksum
checksum: addition (1’s equals checksum field value:
complement sum) of NO - error detected
segment contents YES - no error detected.
sender puts checksum But maybe errors
value into UDP checksum nonetheless? More later ….
field
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Transport Layer 3-19
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
3.3 Connectionless
flow control
connection management
transport: UDP
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
L 8000bits
d trans 9
8 microseconds
R 10 bps
U sender : utilization – fraction of time sender busy sending
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R microsec
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link onds
network protocol limits use of physical resources!
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R microsec
onds
Increase utilization
by a factor of 3!
U 3*L/R .024
= = = 0.0008
sender 30.008
RTT + L / R microsecon
ds
Transport Layer 3-44
Pipelining Protocols
Go-back-N: big picture: Selective Repeat: big pic
Sender can have up to Sender can have up to
N unacked packets in N unacked packets in
pipeline pipeline
Rcvr only sends Rcvr acks individual
cumulative acks packets
Doesn’t ack packet if Sender maintains
there’s a gap timer for each
Sender has timer for unacked packet
oldest unacked packet When timer expires,
If timer expires, retransmit only unack
retransmit all unacked packet
packets
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new in
(a)
Q: what relationship
between seq # size and
window size?
Transport Layer 3-55
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
3.3 Connectionless
flow control
connection management
transport: UDP
3.6 Principles of
3.4 Principles of
reliable data transfer congestion control
3.7 TCP congestion
control
side
cumulative ACK host ACKs
receipt Seq=4
Q: how receiver handles of echoed 3, ACK
=80
out-of-order segments ‘C’
A: TCP spec doesn’t
say, - up to
time
implementor
simple telnet scenario
350
300
250
RTT (milliseconds)
200
150
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
Seq=9 Seq=9
2, 8 b 2, 8 b
y t es d y t es d
at a Seq= at a
Seq=92 timeout
100,
20 b y
t es d
ata
timeout
=100
ACK 0
10
X CK
A AC
=
K =120
loss
Seq=9 Seq=9
2, 8 b
2, 8 b
y t es d Sendbase y t es d
at a
at a
= 100
Seq=92 timeout
SendBase
= 120 =1 20
K
CK =100 AC
A
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-68
TCP retransmission scenarios (more)
Host A Host B
Seq=9
2, 8 b
y t es d
at a
=100
timeout
Seq=1 A CK
00 , 2 0
b y t es
dat a
X
loss
SendBase CK =120
A
= 120
time
Cumulative ACK scenario
X
timeout
r es e n
d 2 nd s
egme
nt
time
speed-matching
service: matching the
send rate to the
receiving app’s drain
rate
app process may be
slow at reading from
buffer
Transport Layer 3-75
TCP Flow control: how it works
Rcvr advertises spare
room by including value
of RcvWindow in
segments
Sender limits unACKed
(Suppose TCP receiver data to RcvWindow
discards out-of-order guarantees receive
segments) buffer doesn’t overflow
spare room in buffer
= RcvWindow
= RcvBuffer-[LastByteRcvd -
LastByteRead]
timed wait
ACK
replies with ACK. Closes
connection, sends FIN.
closed
closed
TCP server
lifecycle
TCP client
lifecycle
Congestion:
informally: “too many sources sending too much
data too fast for network to handle”
different from flow control!
manifestations:
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem!
infinite buffers
no retransmission
large delays
when congested
maximum
achievable
throughput
Transport Layer 3-84
Causes/costs of congestion: scenario 2
one router, finite buffers
sender retransmission of lost packet
R/3
out
out
out
R/4
a. b. c.
“costs” of congestion:
more work (retrans) for given “goodput”
unneeded retransmissions: link carries multiple copies of pkt
Host B
H
o
s
t
B
congestion
window
congestion window size
24 K bytes
Saw tooth
behavior: probing
16 K bytes
for bandwidth
8 K bytes
time
time
RTT
first loss event:
two segm
double CongWin every en ts
RTT
done by incrementing
CongWin for every ACK four segm
ents
received
Summary: initial rate
is slow but ramps up
exponentially fast time
Implementation:
Variable Threshold
At loss event, Threshold is
set to 1/2 of CongWin just
before loss event
1.22 MSS
RTT L
➜ L = 2·10-10 Wow
New versions of TCP for high-speed
TCP connection 1
bottleneck
TCP
router
connection 2
capacity R
Connection 1 throughput R