CS 372 Lecture #18 The Transport Layer:
• Reliable data transfer with TCP • stop-and-wait
• pipelining
• sliding window
Note: Many of the lecture slides are based on presentations that accompany Computer Networking: A Top Down Approach, 6th edition,
by Jim Kurose & Keith Ross, Addison-Wesley, 2013.
v
Or•egon State University
Efficiency considerations
oTCP’s acknowledgement model is great for reliability …
o… but with what tradeoffs?
oSegment overhead
oEach packet requires at least one RTT
osend segment, wait for ACK oMay increase queuing delay oIncreases network congestion
Performance of “stop-and-wait” #1
sender
first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R
RTT
ACK arrives, send next packet, t = RTT + L / R
first packet bit arrives
last packet bit arrives, send ACK
receiver
= round-trip time (RTT) = 30 ms
transmission delay
= 0.008 ms
= L R
8×103 bits 109 bps
······· •····•··•··•·•··•·•··•··•····• •··•············•·····
Performance of “stop-and-wait” #2
sender
first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R
RTT
ACK arrives, send next packet, t = RTT + L / R
first packet bit arrives
last packet bit arrives, send ACK
receiver
U sender: utilization = time sending / total time (until we can send again)
Usender= L / R = .008 = 0.00027 RTT + L / R 30.008 %
······· •····•··•··•·•··•·•··•··•····• •··•············•·····
Performance of “stop-and-wait” #3
sender
first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R
RTT
ACK arrives, send next packet, t = RTT + L / R
first packet bit arrives
last packet bit arrives, send ACK
receiver
• 1KB packet every 30 msec -> 33Kbps throughput over 1 Gbps link !!!
• “stop-and-wait” protocol limits use of physical resources.
······· •····•··•··•·•··•·•··•··•····• •··•············•·····
Pipelining: increased utilization
sender
first packet bit transmitted, t = 0 last bit transmitted, t = L / R
receiver
RTT
ACK arrives, send next packet, t = RTT + L / R
first packet bit arrives
last packet bit arrives, send ACK
Increase utilization by a factor of 3
Usender= 3*L/R = .024 = 0.0008 RTT + L / R 30.008
·····•••·······••····· •····•••·······••·····
I
Pipelined protocols
Pipelining: Sender transmits multiple packets.
Packets “in-flight” have yet to be acknowledged
(a) a stop-and-wait protocol in operation (b) a pipelined protocol in operation
Problem: receiver might not be able to handle that many packets as fast as they arrive.
Problem: packets might arrive out-of-order
TCP flow control
oreceive side of TCP connection has a receive buffer:
jt—-Rcv\Vindow ~ IP ——–
– – – – RcvBuffer —— • receiver application
layer process reading from buffer may be slow
• speed-matching service: matching the send rate to the receiving application’s drain rate
flow control
sender won’t overflow receiver’s buffer by transmitting too much,
too fast
data from
•
See animations on textbook’s website.
TCP segment structure
32 bits
source port #
header length
not used
destination port #
sequence number
acknowledgement number
checksum
U
A
P
R
S
F
Receive window
Urgent data pointer
Options (variable length, padded to 32 bits)
application data
(variable length)
Header size in bytes (always a multiple of 4)
Flags for urgent data, ACK validity, push, reset, synchronize, final data
Internet checksum (as in UDP)
counting
by bytes
of data
(not segments!)
# bytes receiver is willing to accept
TCP flow control – sliding window
• TCP uses sliding window for flow control
1. 2.
3.
Sender transmits one segment
Receiver specifies window size (window
advertisement ) in ACK header “receive window” – Specifies how many bytes in the data stream can be sent
Sender limits unACKed data to “receive window” – guarantees receive buffer doesn’t overflow
Receiver’s “sliding window”
Sequence
N u m b e r _E x . p e , c t e , d l
1111 DODD D DOD
I
DAllowed to receive
D N o t : a l l o ‘ 1e d to1r1eceiiv1e
Received & Acked
Sender’s “sliding window”
I
• • •’1••·,:•• ·t·.: A··c··k···d··
·-K·-· O. _ : . D :
D – o t U s a b l ,e
Ack. Receive , ·:_u
‘.
Sent Not Acke1d
~
…..
-: e.xt S1e -uence be –
Summary Lecture #18
oEfficiency
o stop-and-wait o pipelining
oflow control
o“receive window” osliding-window protocol
oNext hurdle:
oWhat happens if there are errors in the pipeline?