3-1 sect. 3.4 principles of reliable data transfer computer networking: a top down approach...

19
3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross Addison-Wesley, 2001. All material copyright 1996-2002 J.F Kurose and K.W. Ross, All Rights Reserved Slides modified from originals by Jens B Jorgensen and Jonas Thomsen, University of Aarhus

Post on 21-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-1

Sect. 3.4Principles ofreliable data transfer

Computer Networking: A Top Down Approach Featuring the Internet, 1st edition. Jim Kurose, Keith RossAddison-Wesley, 2001.

All material copyright 1996-2002J.F Kurose and K.W. Ross, All Rights Reserved

Slides modified from originals by Jens B Jorgensen and Jonas Thomsen, University of Aarhus

Page 2: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-2

Principles of Reliable data transfer important in application, transport, and link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

Page 3: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-3

Rdt1.0: reliable transfer over a reliable channel

underlying channel perfectly reliable no bit errors no loss of packets

separate FSMs for sender, receiver: sender sends data into underlying channel receiver read data from underlying channel

Wait for call from above packet = make_pkt(data)

udt_send(packet)

rdt_send(data)

extract (packet,data)deliver_data(data)

Wait for call from

below

rdt_rcv(packet)

sender receiver

Page 4: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-4

Rdt2.0: channel with bit errors

underlying channel may flip bits in packet recall: UDP checksum to detect bit errors

the question: how to recover from errors: acknowledgements (ACKs): receiver explicitly tells

sender that packet is received OK negative acknowledgements (NAKs): receiver

explicitly tells sender that packet had errors sender retransmits packet on receipt of NAK

new mechanisms in rdt2.0 (beyond rdt1.0): error detection receiver feedback: control messages (ACK,NAK)

receiver->sender

Page 5: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-5

rdt2.0: FSM specification

Wait for call from above

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

extract(rcvpkt,data)deliver_data(data)udt_send(ACK)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isNAK(rcvpkt)

udt_send(NAK)

rdt_rcv(rcvpkt) && corrupt(rcvpkt)

Wait for ACK or

NAK

Wait for call from

belowsender

receiverrdt_send(data)

Page 6: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-6

rdt2.0 has a fatal flaw!

What happens if ACK/NAK corrupted?

sender doesn’t know what happened at receiver!

can’t just retransmit: possible duplicate

What to do? sender ACKs/NAKs

receiver’s ACK/NAK? What if sender ACK/NAK lost?

retransmit, but this might cause retransmission of a correctly received packet!

Handling duplicates: sender adds sequence

number to each packet sender retransmits

current packet if ACK/NAK is garbled

receiver discards (doesn’t deliver up) duplicate packets

Sender sends one packet, then waits for receiver response

stop and wait

Page 7: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-7

rdt2.1: sender, handles garbled ACK/NAKs

Wait for call 0 from

above

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

rdt_send(data)

Wait for ACK or NAK 0 udt_send(sndpkt)

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isNAK(rcvpkt) )

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

rdt_send(data)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt)

udt_send(sndpkt)

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isNAK(rcvpkt) )

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt)

Wait for call 1 from

above

Wait for ACK or NAK 1

Page 8: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-8

rdt2.1: receiver, handles garbled ACK/NAKs

Wait for 0 from below

sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq0(rcvpkt)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt)

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

Wait for 1 from below

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) && (corrupt(rcvpkt)

sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq1(rcvpkt)

rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

Page 9: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-9

rdt3.0: channels with errors and loss

New assumption: underlying channel can also lose packets (data or ACKs) checksum, sequence

numbers, ACKs, retransmissions will be of help, but not enough

Q: how to deal with loss? sender waits until it is

certain that data or ACK is lost;then retransmits

Approach: sender waits “reasonable” amount of time for ACK

retransmits if no ACK is received in this time

if data (or ACK) just delayed (not lost): retransmission will be a

duplicate, but use of sequence numbers already handles this

receiver must specify sequence number of pkt being ACKed

requires countdown timer

Page 10: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-10

rdt3.0 sender

sndpkt = make_pkt(0, data, checksum)udt_send(sndpkt)start_timer

rdt_send(data)

Wait for

ACK0

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isACK(rcvpkt,1) )

Wait for call 1 from

above

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

rdt_send(data)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt,0)

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isACK(rcvpkt,0) )

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt,1)

stop_timerstop_timer

udt_send(sndpkt)start_timer

timeout

udt_send(sndpkt)start_timer

timeout

rdt_rcv(rcvpkt)

Wait for call 0 from

above

Wait for

ACK1

rdt_rcv(rcvpkt)

Page 11: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-11

rdt3.0 in action

Page 12: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-12

rdt3.0 in action

Page 13: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-13

rdt3.0: stop-and-wait operation

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance stinks

Page 14: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-14

Pipelined protocols

Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged packets range of sequence numbers must be increased buffering at sender and/or receiver

Two generic forms of pipelined protocols: go-Back-N, selective repeat

Page 15: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-15

Go-Back-NSender: k-bit sequence number in packet header [0,2k-1] “window” of up to N, consecutive un-ACK’ed packets allowed

ACK(n): ACKs all packets up to, including sequence number n - “cumulative ACK” may deceive duplicate ACKs (see receiver)

timer for each in-flight packet timeout(n): retransmit packet n and all higher sequence numbered packets in window

Page 16: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-16

GBN: sender extended FSM

Wait start_timerudt_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)+1If (base == nextseqnum) stop_timer else start_timer

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

rdt_rcv(rcvpkt) && corrupt(rcvpkt)

Page 17: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-17

GBN: receiver extended FSM

ACK-only: always send ACK for correctly-received packet with highest in-order sequence number may generate duplicate ACKs need only remember expectedseqnum

out-of-order packet: discard (don’t buffer) -> no receiver buffering! Re-ACK packet with highest in-order sequence number

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++

Page 18: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-18

GBN inaction

Page 19: 3-1 Sect. 3.4 Principles of reliable data transfer Computer Networking: A Top Down Approach Featuring the Internet, 1 st edition. Jim Kurose, Keith Ross

3-19

Principles of reliable data transfer: Summary

rdt1.0: Simplest case; a reliable channel given

rdt2.0 and rdt2.1: Compensation for bit errors

rdt3.0: Compensation for lost packets To solve rdt3.0 (stop-and-wait)

performance problems, pipelined protocols (Go-Back-N) are introduced