16 Transport
-
Upload
aaghaz-hussain -
Category
Documents
-
view
214 -
download
0
Transcript of 16 Transport
-
8/8/2019 16 Transport
1/37
15-441 Computer Networking
Lecture 16 Transport Protocols
-
8/8/2019 16 Transport
2/37
Lecture 16: 03-16-2004 2
Outline
Transport introduction
Error recovery
TCP flow control
-
8/8/2019 16 Transport
3/37
Lecture 16: 03-16-2004 3
Transport Protocols
Lowest level end-to-
end protocol. Header generated by
sender is interpreted
only by the destination
Routers view transport
header as part of the
payload
7
7
6
6
5
5
7
7
6
6
5
5
Transport
Transport
IP
IP
Datalink
Datalink
Physical
Physical
Transport
Transport
IP
IP
Datalink
Datalink
Physical
Physical
IP
IP
router
2
2 2
2
1
1 1
1
-
8/8/2019 16 Transport
4/37
Lecture 16: 03-16-2004 4
Functionality Split
Network provides best-effort delivery
End-systems implement many functions Reliability
In-order delivery Demultiplexing
Message boundaries
Connection abstraction
Congestion control
-
8/8/2019 16 Transport
5/37
Lecture 16: 03-16-2004 5
Transport Protocols
UDP provides just integrity and demux
TCP adds Connection-oriented
Reliable Ordered Point-to-point Byte-stream
Full duplex Flow and congestion controlled
-
8/8/2019 16 Transport
6/37
Lecture 16: 03-16-2004 6
UDP: User Datagram Protocol [RFC 768]
No frills, bare bonesInternet transport protocol
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 header
No congestion control: UDPcan blast away as fast asdesired
-
8/8/2019 16 Transport
7/37
-
8/8/2019 16 Transport
8/37Lecture 16: 03-16-2004 8
UDP Checksum
Sender: Treat segment contents as
sequence of 16-bit integers
Checksum: addition (1scomplement sum) of segmentcontents
Sender puts checksum valueinto UDP checksum field
Receiver:
Compute checksum of
received segment
Check if computed checksum
equals checksum field value:
NO - error detected YES - no error detected
But maybe errors
nonethless?
Goal: detect errors (e.g., flipped bits) in transmitted segment optional use!
-
8/8/2019 16 Transport
9/37
-
8/8/2019 16 Transport
10/37Lecture 16: 03-16-2004 10
TCP Header
Source port Destination port
Sequence number
Acknowledgement
Advertised windowHdrLen Flags0
Checksum Urgent pointer
Options (variable)
Data
Flags: SYN
FINRESET
PUSH
URG
ACK
-
8/8/2019 16 Transport
11/37Lecture 16: 03-16-2004 11
Evolution of TCP
1975 1980 1985 1990
1982
TCP & IPRFC 793 & 791
1974
TCP described by
Vint Cerfand Bob Kahn
In IEEE Trans Comm
1983
BSD Unix 4.2supports TCP/IP
1984
Nagels algorithm
to reduce overhead
of small packets;
predicts congestion
collapse
1987
Karns algorithm
to better estimate
round-trip time
1986Congestion
collapse
observed
1988Van Jacobsons
algorithms
congestion avoidance
and congestion control
(mostimplemented in
4.3BSD Tahoe)
1990
4.3BSD Reno
fast retransmit
delayed ACKs
1975
Three-way handshake
Raymond Tomlinson
In SIGCOMM 75
-
8/8/2019 16 Transport
12/37Lecture 16: 03-16-2004 12
TCP Through the 1990s
1993 1994 1996
1994ECN
(Floyd)
Explicit
Congestion
Notification
1993TCP Vegas
(Brakmo et al)
real congestion
avoidance
1994
T/TCP
(Braden)
Transaction
TCP
1996
SACK TCP
(Floyd et al)
Selective
Acknowledgement
1996Hoe
Improving TCP
startup
1996FACK TCP
(Mathis et al)
extension to SACK
-
8/8/2019 16 Transport
13/37Lecture 16: 03-16-2004 13
Outline
Transport introduction
Error recovery
TCP flow control
-
8/8/2019 16 Transport
14/37Lecture 16: 03-16-2004 14
Stop and Wait
Time
Packet
ACKTim
eou
t
ARQ Receiver sends
acknowledgement (ACK)
when it receives packet
Sender waits for ACK and
timeouts if it does not arrive
within some time period
Simplest ARQ protocol
Send a packet, stop and
wait until ACK arrives
Sender Receiver
-
8/8/2019 16 Transport
15/37Lecture 16: 03-16-2004 15
Recovering from Error
Packet
A
CK
Tim
eou
t
Packet
ACK
T
imeou
t
Packet
Tim
eou
t
Packet
ACK
T
imeou
t
Time
Packet
ACK
Tim
eou
t
Packet
ACK
T
imeou
t
ACK lost Packet lost Early timeout
-
8/8/2019 16 Transport
16/37Lecture 16: 03-16-2004 16
How to recognize a duplicate
Performance Can only send one packet per round trip
Problems with Stop and Wait
-
8/8/2019 16 Transport
17/37Lecture 16: 03-16-2004 17
How to Recognize Resends?
Use sequence numbers both packets and acks
Sequence # in packet is finite
-- how big should it be? For stop and wait?
One bit wont send seq #1
until received ACK for seq #0
Pkt0
ACK
0
Pkt0
ACK1
Pkt1ACK0
-
8/8/2019 16 Transport
18/37
-
8/8/2019 16 Transport
19/37Lecture 16: 03-16-2004 19
Sliding Window
Reliable, ordered delivery
Receiver has to hold onto a packet until all priorpackets have arrived
Why might this be difficult for just parallel stop & wait? Sender must prevent buffer overflow at receiver
Circular buffer at sender and receiver Packets in transit buffer size
Advance when sender and receiver agree packets atbeginning have been received
-
8/8/2019 16 Transport
20/37
Lecture 16: 03-16-2004 20
ReceiverReceiverSenderSender
Sender/Receiver State
Sent & Acked Sent Not Acked
OK to Send Not Usable
Max acceptable
Receiver window
Max ACK received Next seqnum
Received & Acked Acceptable Packet
Not Usable
Sender window
Next expected
-
8/8/2019 16 Transport
21/37
-
8/8/2019 16 Transport
22/37
Lecture 16: 03-16-2004 22
Loss Recovery
On reception of out-of-order packet Send nothing (wait for source to timeout) Cumulative ACK (helps source identify loss)
Timeout (Go-Back-N recovery) Set timer upon transmission of packet Retransmit all unacknowledged packets
Performance during loss recovery
No longer have an entire window in transit Can have much more clever loss recovery
-
8/8/2019 16 Transport
23/37
Lecture 16: 03-16-2004 23
Go-Back-N in Action
-
8/8/2019 16 Transport
24/37
Lecture 16: 03-16-2004 24
Selective Repeat
Receiverindividuallyacknowledges all correctlyreceived pkts
Buffers packets, as needed, for eventual in-order delivery
to upper layer
Sender only resends packets for which ACK notreceived
Sender timer for each unACKed packet
Sender window
N consecutive seq #s Again limits seq #s of sent, unACKed packets
-
8/8/2019 16 Transport
25/37
Lecture 16: 03-16-2004 25
Selective Repeat: Sender, ReceiverWindows
-
8/8/2019 16 Transport
26/37
Lecture 16: 03-16-2004 26
Sequence Numbers
How large do sequence numbers need to be? Must be able to detect wrap-around
Depends on sender/receiver window size
E.g. Max seq = 7, send win=recv win=7
If pkts 0..6 are sent succesfully and all acks lost Receiver expects 7,0..5, sender retransmits old 0..6!!!
Max sequence must be send window + recv window
-
8/8/2019 16 Transport
27/37
Lecture 16: 03-16-2004 27
Outline
Transport introduction
Error recovery
TCP flow control
-
8/8/2019 16 Transport
28/37
Lecture 16: 03-16-2004 28
Sequence Number Space
Each byte in byte stream is numbered. 32 bit value
Wraps around
Initial values selected at start up time
TCP breaks up the byte stream in packets. Packet size is limited to the Maximum Segment Size
Each packet has a sequence number. Indicates where it fits in the byte stream
packet 8 packet 9 packet 10
13450 14950 16050 17550
-
8/8/2019 16 Transport
29/37
Lecture 16: 03-16-2004 29
Sequence Numbers
32 Bits, Unsigned Circular Comparison
Why So Big? For sliding window, must have
|Sequence Space| > |Sending Window| + |Receiving Window|
No problem
Also, want to guard against stray packets With IP, packets have maximum lifetime of 120s
Sequence number would wrap around in this time at 286MB/s
0Max
a
b
a < b
0Max
b
a
b < a
-
8/8/2019 16 Transport
30/37
Lecture 16: 03-16-2004 30
TCP Flow Control
TCP is a sliding window protocol For window size n, can send up to n bytes without
receiving an acknowledgement When the data is acknowledged then the window
slides forward
Each packet advertises a window size Indicates number of bytes the receiver has space for
Original TCP always sent entire window Congestion control now limits this
-
8/8/2019 16 Transport
31/37
Lecture 16: 03-16-2004 31
Window Flow Control: Send Side
Sent but not acked Not yet sent
window
Next to be sent
Sent and acked
-
8/8/2019 16 Transport
32/37
Lecture 16: 03-16-2004 32
acknowledged sent to be sent outside window
Source PortSource Port Dest. PortDest. Port
Sequence NumberSequence Number
AcknowledgmentAcknowledgment
HL/FlagsHL/Flags WindowWindow
D. ChecksumD. Checksum Urgent PointerUrgent Pointer
OptionsOptions
Source PortSource Port Dest. PortDest. Port
Sequence NumberSequence Number
AcknowledgmentAcknowledgment
HL/FlagsHL/Flags WindowWindow
D. ChecksumD. Checksum Urgent PointerUrgent Pointer
Options...Options...
Packet Sent Packet Received
App write
Window Flow Control: Send Side
-
8/8/2019 16 Transport
33/37
Lecture 16: 03-16-2004 33
Acked but notdelivered to user
Not yetacked
Receive buffer
window
Window Flow Control: Receive Side
New
What should receiver do?
-
8/8/2019 16 Transport
34/37
Lecture 16: 03-16-2004 34
TCP Persist
What happens if window is 0? Receiver updates window when application reads data
What if this update is lost?
TCP Persist state Sender periodically sends 1 byte packets
Receiver responds with ACK even if it cant store the
packet
-
8/8/2019 16 Transport
35/37
Lecture 16: 03-16-2004 35
Performance Considerations
The window size can be controlled by receivingapplication
Can change the socket buffer size from a default (e.g.8Kbytes) to a maximum value (e.g. 64 Kbytes)
The window size field in the TCP header limits thewindow that the receiver can advertise
16 bits 64 KBytes 10 msec RTT 51 Mbit/second
100 msec RTT 5 Mbit/second TCP options to get around 64KB limit
-
8/8/2019 16 Transport
36/37
Lecture 16: 03-16-2004 36
Important Lessons
Transport service UDP mostly just IP service
TCP congestion controlled, reliable, byte stream
Types of ARQ protocols Stop-and-wait slow, simple
Go-back-n can keep link utilized (except w/ losses)
Selective repeat efficient loss recovery
TCP flow control Sliding window mapping to packet headers
32bit sequence numbers (bytes)
-
8/8/2019 16 Transport
37/37
Next Lecture
TCP connection setup
TCP reliability
Congestion control