0% found this document useful (0 votes)
4 views113 pages

Chapter 3 V7.01 Accessible

The document discusses the transport layer of computer networking, focusing on key services such as multiplexing, reliable data transfer, flow control, and congestion control. It explains the differences between connectionless transport using UDP and connection-oriented reliable transport using TCP, including their respective functionalities and protocols. Additionally, it outlines the principles of reliable data transfer and the mechanisms for error detection and recovery in data communication.

Uploaded by

Hồng Phát
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views113 pages

Chapter 3 V7.01 Accessible

The document discusses the transport layer of computer networking, focusing on key services such as multiplexing, reliable data transfer, flow control, and congestion control. It explains the differences between connectionless transport using UDP and connection-oriented reliable transport using TCP, including their respective functionalities and protocols. Additionally, it outlines the principles of reliable data transfer and the mechanisms for error detection and recovery in data communication.

Uploaded by

Hồng Phát
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 113

Computer Networking: A Top Down

Approach
Seventh Edition

Chapter 3
Transport Layer

Slides in this presentation contain


hyperlinks. JAWS users should be able to
get a list of links by using INSERT+F7

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Transport Layer
our goals:
• understand principles behind transport layer services:
– multiplexing, demultiplexing
– reliable data transfer
– flow control
– congestion control
• learn about Internet transport layer protocols:
– UDP: connectionless transport
– TCP: connection-oriented reliable transport
– TCP congestion control
Learning Objectives (1 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control


Transport Services and Protocols
• provide logical communication
between app processes running on
different hosts
• transport protocols run in end
systems
– send side: breaks app
messages into segments,
passes to network layer
– rcv side: reassembles
segments into messages,
passes to app layer
• more than one transport protocol
available to apps
– Internet: TCP and UDP

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Transport vs. Network Layer
• network layer: logical communication between hosts

• transport layer: logical communication between processes


– relies on, enhances, network layer services

household analogy:

12 kids in Ann’s house sending letters to 12 kids in Bill’s house:


• hosts = houses

• processes = kids

• app messages = letters in envelopes

• transport protocol = Ann and Bill who demux to in-house siblings

• network-layer protocol = postal service

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Internet Transport-Layer Protocols
• reliable, in-order delivery (T CP)
– congestion control
– flow control
– connection setup
• unreliable, unordered delivery: U DP
– no-frills extension of “best-
effort” IP
• services not available:
– delay guarantees
– bandwidth guarantees

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (2 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Multiplexing/Demultiplexing

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
How Demultiplexing Works
• host receives IP datagrams
– each datagram has
source IP address,
destination IP address
– each datagram carries
one transport-layer
segment
– each segment has source,
destination port number
• host uses IP addresses &
port numbers to direct
segment to appropriate
socket
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connectionless Demultiplexing
• recall: created socket has • recall: when creating
host-local port #: datagram to send into U DP
socket, must specify
– destination IP address
– destination port #

• when host receives U DP IP datagrams with same


segment: dest. port #, but different
– checks destination port source IP addresses and/or
# in segment source port numbers will be
– directs UDP segment to directed to same socket at
socket with that port # dest

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connectionless Demux: Example

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connection-Oriented Demux
• TCP socket identified by 4-tuple:
– source IP address
– source port number
– dest IP address
– dest port number
• demux: receiver uses all four values to direct segment to
appropriate socket
• server host may support many simultaneous T CP sockets:
– each socket identified by its own 4-tuple
• web servers have different sockets for each connecting
client
– non-persistent HTTP will have different socket for each
request Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connection-Oriented Demux: Example (1 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connection-Oriented Demux: Example (2 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (3 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
UDP: User Datagram Protocol [RFC 768]
• “no frills,” “bare bones” Internet • UDP use:
transport protocol – streaming multimedia
• “best effort” service, UDP apps (loss tolerant,
segments may be: rate sensitive)
– lost – DNS
– delivered out-of-order to – SNMP
app • reliable transfer over UDP:
• connectionless: – add reliability at
– no handshaking between application layer
UDP sender, receiver – application-specific
– each UDP segment error recovery!
handled independently of
others
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
UDP: Segment Header (1 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
UDP: Segment Header (2 of 2)
why is there a UDP?
• no connection establishment (which can add delay)
• simple: no connection state at sender, receiver
• small header size
• no congestion control: UDP can blast away as fast as
desired

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
UDP Checksum
Goal: detect “errors” (example, flipped bits) in transmitted segment

sender: receiver:
• treat segment contents, • compute checksum of
including header fields, as received segment
sequence of 16-bit integers
• check if computed
• checksum: addition (one’s checksum equals
complement sum) of checksum field value:
segment contents – NO - error detected
• sender puts checksum – YES - no error detected.
value into UDP checksum But maybe errors
field nonetheless? More
later ….
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Internet Checksum: Example
example: add two 16-bit integers

Note: when adding numbers, a carryout from the


most significant bit needs to be added to the result
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (4 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Principles of Reliable Data Transfer
• important in application, transport, link layers
– top-10 list of important networking topics!

• characteristics of unreliable channel will determine complexity of


reliable data transfer protocol (r dt)
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Reliable Data Transfer: Getting Started (1 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Reliable Data Transfer: Getting Started (2 of 2)
we’ll:
• incrementally develop sender, receiver sides of reliable data
transfer protocol (r dt)
• consider only unidirectional data transfer
– but control info will flow on both directions!
• use finite state machines (FSM) to specify sender, receiver

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt1.0: Reliable Transfer over a Reliable
Channel

• underlying channel perfectly reliable


– no bit errors
– no loss of packets
• separate FSMs for sender, receiver:
– sender sends data into underlying channel
– receiver reads data from underlying channel

sender receiver

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0: Channel with Bit Errors (1 of 2)
• underlying channel may flip bits in packet
– checksum to detect bit errors
• the question: how to recover from errors:

How do humans recover from


“errors” during
conversation?

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0: Channel with Bit Errors (2 of 2)
• underlying channel may flip bits in packet
– checksum to detect bit errors
• the question: how to recover from errors:
– acknowledgements (ACKs): receiver explicitly tells
sender that pkt received OK
– negative acknowledgements (N AKs): receiver
explicitly tells sender that pkt had errors
– sender retransmits pkt on receipt of N AK
• new mechanisms in rdt2.0 (beyond rdt1.0):
– error detection
– feedback: control msgs (ACK, NAK) from receiver to
sender
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0: FSM Specification
sender receiver

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0: Operation with No Errors

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0: Error Scenario

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.0 Has a Fatal Flaw!
what happens if ACK / handling duplicates:
NAK corrupted?
• sender retransmits
• sender doesn’t know current pkt if ACK / NAK
what happened at corrupted
receiver!
• sender adds sequence
• Can’t just retransmit: number to each pkt
possible duplicate
• receiver discards
(doesn’t deliver up)
stop and wait duplicate pkt

sender sends one packet, then waits for


receiver response
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.1: Sender, Handles Garbled ACK/NAKs

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.1: Receiver, Handles Garbled ACK/NAKs

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.1: Discussion
sender: receiver:
• seq # added to pkt • must check if received
packet is duplicate
• two Sequence #’s (0,1) will
suffice. Why? – state indicates
whether 0 or 1 is
• must check if received ACK/ expected pkt seq #
NAK corrupted
• note: receiver can not
• twice as many states know if its last ACK/NAK
– state must “remember” received OK at sender
whether “expected” pkt
should have seq # of 0 or
1
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.2: A NAK-free Protocol
• same functionality as rdt2.1, using ACKs only
• instead of NAK, receiver sends ACK for last pkt
received OK
– receiver must explicitly include seq # of pkt
being ACKed
• duplicate ACK at sender results in same action as
NAK: retransmit current pkt

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt2.2: Sender, Receiver Fragments

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt3.0: Channels with Errors and Loss
new assumption: underlying channel can also lose packets (data,
ACKs)
– checksum, Sequence #, ACKs, retransmissions will be of
help … but not enough
approach: sender waits “reasonable” amount of time for A CK
• retransmits if no ACK received in this time
• if pkt (or ACK) just delayed (not lost):
– retransmission will be duplicate, but Sequence #’s already
handles this
– receiver must specify seq # of pkt being ACKed

• requires countdown timer

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt3.0 Sender

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt3.0 in Action (1 of 2)
(a) no loss (b) packet loss

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt3.0 in Action (2 of 2)
(c) ACK loss (d) premature timeout/ delayed ACK

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Performance of rdt3.0 (1 of 2)
• rdt3.0 is correct, but performance stinks
• example: 1 Gbps link, 15 ms prop. delay, 8000 bit
packet:
L 8000 bits / packet
dtrans   9
8 microseconds
R 10 bits / sec

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Performance of rdt3.0 (2 of 2)
– Usender: utilization – fraction of time sender
busy sending
L
R .008
Usender   0.00027
L 30.008
RTT +
R

– if RTT = 30 msec, 1KB pkt every 30 msec: 33k


B/sec thruput over 1 Gbps link
• network protocol limits use of physical resources!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
rdt3.0: Stop-and-wait Operation

L
R .008
Usender   0.00027
L 30.008
RTT +
R
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Pipelined Protocols
• pipelining: sender allows multiple, “in-flight”, yet-to-be acknowledged pkts
– range of sequence numbers must be increased
– buffering at sender and/or receiver

• two generic forms of pipelined protocols: go-Back-N, selective


repeat
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Pipelining: Increased Utilization

3-packet pipelining
increases utilization by
a factor of 3!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Pipelined Protocols: Overview
Go-back-N: Selective Repeat:
• sender can have up to N • sender can have up to N
unacked packets in unack’ed packets in pipeline
pipeline
• rcvr sends individual ack
• receiver only sends for each packet
cumulative ack
• sender maintains timer for
– doesn’t ack packet if
each unacked packet
there’s a gap
– when timer expires,
• sender has timer for oldest retransmit only that
unacked packet unacked packet
– when timer expires,
retransmit all unacked
packets
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Go-Back-N: Sender
• k-bit seq # in pkt header
• “window” of up to N, consecutive unack’ed pkts allowed

• ACK (n): ACKs all pkts up to, including seq # n –


“cumulative ACK”
– may receive duplicate ACKs (see receiver)
• timer for oldest in-flight pkt
• timeout(n): retransmit packet n and all higher seq # pkts
in window
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
GBN: Sender Extended FSM

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
GBN: Receiver Extended FSM (1 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
GBN: Receiver Extended FSM (2 of 2)
• ACK-only: always send ACK for correctly-received pkt
with highest in-order seq #
– may generate duplicate ACKs
– need only remember expectedseqnum
• out-of-order pkt:
– discard (don’t buffer): no receiver buffering!
– re-ACK pkt with highest in-order seq #

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
GBN in Action

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat (1 of 3)
• receiver individually acknowledges all correctly
received pkts
– buffers pkts, as needed, for eventual in-order
delivery to upper layer
• sender only resends pkts for which ACK not
received
– sender timer for each unACKed pkt
• sender window
– N consecutive seq #’s
– limits seq #s of sent, unACKed pkts

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat: Sender, Receiver
Windows

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat (2 of 3)
sender
data from above:
• if next available seq # in window, send pkt

timeout(n):
• resend pkt n, restart timer

ACK(n) in [sendbase,sendbase+N]:
• mark pkt n as received
• if n smallest unACKed pkt, advance window base to
next unACKed seq #

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat (3 of 3)
receiver
pkt n in [rcvbase, rcvbase+N-1]
• send ACK(n)
• out-of-order: buffer
• in-order: deliver (also deliver buffered, in-order pkts), advance
window to next not-yet-received pkt
pkt n in [rcvbase-N,rcvbase-1]
• ACK(n)
otherwise:
• ignore
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat in Action

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat: Dilemma (1 of 2)
• example: (a) no problem
• seq #’s: 0, 1, 2, 3

• window size=3

• receiver sees no difference


in two scenarios!
• duplicate data accepted as
new in (b)

receiver can’t see sender side. receiver behavior identical in both cases!
something’s (very) wrong!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Selective Repeat: Dilemma (2 of 2)
Q: what relationship between seq # size and window size to avoid problem in
(b)?
(b) oops!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (5 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: T CP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Overview RFCs: 793, 1122, 1323, 2018,
2581
• point-to-point: – MSS: maximum segment
– one sender, one receiver size

• reliable, in-order byte steam: • connection-oriented:


– no “message boundaries” – handshaking (exchange
of control msgs) inits
• pipelined: sender, receiver state
– TCP congestion and flow before data exchange
control set window size
• flow controlled:
• full duplex data: – sender will not
– bi-directional data flow in overwhelm receiver
same connection

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Segment Structure

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Sequence Numbers, ACKs (1 of 2)
sequence numbers:
– byte stream “number” of
first byte in segment’s
data
acknowledgements:
– seq # of next byte
expected from other side
– cumulative ACK

Q: how receiver handles out-of-


order segments
– A: TCP spec doesn’t say,
- up to implementor

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Sequence Numbers, ACKs (2 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Round Trip Time, Timeout (1 of 3)
Q: how to set TCP Q: how to estimate RTT?
timeout value?
• SampleR TT: measured
• longer than RTT time from segment
– but RTT varies transmission until ACK
receipt
• too short: premature – ignore retransmissions
timeout, unnecessary
retransmissions • SampleR TT will vary, want
estimated RTT “smoother”
• too long: slow
– average several
reaction to segment
loss recent measurements,
not just current
SampleR TT
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Round Trip Time, Timeout (2 of 3)
EstimatedRTT = (1-α)*EstimatedRTT + α *SampleRTT
• exponential weighted moving average

• influence of past sample decreases exponentially fast

• typical value:  = 0.125

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Round Trip Time, Timeout (3 of 3)
• timeout interval: EstimatedRTT plus “safety margin”
– large variation in EstimatedRTT  larger safety margin.
• estimate SampleRTT deviation from EstimatedRTT:
DevRTT = (1-β)* DevRTT +
β* SampleRTT - EstimatedRTT
(typically,β = 0.25)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (6 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: T CP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Reliable Data Transfer
• TCP creates rdt service on top of IP’s unreliable service
– pipelined segments
– cumulative acks
– single retransmission timer
• retransmissions triggered by:
– timeout events
– duplicate acks
• let’s initially consider simplified T CP sender:
– ignore duplicate acks
– ignore flow control, congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Sender Events:
data rcvd from app: timeout:

• create segment with seq • retransmit segment that


# caused timeout

• seq # is byte-stream • restart timer


number of first data byte ack rcvd:
in segment
• if ack acknowledges
• start timer if not already previously unacked
running segments
– think of timer as for – update what is known
oldest unacked to be ACKed
segment – start timer if there are
still unacked segments
– expiration interval:
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TimeOutInterval
TCP Sender (Simplified)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Retransmission Scenarios (1 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Retransmission Scenarios (2 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP ACK Generation [RFC 1122, RFC 2581]
event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK
arrival of in-order segment with immediately send single cumulative
expected seq #. One other ACK, ACKing both in-order segments
segment has ACK pending
arrival of out-of-order segment immediately send duplicate ACK,
higher-than-expect Sequence # . indicating Sequence # of next
Gap detected expected byte
arrival of segment that immediate send ACK, provided that
partially or completely fills gap segment starts at lower end of gap

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Fast Retransmit (1 of 2)
• time-out period often relatively long:
– long delay before resending lost packet
• detect lost segments via duplicate A CKs.
– sender often sends many segments back-to-back
– if segment is lost, there will likely be many duplicate A CKs.

TCP fast retransmit


if sender receives 3 ACKs for same data (“triple duplicate
ACKs”), resend unacked segment with smallest seq #
– likely that unacked segment lost, so don’t wait for
timeout

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Fast Retransmit (2 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (7 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: T CP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Flow Control (1 of 2)

flow control
receiver controls
sender, so sender
won’t overflow
receiver’s buffer by
transmitting too
much, too fast

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Flow Control (2 of 2)
• receiver “advertises” free buffer
space by including rwnd value in
TCP header of receiver-to-sender
segments
– RcvBuffer size set via socket
options (typical default is
4096 bytes)
– many operating systems
autoadjust RcvBuffer
• sender limits amount of unacked
(“in-flight”) data to receiver’s
rwnd value
• guarantees receive buffer will not
overflow
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (8 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: T CP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Connection Management
before exchanging data, sender/receiver “handshake”:
• agree to establish connection (each knowing the other willing to establish
connection)
• agree on connection parameters

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Agreeing to Establish a Connection (1 of 2)
2-way handshake:
Q: will 2-way handshake
always work in network?
• variable delays
• retransmitted messages
(example. req_conn(x)) due
to message loss
• message reordering
• can’t “see” other side

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Agreeing to Establish a Connection (2 of 2)
2-way handshake failure scenarios:

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP3-Way Handshake

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP3-Way Handshake: FSM

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Closing a Connection (1 of 2)
• client, server each close their side of connection
– send TCP segment with FIN bit = 1
• respond to received FIN with ACK
– on receiving FIN, ACK can be combined with
own FIN
• simultaneous FIN exchanges can be handled

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Closing a Connection (2 of 2)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (9 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Principles of Congestion Control
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!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 1 (1 of 2)
• two senders, two receivers

• one router, infinite buffers

• output link capacity: R

• no retransmission

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 1 (2 of 2)
R
• maximum per-connection throughput:
2

• large delays as arrival rate, λin , approaches capacity

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (1 of 6)
• one router, finite buffers
• sender retransmission of timed-out packet
– application-layer input = application-layer output: λin λout
– transport-layer input includes λ'in λin
retransmissions :

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (2 of 6)

idealization: perfect
knowledge
• sender sends only when
router buffers available

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (3 of 6)

• Idealization: known loss packets can be lost,


dropped at router due to full buffers
• sender only resends if packet known to be lost

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (4 of 6)

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (5 of 6)

Realistic: duplicates
• packets can be lost, dropped at router due to full buffers
• sender times out prematurely, sending two copies, both
of which are delivered

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 2 (6 of 6)
“costs” of congestion:
• more work (retrans) for given “goodput”

• unneeded retransmissions: link carries multiple copies of pkt


– decreasing goodput

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 3 (1 of 2)
• four senders Q: what happens as λin and λin ' increase ?
• multihop paths A: as red λin' increases, all arriving blue pkts
at upper queue are dropped, blue throughput → 0
• timeout/retransmit

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Causes/Costs of Congestion: Scenario 3 (2 of 2)

another “cost” of congestion:


• when packet dropped, any “upstream transmission
capacity used for that packet was wasted!

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Learning Objectives (10 of 10)
3.1 transport-layer services

3.2 multiplexing and demultiplexing

3.3 connectionless transport: UDP

3.4 principles of reliable data transfer

3.5 connection-oriented transport: TCP


– segment structure
– reliable data transfer
– flow control
– connection management

3.6 principles of congestion control

3.7 TCP congestion control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Congestion Control: Additive Increase
Multiplicative Decrease
• approach: sender increases transmission rate (window
size), probing for usable bandwidth, until loss occurs
– additive increase: increase cwnd by 1 MSS every RTT
until loss detected
– multiplicative decrease: cut cwnd in half after loss

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Congestion Control: Details

• cwnd is dynamic, function


of perceived network
congestion
TCP sending rate:
• roughly: send cwnd
bytes, wait RTT for ACKS,
then send more bytes

• sender limits transmission:

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Slow Start
• when connection begins,
increase rate exponentially
until first loss event:
– initially cwnd = 1 MSS
– double cwnd every RTT
– done by incrementing
cwnd for every ACK
received
• summary: initial rate is
slow but ramps up
exponentially fast

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Detecting, Reacting to Loss
• loss indicated by timeout:
– cwnd set to 1 MSS;
– window then grows exponentially (as in slow
start) to threshold, then grows linearly
• loss indicated by 3 duplicate A CKs: TCP RENO
– dup ACKs indicate network capable of
delivering some segments
– cwnd is cut in half window then grows linearly
• TCP Tahoe always sets cwnd to 1 (timeout or 3
duplicate acks

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP: Switching from Slow Start to CA

Q: when should the


exponential increase
switch to linear?
1
A: when cwnd gets to
2
of its value before timeout.

Implementation:
• variable ssthresh
1
• on loss event, ssthresh is set to of cwnd just before loss event
2
* Check out the online interactive exercises for more examples:
http://gaia.cs.umass.edu/kurose_ross/interactive/
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Summary: TCP Congestion Control

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Throughput
• average TCP thruput as function of window size, R TT?
– ignore slow start, assume always data to send

• W: window size (measured in bytes) where loss occurs


– average window size (# in-flight bytes) is

– average thruput 3 W per RTT 3 W


is 4 4

3 W
avg TCP thruput = bytes / sec
4 RTT

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Futures: TCP over “Long, Fat Pipes”
• example: 1500 byte segments, 100ms RTT, want 10 G
bps throughput
• requires W = 83,333 in-flight segments
• throughput in terms of segment loss probability, L
[Mathis 1997]:
1.22 MSS
TCP throughput 
RTT L

→ to achieve 10 Gbps throughput, need a loss


rate of
10  10 – a very small loss rate!
L 2 
• new versions of TCP for high-speed
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
TCP Fairness
fairness goal: if K TCP sessions share same
bottleneck link of bandwidth R, each should haveR
average rate of K

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Why is TCP Fair?
two competing sessions:
• additive increase gives slope of 1, as throughout
increases
• multiplicative decrease decreases throughput
proportionally

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Fairness (More)
Fairness and UDP Fairness, parallel TCP connections
• multimedia apps often • application can open multiple
do not use TCP parallel connections between two
– do not want rate hosts
throttled by • web browsers do this
congestion control
• example, link of rate R with 9
• instead use UDP: R
existing connections:
– send audio/video – new app asks for 1 T CP, gets 10
at constant rate, – rate R
new app asks for 11 T CPs,
tolerate packet 2
loss gets

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Explicit Congestion Notification (E CN)
network-assisted congestion control:
• two bits in IP header (ToS field) marked by network router to
indicate congestion
• congestion indication carried to receiving host

• receiver (seeing congestion indication in I P datagram) ) sets E CE


bit on receiver-to-sender A CK segment to notify sender of
congestion

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Chapter Summary
• principles behind next:
transport layer services:
• leaving the network “edge”
– multiplexing,
(application, transport
demultiplexing layers)
– reliable data transfer
• into the network “core”
– flow control
– congestion control • two network layer chapters:
– data plane
• instantiation,
– control plane
implementation in the
Internet
– UDP
– TCP
Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved
Copyright

Copyright © 2017, 2013, 2010 Pearson Education, Inc. All Rights Reserved

You might also like