0% found this document useful (0 votes)
24 views

Lecture 16 Transport Layer Part03

The document provides a roadmap and overview of key topics in the transport layer: - It outlines transport layer services, multiplexing, connectionless and connection-oriented transport, and principles of reliable data transfer and congestion control. - It then summarizes protocols for reliable data transfer (RDT) including handling corrupted acknowledgments, using acknowledgments only to be NAK-free, and addressing lost packets in error-prone channels.

Uploaded by

hamza syed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Lecture 16 Transport Layer Part03

The document provides a roadmap and overview of key topics in the transport layer: - It outlines transport layer services, multiplexing, connectionless and connection-oriented transport, and principles of reliable data transfer and congestion control. - It then summarizes protocols for reliable data transfer (RDT) including handling corrupted acknowledgments, using acknowledgments only to be NAK-free, and addressing lost packets in error-prone channels.

Uploaded by

hamza syed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Chapter 3: roadmap

 Transport-layer services
 Multiplexing and demultiplexing
 Connectionless transport: UDP
 Principles of reliable data transfer
 Connection-oriented transport: TCP
 Principles of congestion control
 TCP congestion control
 Evolution of transport-layer
functionality
Transport Layer: 3-1
rdt2.1: sender, handling corrupted ACK/NAKs
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) ||
Wait for Wait for isNAK(rcvpkt) )
call 0 from ACK or
NAK 0 udt_send(sndpkt)
above
rdt_rcv(rcvpkt)
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) &&
&& notcorrupt(rcvpkt)
isACK(rcvpkt)
&& isACK(rcvpkt)
L
L
Wait for Wait for
ACK or call 1 from
rdt_rcv(rcvpkt) NAK 1 above
&& (corrupt(rcvpkt) ||
isNAK(rcvpkt) ) rdt_send(data)

udt_send(sndpkt) sndpkt = make_pkt(1, data, checksum)


udt_send(sndpkt)

Transport Layer: 3-2


rdt2.1: receiver, handling garbled ACK/NAKs
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq0(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) && rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) (corrupt(rcvpkt)
sndpkt = make_pkt(NAK, chksum) sndpkt = make_pkt(NAK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
Wait for Wait for
rdt_rcv(rcvpkt) && 0 from 1 from rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) && below below not corrupt(rcvpkt) &&
has_seq1(rcvpkt) has_seq0(rcvpkt)
sndpkt = make_pkt(ACK, chksum) sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)

Transport Layer: 3-3


rdt2.1: discussion
sender: receiver:
 seq # added to pkt  must check if received packet
 two seq. #s (0,1) will suffice. is duplicate
Why? • state indicates whether 0 or 1 is
expected pkt seq #
 must check if received ACK/NAK
 note: receiver can not know if
corrupted
its last ACK/NAK received OK
 twice as many states at sender
• state must “remember” whether
“expected” pkt should have seq #
of 0 or 1

Transport Layer: 3-4


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

As we will see, TCP uses this approach to be NAK-free

Transport Layer: 3-5


rdt2.2: sender, receiver fragments
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for Wait for
ACK isACK(rcvpkt,1) )
call 0 from
above 0 udt_send(sndpkt)
sender FSM
fragment rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
rdt_rcv(rcvpkt) && && isACK(rcvpkt,0)
(corrupt(rcvpkt) || L
has_seq1(rcvpkt)) Wait for receiver FSM
0 from
udt_send(sndpkt) below fragment
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK1, chksum)
udt_send(sndpkt) Transport Layer: 3-6
rdt3.0: channels with errors and loss
New channel assumption: underlying channel can also lose
packets (data, ACKs)
• checksum, sequence #s, ACKs, retransmissions will be of help …
but not quite enough

Q: How do humans handle lost sender-to-


receiver words in conversation?

Transport Layer: 3-7


rdt3.0: channels with errors and loss
Approach: sender waits “reasonable” amount of time for ACK
 retransmits if no ACK received in this time
 if pkt (or ACK) just delayed (not lost):
• retransmission will be duplicate, but seq #s already handles this!
• receiver must specify seq # of packet being ACKed
 use countdown timer to interrupt after “reasonable” amount of
