3rd Edition: Chapter 3

advertisement
1DT066
Distributed Information System
Transport Layer
1
2: Application Layer
Chapter 3
CHAPTER 3: TRANSPORT LAYER




multiplexing/demultipl
exing
reliable data transfer
flow control
congestion control

learn about transport
layer protocols in the
Internet:


UDP: connectionless
transport
TCP: connection-oriented
transport
Transport Layer
Our goals:
 understand principles
behind transport
layer services:
3-2
TRANSPORT VS. NETWORK LAYER
network layer: logical
communication
between hosts
 transport layer: logical
communication
between processes

Transport Layer

relies on, enhances,
network layer services
3-4
MULTIPLEXING/DEMULTIPLEXING
Multiplexing at send host:
gathering data from multiple
sockets, enveloping data with
header (later used for
demultiplexing)
Demultiplexing at rcv host:
delivering received segments
to correct socket
= socket
application
transport
network
link
= process
P3
P1
P1
application
P2
P4
application
transport
transport
network
network
link
link
physical
host 1
physical
physical
host 3
host 2
Transport Layer
3-6
INTERNET TRANSPORT-LAYER PROTOCOLS

reliable, in-order
delivery (TCP)



unreliable, unordered
delivery: UDP


congestion control
flow control
connection setup
no-frills extension of
“best-effort” IP
services not available:


delay guarantees
bandwidth guarantees
network
data link
physical
network
data link
physical
network
data link
physicalnetwork
network
data link
physical
Transport Layer

application
transport
network
data link
physical
data link
physical
network
data link
physical
application
transport
network
data link
physical
3-9
Transport Layer
TCP VS. UDP
310
TCP VS. UDP
Features
(1) Ordered packets
(2) Connectionless
(3) Reliable data delivery
(no packet loss)
(4) Flow control
(5) Congestion control
(6) delay guarantees
(7) bandwidth
guarantees
TCP (Yes/No)
UDP (Yes/No)
TCP VS. UDP
Features
TCP (Yes/No)
UDP (Yes/No)
(1) Ordered packets
Y
N
(2) Connectionless
N
Y
(3) Reliable data delivery
(no packet loss)
Y
N
(4) Flow control
Y
N
(5) Congestion control
Y
N
(6) delay guarantees
N
N
(7) bandwidth
N
N
guarantees
CHAPTER 3 OUTLINE

3.5 Connection-oriented
transport: TCP




segment structure
reliable data transfer
flow control
congestion control
Transport Layer
3.1 Transport-layer
services
 3.2 Multiplexing and
demultiplexing
 3.3 Connectionless
transport: UDP
 3.4 Principles of
reliable data transfer

313
UDP: USER DATAGRAM PROTOCOL
[RFC 768]


“best effort” service, UDP
segments may be:
 lost
 delivered out of order to
app
connectionless:
 no handshaking between
UDP sender, receiver
 each UDP segment
handled independently of
others
Why is there a UDP?




no connection establishment
(which can add delay)
simple: no connection state
at sender, receiver
small segment header
no congestion control: UDP
can blast away as fast as
desired
Transport Layer

“no frills,” “bare bones”
Internet transport protocol
314
UDP: MORE

other UDP uses
DNS
 SNMP
reliable transfer over UDP:
add reliability at application
layer
 application-specific error
recovery!


segment,
including
header
32 bits
source port #
dest port #
length
checksum
Transport Layer

often used for streaming
multimedia apps
 loss tolerant
Length, in
bytes of UDP
 rate sensitive
Application
data
(message)
UDP segment format
315
CHAPTER 3 OUTLINE

3.5 Connection-oriented
transport: TCP




segment structure
reliable data transfer
flow control
congestion control
Transport Layer
3.1 Transport-layer
services
 3.2 Multiplexing and
demultiplexing
 3.3 Connectionless
transport: UDP
 3.4 Principles of
reliable data transfer

316
PRINCIPLES OF RELIABLE DATA
TRANSFER


important in app., transport, link layers
top-10 list of important networking topics!
Transport Layer

characteristics of unreliable channel will determine complexity of reliable data transfer
protocol (rdt)
317
PRINCIPLES OF RELIABLE DATA
TRANSFER


important in app., transport, link layers
top-10 list of important networking topics!
Transport Layer

characteristics of unreliable channel will determine complexity of reliable data transfer
protocol (rdt)
318
PRINCIPLES OF RELIABLE DATA
TRANSFER


important in app., transport, link layers
top-10 list of important networking topics!
Transport Layer

characteristics of unreliable channel will determine complexity of reliable data transfer
protocol (rdt)
319
RDT3.0 EXAMPLE
Transport Layer
320
RDT3.0 EXAMPLE
Transport Layer
321
RDT3.0: STOP-AND-WAIT OPERATION
sender
receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R
Transport Layer
RTT
first packet bit arrives
last packet bit arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R
323
PIPELINED PROTOCOLS
Pipelining: sender allows multiple, “in-flight”, yetto-be-acknowledged pkts


range of sequence numbers must be increased
buffering at sender and/or receiver
Transport Layer

Two generic forms of pipelined protocols: go-Back-N,
3selective repeat
24
PIPELINING: INCREASED UTILIZATION
sender
receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R
Transport Layer
RTT
first packet bit arrives
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
Increase utilization
by a factor of 3!
3-25
PIPELINING PROTOCOLS


