PowerPoint Presentation
Transport Layer
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
George Parisis
School of Engineering and Informatics
University of Sussex
Transport Layer
3-*
Outline
transport-layer services
multiplexing and demultiplexing
connectionless transport: UDP
principles of reliable data transfer
connection-oriented transport: TCP
segment structure
reliable data transfer
flow control
connection management
principles of congestion control
TCP congestion control
Transport Layer
Transport Layer
3-*
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
Transport Layer
Transport Layer
3-*
Pipelining: increased utilization
first packet bit transmitted, t = 0
sender
receiver
RTT
last bit transmitted, t = L / R
first packet bit arrives
last packet bit arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R
last bit of 2nd packet arrives, send ACK
last bit of 3rd packet arrives, send ACK
3-packet pipelining increases
utilization by a factor of 3!
Transport Layer
Transport Layer
3-*
Pipelined protocols: overview
Go-back-N:
sender can have up to N unacked packets in pipeline
receiver only sends cumulative ack
doesn’t ack packet if there’s a gap
sender has timer for oldest unacked packet
when timer expires, retransmit all unacked packets
Selective Repeat:
sender can have up to N unacked packets in pipeline
rcvr sends individual ack for each packet
sender maintains timer for each unacked packet
when timer expires, retransmit only that unacked packet
Transport Layer
Transport Layer
3-*
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
Transport Layer
Transport Layer
3-*
GBN: sender extended FSM
start_timer
udt_send(sndpkt[base])
udt_send(sndpkt[base+1])
…
udt_send(sndpkt[nextseqnum-1])
timeout
rdt_send(data)
if (nextseqnum < base+N) {
sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)
udt_send(sndpkt[nextseqnum])
if (base == nextseqnum)
start_timer
nextseqnum++
}
else
refuse_data(data)
base = getacknum(rcvpkt)+1
If (base == nextseqnum)
stop_timer
else
start_timer
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
base=1
nextseqnum=1
rdt_rcv(rcvpkt)
&& corrupt(rcvpkt)
L
L
Wait
Transport Layer
Transport Layer
3-*
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 #
Wait
udt_send(sndpkt)
default
rdt_rcv(rcvpkt)
&& notcurrupt(rcvpkt)
&& hasseqnum(rcvpkt,expectedseqnum)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(expectedseqnum,ACK,chksum)
udt_send(sndpkt)
expectedseqnum++
expectedseqnum=1
sndpkt =
make_pkt(expectedseqnum,ACK,chksum)
L
GBN: receiver extended FSM
Transport Layer
Transport Layer
3-*
GBN in action
send pkt0
send pkt1
send pkt2
send pkt3
(wait)
sender
receiver
receive pkt0, send ack0
receive pkt1, send ack1
receive pkt3, discard,
(re)send ack1
rcv ack0, send pkt4
rcv ack1, send pkt5
pkt 2 timeout
send pkt2
send pkt3
send pkt4
send pkt5
X
loss
receive pkt4, discard,
(re)send ack1
receive pkt5, discard,
(re)send ack1
rcv pkt2, deliver, send ack2
rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
ignore duplicate ACK
sender window (N=4)
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
Transport Layer
Transport Layer
3-*
Selective repeat
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 number of sent, unACKed pkts
Transport Layer
Transport Layer
3-*
Selective repeat: sender, receiver windows
Transport Layer
Transport Layer
3-*
Selective repeat
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 #
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]
acks can get lost
ACK(n)
otherwise:
ignore
sender
receiver
Transport Layer
Transport Layer
3-*
Selective repeat in action
send pkt0
send pkt1
send pkt2
send pkt3
(wait)
sender
receiver
receive pkt0, send ack0
receive pkt1, send ack1
receive pkt3, buffer,
send ack3
rcv ack0, send pkt4
rcv ack1, send pkt5
pkt 2 timeout
send pkt2
X
loss
receive pkt4, buffer,
send ack4
receive pkt5, buffer,
send ack5
rcv pkt2; deliver pkt2,
pkt3, pkt4, pkt5; send ack2
record ack3 arrived
sender window (N=4)
0 1 2 3 4 5 6 7 8
record ack4 arrived
record ack5 arrived
Q: what happens when ack2 arrives?
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
Transport Layer
Transport Layer
3-*
Selective repeat:
dilemma
example:
seq #’s: 0, 1, 2, 3
window size=3
receiver window
(after receipt)
sender window
(after receipt)
receiver can’t see sender side.
receiver behavior identical in both cases!
something’s (very) wrong!
receiver sees no difference in two scenarios!
duplicate data accepted as new in (b)
window size less than or equal to half the size of the sequence number space�
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
pkt0
pkt1
pkt2
pkt0
timeout
retransmit pkt0
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
X
X
X
will accept packet
with seq number 0
(b) oops!
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
pkt0
pkt1
pkt2
0 1 2 3 0 1 2
pkt0
0 1 2 3 0 1 2
0 1 2 3 0 1 2
0 1 2 3 0 1 2
X
will accept packet
with seq number 0
pkt3
(a) no problem
Transport Layer
Reordering
Old copies of a packet with a sequence or acknowledgment number of x can appear
neither the sender’s nor the receiver’s window contains x
Channel can be thought of as essentially buffering packets and spontaneously emitting these packets at any point in the future
guard against duplicate sequence numbers
A sequence number must not be reused until the sender is “sure” that any previously sent packets with sequence number x are no longer in the network
Assume packet lifetime in the network
Transport Layer
3-*
Transport Layer
Transport Layer
3-*
Summary
principles behind transport layer services:
reliable data transfer
GBN
Selective repeat
Transport Layer
U
sender
=
.0024
30.008
RTT + L / R
3L / R
=
=
0.00081
U
sender
=
.
0024
30.008
=
0.00081
3
L / R
RTT + L / R
=