8: Principles of Reliable Data Transfer

25
3: Transport Layer 3a-1 8: Principles of Reliable Data Transfer Last Modified: 06/10/22 08:11 PM Slides adapted from: J.F Kurose and K.W. Ross, 1996-2010

description

8: Principles of Reliable Data Transfer. Last Modified: 9/21/2014 1:49:09 AM. Slides adapted from: J.F Kurose and K.W. Ross, 1996-2010. Roadmap. UDP is a very thin layer over IP multiplexing /demultiplexing error detection - PowerPoint PPT Presentation

Transcript of 8: Principles of Reliable Data Transfer

Page 1: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-1

8: Principles of Reliable Data Transfer

Last Modified: 04/21/23 06:27 AM

Slides adapted from:J.F Kurose and K.W. Ross, 1996-2010

Page 2: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-2

Roadmap

UDP is a very thin layer over IP multiplexing /demultiplexing error detection

TCP does these things also and then adds some other significant features

TCP is quite a bit more complicated and subtle

We are not going to jump right into TCP Start gently thinking about principles of

reliable message transfer in general

Page 3: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-3

The Problem

Problem: send big message (broken into pieces) over unreliable channel such that it arrives on other side in its entirety and in the right order

No out of band communication! All communication sent along with the pieces of the message

Receiver allowed to send information back but only over the same unreliable channel!

Page 4: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-4

Intuition: Faxing a document With Flaky Machine Can’t talk to person on the other side any other way Number the pages – so sender can put back together Let receiver send you a fax back saying what pages

they have and what they still need (include your fax number on the document!)

What if the receiver sends their responses with a flaky fax machine too?

What if it is a really big document? No point in overwhelming the receiver. Receiver might like to be able to tell you send first 10 pages then 10 more…

How does receiver know when they have it all? Special last page? Cover sheet that said how many to expect?

Page 5: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-5

Principles of Reliable data transfer Solving this problem is one on top-10 list of

most important networking topics! important in application, transport, link layers

Characteristics of unreliable channel will determine complexity of reliable data transfer protocol– what is worst underlying channel can do? Drop packets/pages? Corrupt packet/pages (even special ones like

the cover sheet or the receiver’s answer?) Reorder packets/pages?

Page 6: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-6

Reliable data transfer: getting started

sendside

receiveside

rdt_send(): called from above, (e.g., by app.). Passed data to deliver to receiver upper layer

udt_send(): called by rdt,to transfer packet over unreliable channel to

receiver

rdt_rcv(): called when packet arrives on rcv-side of channel

deliver_data(): called by rdt to deliver data to

upper

Page 7: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-7

Reliable data transfer: getting startedWe’ll: incrementally develop sender, receiver

sides of reliable data transfer protocol (rdt) consider only unidirectional data transfer

but control info will flow on both directions!

use finite state machines (FSM) to specify sender, receiver

state1

state2

event causing state transitionactions taken on state transition

state: when in this “state” next state

uniquely determined by

next event

eventactions

Page 8: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-8

Rdt1.0: reliable transfer over a reliable channel

underlying channel perfectly reliable (so this should be easy ) no bit errors no loss of packets

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

Page 9: 8: Principles of Reliable Data Transfer

Transport Layer 3-9

Rdt2.0: channel with bit errors

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

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

sender that pkt received OK negative acknowledgements (NAKs): receiver

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

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

>sender

How do humans recover from “errors”during conversation?

Page 10: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-10

Rdt2.0: channel with bit errors underlying channel may flip bits in packet (can’t drop or

reorder packets) recall: UDP checksum to detect bit errors

Once can have problems, the receiver must give the sender feedback (either that or the sender would just have to keep sending copy after copy forever to be sure)

After receiving a packet, the receiver could say one of two things: acknowledgements (ACKs): receiver explicitly tells sender

that pkt received OK negative acknowledgements (NAKs): receiver explicitly tells

sender that pkt had errors sender retransmits pkt on receipt of NAK human scenarios using ACKs, NAKs?

Page 11: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-11

Rdt2.0: channel with bit errors

new mechanisms in rdt2.0 (beyond rdt1.0): receiver feedback: control msgs (ACK,NAK) rcvr-

>sender (let receiver fax you back info?) Possible retransmission – detection of duplicates

(number fax pages?) error detection (checksums? Cover sheet summary?)

Page 12: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-12

rdt2.0: FSM specification

sender FSM receiver FSM

Page 13: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-13

rdt2.0: in action (no errors)

sender FSM receiver FSM

Page 14: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-14

rdt2.0: in action (error scenario)

sender FSM receiver FSM

Page 15: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-15

rdt2.0 has a fatal flaw!

What happens if ACK/NAK corrupted? sender doesn’t know what happened at receiver! FSM implied could tell if it was and ACK or a NACK What if is a FLACK?

What to do? Assume it was an ACK and transmit next? What if it was a NACK?

Missing data Assume it was a NACK and retransmit; What if it was an ACK?

Duplicate data

Handling duplicates: To detect duplicate, sender adds sequence number to each pkt sender retransmits current pkt if ACK/NAK garbled If receiver has pkt with that number already it will discards (I.e.

not deliver up duplicate pkt)

Page 16: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-16

rdt2.1: sender, handles garbled ACK/NAKs

New:compute_chksum

corrupt()

Page 17: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-17

rdt2.1: receiver, handles garbled ACK/NAKs

If not corrupt, alwayssend ACK, but only

Deliver_data first time

Page 18: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-18

rdt2.1: discussionSender: seq # added to pkt two seq. #’s (0,1)

will suffice. Why? must check if

received ACK/NAK corrupted

twice as many states state must

“remember” whether “current” pkt has 0 or 1 seq. #

Receiver: must check if received

packet is duplicate state indicates whether 0 or

1 is expected pkt seq # Note: This protocol can also

handle if the channel can duplicate packets

note: when can sender and receiver safely exit? receiver can not know if its last ACK/NAK received OK at sender Missing connection

termination procedure

Page 19: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-19

rdt2.2: a NAK-free protocol Less intuitive but getting us closer to TCP same functionality as rdt2.1, using NAKs only instead of NAK, receiver sends ACK for last pkt received

OK (or for other number on the first receive) receiver must explicitly include seq # of pkt being ACKed

duplicate (or unexpected) ACK at sender results in same action as NAK: retransmit current pkt

TCP really ACKS the next thing it wants

Page 20: 8: Principles of Reliable Data Transfer

rdt2.2: sender, receiver fragments

Page 21: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-21

rdt3.0: channels with errors (and duplicates) and loss

New assumption: underlying channel can also lose packets (data or ACKs) How to deal with loss?

Retransmission plus seq # to detect duplicates

but not enough

Q: how to detect 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 use of seq. #’s already handles this

receiver must specify seq # of pkt being ACKed

requires countdown timer

Page 22: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-22

rdt3.0 sender

Start_timerTimeout events

Page 23: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-23

rdt3.0 in action

Page 24: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-24

rdt3.0 in action

Page 25: 8: Principles of Reliable Data Transfer

3: Transport Layer 3a-25

Stop and Wait

Rdt3.0 also called Stop and Wait Sender sends one packet, then waits for

receiver response What is wrong with stop and wait?

Slow!! Must wait full round trip time between each send

Obvious Fix? Instead send lots, then stop and wait Call this a pipelined protocol because many

packets in the pipeline at the same time