time
timeout

Transport Layer: 3-8


rdt3.0 sender
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
start_timer

Wait for Wait


call 0 from for
above ACK0
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
for call 1 from
ACK1 above

rdt_send(data)
sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)
start_timer

Transport Layer: 3-9


rdt3.0 sender
rdt_send(data)
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(0, data, checksum) ( corrupt(rcvpkt) ||
udt_send(sndpkt) isACK(rcvpkt,1) )
rdt_rcv(rcvpkt) start_timer L
L Wait for Wait
for timeout
call 0 from
ACK0 udt_send(sndpkt)
above
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
timeout for call 1 from
udt_send(sndpkt) ACK1 above
start_timer rdt_rcv(rcvpkt)
rdt_send(data) L
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(1, data, checksum)
( corrupt(rcvpkt) || udt_send(sndpkt)
isACK(rcvpkt,0) ) start_timer
L

Transport Layer: 3-10


rdt3.0 in action
sender receiver sender receiver
send pkt0 pkt0 send pkt0 pkt0
rcv pkt0 rcv pkt0
ack0 send ack0 ack0 send ack0
rcv ack0 rcv ack0
send pkt1 pkt1 send pkt1 pkt1
rcv pkt1 X
loss
ack1 send ack1
rcv ack1
send pkt0 pkt0
rcv pkt0 timeout
ack0 send ack0 resend pkt1 pkt1
rcv pkt1
ack1 send ack1
rcv ack1
send pkt0 pkt0
(a) no loss rcv pkt0
ack0 send ack0

(b) packet loss


Transport Layer: 3-11
rdt3.0 in action
sender receiver
sender receiver send pkt0
pkt0
rcv pkt0
send pkt0 pkt0 send ack0
ack0
rcv pkt0 rcv ack0
ack0 send ack0 send pkt1 pkt1
rcv ack0 rcv pkt1
send pkt1 pkt1 send ack1
rcv pkt1 ack1
ack1 send ack1
X timeout
loss resend pkt1
pkt1 rcv pkt1
timeout
resend pkt1 pkt1
rcv pkt1 rcv ack1 (detect duplicate)
send pkt0 pkt0 send ack1
(detect duplicate)
ack1 send ack1 ack1 rcv pkt0
rcv ack1 rcv ack1 send ack0
send pkt0 pkt0 (ignore) ack0
rcv pkt0
ack0 send ack0 pkt1

(c) ACK loss (d) premature timeout/ delayed ACK


Transport Layer: 3-12
Performance of rdt3.0 (stop-and-wait)
 U sender: utilization – fraction of time sender busy sending

 example: 1 Gbps link, 15 ms prop. delay, 8000 bit packet


• time to transmit packet into channel:
L 8000 bits
Dtrans = R = = 8 microsecs
109 bits/sec

Transport Layer: 3-13


rdt3.0: stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0

first packet bit arrives


RTT last packet bit arrives, send ACK

ACK arrives, send next


packet, t = RTT + L / R

Transport Layer: 3-14


rdt3.0: stop-and-wait operation
sender receiver

L/R L/R
Usender =
RTT + L / R
.008 RTT
=
30.008
= 0.00027

 rdt 3.0 protocol performance stinks!


 Protocol limits performance of underlying infrastructure (channel)

Transport Layer: 3-15


rdt3.0: pipelined protocols operation
pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged
packets
• range of sequence numbers must be increased
• buffering at sender and/or receiver

Transport Layer: 3-16


Pipelining: increased utilization
sender receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R

first packet bit arrives


RTT 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
3-packet pipelining increases
utilization by a factor of 3!

U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008

Transport Layer: 3-17


Go-Back-N: sender
 sender: “window” of up to N, consecutive transmitted but unACKed pkts
• k-bit seq # in pkt header

 cumulative ACK: ACK(n): ACKs all packets up to, including seq # n


• on receiving ACK(n): move window forward to begin at n+1
 timer for oldest in-flight packet
 timeout(n): retransmit packet n and all higher seq # packets in window
