Documente Academic
Documente Profesional
Documente Cultură
Transport Layer
delay guarantees
bandwidth guarantees
= socket = process
P3 P1
P1 P2 P4 application
application application
host 2 host 3
host 1
Transport Layer 3-6
How demultiplexing works
host receives IP datagrams
each datagram has source 32 bits
IP address, destination IP
address source port # dest port #
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
P2 P1
P1
P3
Sender: Receiver:
treat segment contents Run addition over checksum
as sequence of 16-bit and segment contents
integers check if computed value
checksum: addition (1s equals 0
complement sum) of NO - error detected
segment contents YES - no error detected.
sender puts checksum But maybe errors
value into UDP checksum nonetheless?
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-17
Part 4 outline
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Sender: Receiver:
seq # added to pkt must check if received
two seq. #s (0,1) will packet is duplicate
suffice. Why? state indicates whether
0 or 1 is expected pkt
must check if received seq #
ACK/NAK corrupted
note: receiver can not
twice as many states know if its last
state must remember ACK/NAK received OK
whether current pkt
at sender
has 0 or 1 seq. #
U L/R .008
sender
= = = 0.00027
RTT + L / R 30.008 microsec
onds
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link
network protocol limits use of physical resources!
U L/R .008
sender
= = = 0.00027
RTT + L / R 30.008 microsec
onds
Increase utilization
by a factor of 3!
U 3*L/R .024
sender
= = = 0.0008
RTT + L / R 30.008 microsecon
ds
Transport Layer 3-40
Go-Back-N
Sender:
k-bit seq # in pkt header
window of up to N, consecutive unacked pkts allowed
Different
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new
in (a)
Q: what relationship
between seq # size
and window size?
Window size must be less than half the
sequence number space
But what happens with old stray packets? Transport Layer 3-49
Part 4 outline
overwhelm receiver
door door
TCP TCP
send buffer receive buffer
segment
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=92 timeout
timeout
X
loss
Sendbase
= 100
Seq=92 timeout
SendBase
= 120
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-61
TCP retransmission scenarios (more)
Host A Host B
timeout
X
loss
SendBase
= 120
time
Cumulative ACK scenario
speed-matching
service: matching the
send rate to the
receiving apps drain
rate
app process may be
slow at reading from
buffer
Transport Layer 3-65
TCP Flow control: how it works
seq. #s no data
close
client closes socket:
clientSocket.close();
close
Step 1: client end system
sends TCP FIN control
segment to server
timed wait
Step 2: server receives
FIN, 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!
receivers
one router
Host B shared output
link buffers
24 Kbytes
Saw tooth
behavior: probing
16 Kbytes
for bandwidth
8 Kbytes
time
time
RTT
first loss event:
double CongWin every
RTT
done by incrementing
CongWin for every ACK
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 = 210-10 Wow
New versions of TCP for high-speed needed!
TCP connection 1
bottleneck
TCP
router
connection 2
capacity R
Connection 1 throughput R
First case:
WS/R > RTT + S/R: ACK for
first segment in window
returns before windows
worth of data sent
Second case:
WS/R < RTT + S/R: wait
for ACK after sending
windows worth of data
sent
O/R to transmit
object
first window
object
= S/R
third window
= 4S/R
fourth window
= 8S/R
complete
object transmission
delivered
time at
time at server
client