doesn’t ACK pkt if
there’s a gap
sender: has timer for
oldest unACKed pkt

if timer expires:
retransmit all
unACKed packets
Selective Repeat: overview
 sender: up to N unACKed
packets in pipeline
 receiver: ACKs individual
pkts
 sender: maintains timer for
each unACKed pkt
Transport Layer
Go-back-N: overview
 sender: up to N
unACKed pkts in
pipeline
 receiver: only sends
cumulative ACKs

if timer expires: retransmit
only unACKed packet
326
GO-BACK-N
Sender:
k-bit seq # in pkt header

“window” of up to N, consecutive unACKed pkts allowed
Transport Layer

 ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”
may receive duplicate ACKs (see receiver)
 timer for each in-flight pkt
3 timeout(n): retransmit pkt n and all higher seq # pkts in window

27
GBN IN
ACTION
Transport Layer
328
GBN DEMO
Transport Layer
http://www.cs.mum.edu/courses/cs450/GoBackN.htm
329
SELECTIVE REPEAT

receiver individually acknowledges all correctly
received pkts

sender only resends pkts for which ACK not
received


buffers pkts, as needed, for eventual in-order delivery to
upper layer
Transport Layer

sender timer for each unACKed pkt
sender window


N consecutive seq #’s
again limits seq #s of sent, unACKed pkts
330
SELECTIVE REPEAT: SENDER,
RECEIVER WINDOWS
Transport Layer
331
SELECTIVE REPEAT IN ACTION
Transport Layer
333
SELECTIVE REPEAT DEMO
Transport Layer
http://www.eecis.udel.edu/~amer/450/TransportApplets/
SR/SRindex.html
335
CHAPTER 3 OUTLINE

3.5 Connection-oriented
transport: TCP




segment structure
reliable data transfer
flow control
Congestion control
Transport Layer
3.1 Transport-layer
services
 3.2 Multiplexing and
demultiplexing
 3.3 Connectionless
transport: UDP
 3.4 Principles of
reliable data transfer

336
TCP: OVERVIEW

socket
door
point-to-point:
reliable, in-order byte
steam:

pipelined:

send & receive buffers
application
writes data
application
reads data
TCP
send buffer
TCP
receive buffer
segment

full duplex data:

connection-oriented:

flow controlled:
socket
door
Transport Layer

RFCS: 793, 1122, 1323, 2018, 2581
337
TCP SEQ. #’S AND ACKS
Host A
User
types
‘C’
Host B
Transport Layer
Seq. #’s:
 byte stream
“number” of first
byte in segment’s
data
ACKs:
 seq # of next byte
expected from other
side
 cumulative ACK
host ACKs
receipt of
‘C’, echoes
back ‘C’
host ACKs
receipt
of echoed
‘C’
simple telnet scenario
time
338
TCP RELIABLE DATA TRANSFER

retransmissions are
triggered by:


timeout events
duplicate ACKs
Transport Layer
TCP creates rdt
service on top of IP’s
unreliable service
 pipelined segments
 cumulative ACKs
 TCP uses single
retransmission timer

339
TCP: RETRANSMISSION SCENARIOS
Host A
X
loss
Sendbase
= 100
SendBase
= 120
SendBase
= 100
time
SendBase
= 120
lost ACK scenario
Host B
Seq=92 timeout
Seq=92 timeout
Host B
Transport Layer
timeout
Host A
time
3premature timeout
40
TCP RETRANSMISSION SCENARIOS
(MORE)
Host B
X
loss
Transport Layer
timeout
Host A
SendBase
= 120
time
Cumulative ACK scenario
341
TCP FLOW CONTROL

flow control
receive side of TCP
connection has a
receive buffer:
(currently)
TCP data application
IP
unused buffer
(in buffer)
process
datagrams
space

Transport Layer
sender won’t overflow
receiver’s buffer by
transmitting too much,
too fast
speed-matching service:
matching send rate to
receiving application’s
drain rate
 app process may be
slow at reading from
buffer
342
PRINCIPLES OF CONGESTION
CONTROL
Transport Layer
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)

344
TCP CONGESTION CONTROL:

goal: TCP sender should transmit as fast as possible,
but without congesting network
Q: how to find rate just below congestion level
 decentralized: each TCP sender sets its own rate,
Transport Layer

based on implicit feedback:
 ACK: segment received (a good thing!), network not
congested, so increase sending rate
 lost segment: assume loss due to congested
network, so decrease sending rate
345
TCP CONGESTION CONTROL: BANDWIDTH
PROBING
 “probing for bandwidth”: increase transmission rate
continue to increase on ACK, decrease on loss (since available
bandwidth is changing, depending on other connections in
network)
ACKs being received,
so increase rate
sending rate

Transport Layer
on receipt of ACK, until eventually loss occurs, then
decrease transmission rate
X
X loss, so decrease rate
X
X
TCP’s
“sawtooth”
behavior
X
time
346
CHAPTER 3: SUMMARY

principles behind transport
layer services:

instantiation and
implementation in the
Internet
UDP
 TCP

Next:
 leaving the network
“edge” (application,
transport layers)
 into the network
“core”
Transport Layer
multiplexing, demultiplexing
 reliable data transfer
 flow control
 congestion control

347
Download