0% found this document useful (0 votes)
23 views20 pages

ACCSE CSC2B10-Chapter 3 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views20 pages

ACCSE CSC2B10-Chapter 3 3

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

CSC2B10/CSC02B2

Data Communications

Chapter 3.3
Chapter 3 outline

3.1 Transport-layer services 3.5 Connection-oriented


3.2 Multiplexing and demultiplexing transport: TCP
3.3 Connectionless transport: UDP • segment structure
• reliable data transfer
3.4 Principles of reliable data
• flow control
transfer
• connection management
3.6 Principles of congestion
control
3.7 TCP congestion control

2
rdt3.0: channels with errors and loss

New assumption: underlying channel Approach: sender waits


can also lose packets (data or “reasonable” amount of time for
ACKs) ACK
• checksum, seq. #, ACKs, • retransmits if no ACK received in this
retransmissions will be of help, but not time
enough • if pkt (or ACK) just delayed (not lost):
• retransmission will be duplicate, but
use of seq. #’s already handles this
• receiver must specify seq # of pkt being
ACKed
• requires countdown timer

3
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 Λ
Λ Wait for Wait
for timeout
call 0from
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) Λ
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) || sndpkt = make_pkt(1, data, checksum)
isACK(rcvpkt,0) ) udt_send(sndpkt)
start_timer
Λ

4
rdt3.0 in action

5
rdt3.0 in action

6
rdt3.0: stop-and-wait operation

sender receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK

ACK arrives, send next


packet, t = RTT + L / R

L/R .008
U = = = 0.00027
sender 30.008
RTT + L / R

7
Performance of rdt3.0

• rdt3.0 works, but performance stinks


• ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet:
L 8000bits
d trans = = 9
= 8 microseconds
R 10 bps
 U sender: utilization – fraction of time sender busy sending

L/R .008
U = = = 0.00027
sender 30.008
RTT + L / R
 if RTT=30 msec, 1KB pkt every 30 msec -> 33kB/sec thruput
over 1 Gbps link
 network protocol limits use of physical resources!
8
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

9
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

Increase utilization
by a factor of 3!
3*L/R .024
U = = = 0.0008
sender 30.008
RTT + L / R

10
Pipelined Protocols

Go-back-N: big picture: Selective Repeat: big pic


• sender can have up to N unacked • sender can have up to N unack’ed
packets in pipeline packets in pipeline
• rcvr only sends cumulative acks • rcvr sends individual ack for each
• doesn’t ack packet if there’s a gap packet
• sender has timer for oldest • sender maintains timer for each
unacked packet unacked packet
• if timer expires, retransmit all unack’ed • when timer expires, retransmit only
packets unack’ed packet

11
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 each in-flight pkt
 timeout(n): retransmit pkt n and all higher seq # pkts in window
12
GBN in
action

13
GBN: sender extended FSM
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=1
nextseqnum=1
timeout
start_timer
Wait
udt_send(sndpkt[base])
rdt_rcv(rcvpkt) udt_send(sndpkt[base+1])
&& corrupt(rcvpkt) …
udt_send(sndpkt[nextseqnum-1])
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
base = getacknum(rcvpkt)+1
If (base == nextseqnum)
stop_timer
else
start_timer 14
GBN: receiver extended FSM
default
udt_send(sndpkt) rdt_rcv(rcvpkt)
&& notcurrupt(rcvpkt)
Λ && hasseqnum(rcvpkt,expectedseqnum)
expectedseqnum=1 Wait extract(rcvpkt,data)
sndpkt = deliver_data(data)
make_pkt(expectedseqnum,ACK,chksum) sndpkt = make_pkt(expectedseqnum,ACK,chksum)
udt_send(sndpkt)
expectedseqnum++

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 #
15
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
• again limits seq #s of sent, unACK’ed pkts

16
Selective repeat: sender, receiver windows

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

18
Selective repeat in action

19
Selective repeat:
dilemmaExample:
• seq #’s: 0, 1, 2, 3
• window size=3

• receiver sees no
difference in two
scenarios!
• incorrectly passes
duplicate data as new in
(a)

Q: what relationship
between seq # size and
window size?
20

You might also like