Transport Layer: 3-18
Go-Back-N: receiver
 ACK-only: always send ACK for correctly-received packet so far, with
highest in-order seq #
• may generate duplicate ACKs
• need only remember rcv_base
 on receipt of out-of-order packet:
• can discard (don’t buffer) or buffer: an implementation decision
• re-ACK pkt with highest in-order seq #
Receiver view of sequence number space:
received and ACKed

… … Out-of-order: received but not ACKed

rcv_base
Not received
Transport Layer: 3-19
Go-Back-N in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
send pkt2 receive pkt0, send ack0
012345678
send pkt3 Xloss receive pkt1, send ack1
012345678
(wait)
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1
012345678 rcv ack1, send pkt5 receive pkt4, discard,
(re)send ack1
ignore duplicate ACK receive pkt5, discard,
(re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
012345678 send pkt4 rcv pkt2, deliver, send ack2
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5

Transport Layer: 3-20


Selective repeat
 receiver individually acknowledges all correctly received packets
• buffers packets, as needed, for eventual in-order delivery to upper
layer
 sender times-out/retransmits individually for unACKed packets
• sender maintains timer for each unACKed pkt
 sender window
• N consecutive seq #s
• limits seq #s of sent, unACKed packets

Transport Layer: 3-21


Selective repeat: sender, receiver windows

Transport Layer: 3-22


Selective repeat: sender and receiver
sender receiver
data from above: packet n in [rcvbase, rcvbase+N-1]
 if next available seq # in  send ACK(n)
window, send packet  out-of-order: buffer
timeout(n):  in-order: deliver (also deliver
buffered, in-order packets),
 resend packet n, restart timer advance window to next not-yet-
ACK(n) in [sendbase,sendbase+N]: received packet
 mark packet n as received packet n in [rcvbase-N,rcvbase-1]
 ACK(n)
 if n smallest unACKed packet,
advance window base to next otherwise:
unACKed seq #  ignore

Transport Layer: 3-23


Selective Repeat in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
012345678 send pkt3 Xloss receive pkt1, send ack1
(wait)
receive pkt3, buffer,
012345678 rcv ack0, send pkt4 send ack3
012345678 rcv ack1, send pkt5
receive pkt4, buffer,
record ack3 arrived send ack4
receive pkt5, buffer,
pkt 2 timeout send ack5
012345678 send pkt2
012345678 (but not 3,4,5)
012345678 rcv pkt2; deliver pkt2,
012345678 pkt3, pkt4, pkt5; send ack2

Q: what happens when ack2 arrives?

Transport Layer: 3-24


receiver window

Selective repeat:
sender window
(after receipt) (after receipt)

pkt0

a dilemma!
0123012
0123012 pkt1 0123012
0123012 pkt2 0123012
0123012
example: 0123012 pkt3
X
0123012
 seq #s: 0, 1, 2, 3 (base 4 counting) pkt0 will accept packet
with seq number 0
 window size=3 (a) no problem

0123012 pkt0
0123012 pkt1 0123012
0123012 pkt2 X 0123012
X 0123012
X
timeout
retransmit pkt0
0123012 pkt0
will accept packet
with seq number 0
(b) oops!
Transport Layer: 3-25
receiver window

Selective repeat:
sender window
(after receipt) (after receipt)

pkt0

a dilemma!
0123012
0123012 pkt1 0123012
0123012 pkt2 0123012
0123012
example: 0123012 pkt3
X
 seq #s: 0, 1, 2, 3 (base 4 counting)  receiver can’t
0123012
pkt0 will accept packet
see sender side with seq number 0
 window size=3 (a) no problem
 receiver
behavior
identical in both
cases!
0something’s
123012 pkt0
0(very)
1 2 3 0 1wrong!
Q: what relationship is needed 2 pkt1
pkt2
0123012
X
between sequence # size and 0123012 0123012
X 0123012
window size to avoid problem timeout
X
in scenario (b)? retransmit pkt0
0123012 pkt0
will accept packet
with seq number 0
(b) oops!
Transport Layer: 3-26

You might also like