Title: rdt3'0: channels with errors and loss
1rdt3.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 - yuck drawbacks?
2rdt3.0 channels with errors and loss
- Approach sender waits reasonable amount of
time for ACK a timeout event - retransmits if no ACK received in this time
- 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
- So how long a sender should wait?
- requires countdown timer
- Associate with Each packet
- Associate with a TO event
- Can be stopped if an ACK is received.
3rdt3.0 sender
rdt_send(data)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isACK(rcvpkt,1) )
sndpkt make_pkt(0, data, checksum) udt_send(sndp
kt) start_timer
L
rdt_rcv(rcvpkt)
L
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt,1)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt,0)
stop_timer
stop_timer
rdt_rcv(rcvpkt)
L
rdt_send(data)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isACK(rcvpkt,0) )
sndpkt make_pkt(1, data, checksum) udt_send(sndp
kt) start_timer
L
4rdt2.2 and rdt 3.0 receiver
5Rdt 3.0 in action (p0,p1,p0,p1,p0,p1)
P0 Ack0 P1 Ack0 Retx p1 Ack1
Retx p1 Ack1
p0 Ack0
6rdt3.0 in action
7rdt3.0 in action
8Performance of rdt3.0
- example 1 Gbps link, 15 ms e-e prop. delay, 1KB
packet
L (packet length in bits)
8kb/pkt
T
8 microsec
transmit
R (transmission rate, bps)
109 b/sec
- U sender utilization fraction of time sender
busy sending
- 1KB pkt every 30 msec -gt 33kB/sec throughput over
1 Gbps link - network protocol limits use of physical resources!
9rdt3.0 stop-and-wait operation
rdt3.0 works, but performance ?
10How to improve?
Can we do the following?
11Pipelined protocols
- Pipelining sender allows multiple, in-flight,
yet-to-be-acknowledged pkts
12Outline
- 3.4 Principles of reliable data transfer
- rdt3.0 Channel with bit errors and packet
losses - Pipelined protocols
- Go-Back-N
- Sliding window at sender
- ACKs only correctly-received pkt with highest
in-order seq , cumulative ACK, - Retransmit the whole window
- Selective Repeat
- 3.5 Connection-oriented transport TCP
- reliable data transfer
13Pipelined protocols
- Pipelining
- range of sequence numbers must be increased
- buffering at sender and/or receiver
- Two generic forms of pipelined protocols
go-Back-N, selective repeat
14Pipelining Protocols
- Go-back-N big picture
- Sender can have up to N unacked packets in
pipeline - Rcvr only sends cumulative acks
- Doesnt ack packet if theres a gap
- Sender has timer for oldest unacked packet
- If timer expires, retransmit all unacked packets
15Go-Back-N
- Sender
- window of up to N, consecutive unacked pkts
allowed - Sliding-window protocol
16Go-Back-N
- Sender
- k-bit seq in pkt header
- Fill window as much as possible
- ACK(n) ACKs all pkts up to, including seq n
(cumulative ACK) - Send_base sets to pkt n1, slides window
- timer for each in-flight pkt
- timeout(n) retransmit pkt n and all pkts in
window - go-back-N
pkt n
17GBN sender extended FSM
rdt_send(data)
if (nextseqnum lt baseN) sndpktnextseqnum
make_pkt(nextseqnum,data,chksum)
udt_send(sndpktnextseqnum) if (base
nextseqnum) start_timer nextseqnum
else refuse_data(data)
L
base1 nextseqnum1
timeout
start_timer udt_send(sndpktbase) udt_send(sndpkt
base1) udt_send(sndpktnextseqnum-1)
rdt_rcv(rcvpkt) corrupt(rcvpkt)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
base getacknum(rcvpkt)1 If (base
nextseqnum) stop_timer else start_timer
18GBN receiver extended FSM
default
udt_send(sndpkt)
rdt_rcv(rcvpkt) notcurrupt(rcvpkt)
hasseqnum(rcvpkt,expectedseqnum)
L
Wait
extract(rcvpkt,data) deliver_data(data) sndpkt
make_pkt(expectedseqnum,ACK,chksum) udt_send(sndpk
t) expectedseqnum
expectedseqnum1 sndpkt
make_pkt(expectedseqnum,ACK,chksum)
- 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 (dont buffer) -gt no receiver buffering!
- Re-ACK pkt with highest in-order seq
19GBN inaction
20Pipelining Protocols
- Go-back-N big picture
- Sender can have up to N unacked packets in
pipeline - Rcvr only sends cumulative acks
- Doesnt ack packet if theres a gap
- Sender has timer for oldest unacked packet
- If timer expires, retransmit all unacked packets
- Selective Repeat big pic
- Sender can have up to N unacked packets in
pipeline - Rcvr acks individual packets
- Sender maintains timer for each unacked packet
- When timer expires, retransmit only unack packet
21Selective 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 of sent, yet unACKed pkts
22Selective repeat sender, receiver windows
23Selective repeat
- 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
- data from above
- if next available seq in window, send pkt
- timeout(n)
- Each pkt has a timer
- resend pkt n, restart timer
- ACK(n) in sendbase,sendbaseN
- mark pkt n as received
- if n smallest unACKed pkt(send_base), advance
window base to next unACKed seq , send new pkts
if any.
24Selective repeat in action
Pkt 3,4,5 buffered
25Selective 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 relationship between seq size and
window size?
26Outline
- 3.4 Principles of reliable data transfer
- rdt3.0 Channel with bit errors and packet
losses - Pipelined protocols
- Go-Back-N
- Selective Repeat
- 3.5 Connection-oriented transport TCP
- reliable data transfer
27TCP reliable data transfer
- TCP creates rdt service on top of IPs unreliable
service - Pipelined segments
- Cumulative acks
- TCP uses single retransmission timer
- Retransmissions are triggered by
- timeout events
- duplicate acks
- Initially consider simplified TCP sender
- ignore duplicate acks
- ignore flow control, congestion control
28TCP seq. s and ACKs
- Seq. s
- byte stream number of first byte in segments
data - segments 0 999, seq 0
- 1000 1999, seq 1000
- ACKs
- seq of next byte expected from other side
- Receive 0 999, ACK seq 1000
- 1000 1999, ACK seq 2000
- cumulative ACK
- Q how receiver handles out-of-order segments
- A TCP spec doesnt say, -- up to implementer
- What we have learned?
29TCP seq. s and ACKs (A-gtB)
Host B
Host A
User types C
Seq42, ACK79, data C
host ACKs receipt of C, echoes back C
Seq79, ACK43, data C
host ACKs receipt of echoed C
Seq43, ACK80
- Random choose an initial seq
- A-gtB
- Full duplex not emphasized.
simple telnet scenario
30TCP seq. s and ACKs (bi-direction)
Host B
Host A
User types C
Seq42, ACK79, data C
host ACKs receipt of C, echoes back C
Seq79, ACK43, data C
host ACKs receipt of echoed C
Seq43, ACK80
- Random choose an initial seq
- Full duplex piggybacking ACKs
simple telnet scenario
31TCP sender events
- data rcvd from app
- Create segment with seq
- seq is byte-stream number of first data byte in
segment
- Ack rcvd
- If acknowledges previously unacked segments
- update what is known to be acked
- start timer if there are outstanding segments
- start timer if not already running (think of
timer as for oldest unacked segment) - expiration interval TimeOutInterval
- timeout
- retransmit segment that caused timeout
- restart timer
-
32TCP sender(simplified)
NextSeqNum InitialSeqNum
SendBase InitialSeqNum loop (forever)
switch(event) event
data received from application above
create TCP segment with sequence number
NextSeqNum if (timer currently
not running) start timer
pass segment to IP
NextSeqNum NextSeqNum length(data)
event timer timeout
retransmit not-yet-acknowledged segment with
smallest sequence number
start timer event ACK
received, with ACK field value of y
if (y gt SendBase)
SendBase y if (there are
currently not-yet-acknowledged segments)
start timer
/ end of loop forever /
- Comment
- SendBase-1 last
- cumulatively acked byte
- Example
- SendBase-1 71y 73, so the rcvrwants 73
y gt SendBase, sothat new data is acked
33TCP retransmission scenarios
Host A
Host B
Seq92, 8 bytes data
Seq100, 20 bytes data
ACK100
ACK120
Seq92, 8 bytes data
Sendbase 100
SendBase 120
ACK120
Seq92 timeout
SendBase 100
SendBase 120
premature timeout
34TCP retransmission scenarios (more)
SendBase 120
35TCP ACK generation RFC 1122, RFC 2581
TCP Receiver action Delayed ACK. Wait up to
500ms for next segment. If no next segment, send
ACK Immediately send single cumulative ACK,
ACKing both in-order segments Immediately send
duplicate ACK, indicating seq. of next
expected byte Immediate send ACK, provided
that segment starts at lower end of gap
Event at Receiver Arrival of in-order segment
with expected seq . All data up to expected seq
already ACKed Arrival of in-order segment
with expected seq . One other segment has ACK
pending Arrival of out-of-order
segment higher-than-expect seq. . Gap
detected Arrival of segment that partially or
completely fills gap