Title: Reliable Data Transfer
1Reliable Data Transfer
2Principles of Reliable data transfer
- top-10 list of important networking topics!
- important in app., transport, link layers
- Well
- incrementally develop sender, receiver sides of
reliable data transfer protocol (rdt) - consider only unidirectional data transfer
3Reliable data transfer getting started
send side
receive side
4Rdt1.0 reliable transfer over a reliable channel
- underlying channel perfectly reliable
- use finite state machines (FSM) to specify
sender, receiver
5Rdt2.0 channel with bit errors
- underlying channel may flip bits in packet
- the question how to recover from errors
- acknowledgement (ACK) (OK)
- negative acknowledgement (NAK) (Please repeat
that.) - new mechanisms in rdt2.0
- error detection
- receiver feedback control msgs (ACK,NAK) rcvr ?
sender - retransmission
6rdt2.0 FSM specification
sender FSM
receiver FSM
7rdt2.0 in action (no errors)
sender FSM
receiver FSM
8rdt2.0 in action (error scenario)
sender FSM
receiver FSM
Critical Flaw What happens if ACK/NAK
corrupted? Handling duplicates sender adds
sequence to each pkt
9rdt2.1 discussion
- Sender
- seq added to pkt
- must check if received ACK/NAK corrupted
- twice as many states
- Receiver
- must check if received packet is duplicate
- state indicates whether 0 or 1 is expected pkt
seq - note receiver can not know if its last ACK/NAK
received OK at sender
10rdt2.2 a NAK-free protocol
- instead of NAK, receiver sends ACK for last pkt
received OK - duplicate ACK at sender results in same action as
NAK retransmit current pkt - receiver now includes sequence of packet
sender FSM
!
11rdt3.0 channels with errors and loss
- New assumption underlying channel can also lose
packets (data or ACKs) - checksum, seq. , ACKs, retransmissions will be
of help, but not enough - Q how to deal with loss?
- sender waits until certain data or ACK lost, then
retransmits - drawbacks?
- Approach sender waits reasonable amount of
time for ACK - requires countdown timer
- retransmits if no ACK received in this time
- if pkt (or ACK) is delayed (not lost)
- retransmission leads to duplicate
- receiver must specify seq of pkt being ACKed
12rdt3.0 in action
13rdt3.0 in action
14Recap on simple retransmission protocol
stop-and-wait
sender transmit one frame, F0, set retrans.
timer, wait for ACK if ACK arrives, cancel the
timer, send next frame F1 receiver upon receiving
a frame, send an ACK
sender
receiver
time
15Stop-and-wait (cont)
- If timer expires before receiving ACK, retransmit
F0 - if the timer set too short, results in a
duplicate F0 - Need a unique identifier to distinguish each data
frame - a 1-bit sequence number, N, is enough for
Stop-and-Wait
sender
receiver
16Pipelining for better performance
- rdt3.0 works, but too slow
- example 1 Gbps link, 30ms roundtrip delay, 1KB
pkt
Server busy only 0.027 of the time! Pipelining
sending multiple, yet-to-be-acknowledged pkts
17Go-Back-N
- Sender
- k-bit seq in pkt header
- can send up to N consecutive, unacked pkts
- ACK(n) ACKs all pkts up to, including seq n
(cumulative ACK) - Set timer for each in-flight pkt
- timeout(n) retransmit pkt n and all higher seq
pkts in window
18GBN receiver extended FSM
- receiver
- ACK-only always send ACK for correctly-received
pkt with highest in-order seq - out-of-order pkt
- discard (dont buffer)
- ACK pkt with highest in-order seq
19GBN inaction
Go-Back-N in action
20Selective 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, unACKed pkts
21Selective repeat sender, receiver windows
22Selective repeat
- data from above
- if next available seq in window, send pkt
- timeout(n)
- resend pkt n, restart timer
- ACK(n) in sendbase,sendbaseN
- mark pkt n as received
- if n smallest unACKed pkt, advance window base to
next unACKed seq
- pkt n in rcvbase, rcvbaseN-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
23Selective repeat in action
24Selective repeat dilemma
- Example
- seq s 0, 1, 2, 3
- window size3
- receiver sees no difference in two scenarios!
- incorrectly passes duplicate data as new in (a)
- Q what is the relationship between seq size
and window size? - (Max. seq 1)/2 ? window-size
25Three basic components in reliable data delivery
by retransmission
- sequence number used to uniquely identify
individual frames - Acknowledgment (ACK) reception report from
receiver - Retransmission at the sender upon TIMEOUT (or
NAK) - must know how long to wait before retry