Download presentation
Presentation is loading. Please wait.
2
Reliable Data Transfer#1#1 Reliable Data Transfer
3
Reliable Data Transfer#2#2 Transport Layer Goals: r understand principles behind transport layer services: m multiplexing/demultiplexing m reliable data transfer m flow control m congestion control r instantiation and implementation in the Internet Overview: r transport layer services r multiplexing/demultiplexing r connectionless transport: UDP r principles of reliable data transfer r connection-oriented transport: TCP m reliable transfer m flow control m connection management r principles of congestion control r TCP congestion control
4
Reliable Data Transfer#3#3 Transport services and protocols r provide logical communication between app’ processes running on different hosts r transport protocols run in end systems r transport vs network layer services: r network layer: data transfer between end systems r transport layer: data transfer between processes m relies on, enhances, network layer services application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport Similar issues at data link layer
5
Reliable Data Transfer#4#4 Transport-layer protocols Internet transport services: r reliable, in-order unicast delivery (TCP) m congestion m flow control m connection setup r unreliable (“best-effort”), unordered unicast or multicast delivery: UDP r services not available: m real-time m bandwidth guarantees m reliable multicast application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport
6
Reliable Data Transfer#5#5 Principles of Reliable data transfer r important in app., transport, link layers r Highly important networking topic! r characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)
7
Reliable Data Transfer#6#6 Reliable data transfer: getting started send side receive side 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
8
Reliable Data Transfer#7#7 Unreliable Channel Characteristics r Packet Errors: m packet content modified m Assumption: either no errors or detectable. r Packet loss: m Can packet be dropped r Packet duplication: m Can packets be duplicated. r Reordering of packets m Is channel FIFO? r Internet: Errors, Loss, Duplication, non-FIFO
9
Reliable Data Transfer#8#8 Specification r Inputs: m sequence of rdt_send(data_in i ) r Outputs: m sequence of deliver_data(data_out j ) r Safety: m Assume L deliver_data(data_out j ) m For every i L: data_in i = data_out i r Liveness (needs assumptions): m For every i there exists a time T such that data_in i = data_out i
10
Reliable Data Transfer#9#9 Reliable data transfer: protocol model We’ll: r incrementally develop sender, receiver sides of reliable data transfer protocol (rdt) r consider only unidirectional data transfer m but control info will flow on both directions! r use finite state machines (FSM) to specify sender, receiver state 1 state 2 event causing state transition actions taken on state transition state: when in this “state” next state uniquely determined by next event event actions
11
Reliable Data Transfer#10 Rdt1.0: reliable transfer over a reliable channel r underlying channel perfectly reliable m no bit erros m no loss or duplication of packets m FIFO r separate FSMs for sender, receiver: m sender sends data into underlying channel m receiver read data from underlying channel
12
Reliable Data Transfer#11 Rdt 1.0: correctness r Safety Claim: m After m rdt_send() and k rdt_rcv() : m k events: deliver_data(data 1 ) … deliver_data(data k ) m In channel: data k+1 … data m r Proof: m Next event rdt_send(data m+1 ) one more packet in the channel m Next event rdt_rcv(data k+1 ) one more packet received and delivered. one less packet in the channel r Liveness: if k < m eventually delivery_data()
13
Reliable Data Transfer#12 Rdt2.0: channel with bit errors r underlying channel may flip bits in packet m use checksum to detect bit errors r the question: how to recover from errors: m acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK m negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors m sender retransmits pkt on receipt of NAK new mechanisms in rdt2.0 (beyond rdt1.0 ): m error detection m receiver feedback: control msgs (ACK,NAK) rcvr->sender
14
Reliable Data Transfer#13 uc 2.0: channel assumptions r Packets (data, ACK and NACK) are: m Delivered in order (FIFO) m No loss m No duplication r Data packets might get corrupt, m and the corruption is detectable. m ACK and NACK do not get corrupt. r Liveness assumption: m If continuously sending data packets, udt_send() m eventually, an uncorrupted data packet arrives.
15
Reliable Data Transfer#14 rdt2.0: FSM specification sender FSMreceiver FSM
16
Reliable Data Transfer#15 rdt2.0: in action (no errors) sender FSMreceiver FSM
17
Reliable Data Transfer#16 rdt2.0: in action (error scenario) sender FSMreceiver FSM
18
Reliable Data Transfer#17 Rdt 2.0: Typical behavior Typical sequence in sender FSM: “wait for call” rdt_send(data) “wait for Ack/Nack” udt_send(NACK) udt_send(data) udt_send(NACK)... udt_send(data) udt_send(ACK) “wait for call” Claim A: There is at most one packet in transit.
19
Reliable Data Transfer#18 rdt 2.0 (correctness) Inductive Claim I: If sender in state “wait for call” : all data received (at sender) was delivered (once and in order) to the receiver. Inductive Claim II: If sender in state “wait ACK/NAK” (1) all data received (except maybe current packet) is delivered, and (2) eventually move to state “wait for call”. Sketch of Proof: By induction on the events. Theorem : rdt 2.0 delivers packets reliably over channel uc 2.0.
20
Reliable Data Transfer#19 Rdt 2.0 (correctness) r Initially the sender is in “wait for call” m Claim I holds. r Assume rdt_snd(data) occurs: m The sender changes state “wait for Ack/Nak”. m Part 1 of Claim II holds (from Claim I). r In “wait for Ack/ Nack” m sender receives rcvpck = NACK m sender performs udt_send(sndpkt). r If sndpkt is corrupted, m the receiver sends NACK, the sender resends.
21
Reliable Data Transfer#20 Rdt 2.0 (correctness) r Liveness assumption: m Eventually sndpkt is delivered uncorrupted. r The receiver delivers the current data m all data delivered (Claim I holds) m receiver sends Ack. r The sender receives ACK m moves to “wait for call” m Part 2 Claim II holds. r When sender is in “wait for call” m all data was delivered (Claim I holds).
22
Reliable Data Transfer#21 rdt2.0 - garbled ACK/NACK What happens if ACK/NACK corrupted? r sender doesn’t know what happened at receiver! r If ACK was corrupt: m Data was delivered m Needs to return to “wait for call” r If NACK was corrupt: m Data was not delivered. m Needs to re-send data. What to do? r Assume it was a NACK - retransmit, but this might cause retransmission of correctly received pkt! Duplicate. r Assume it was an ACK - continue to next data, but this might cause the data to never reach the receiver! Missing. r Solution: sender ACKs/NACKs receiver’s ACK/NACK. What if sender ACK/NACK corrupted?
23
Reliable Data Transfer#22 rdt2.0 - garbled ACK/NACK Handling duplicates: r sender adds sequence number to each packet r sender retransmits current packet if ACK/NACK garbled receiver discards (doesn’t deliver up) duplicate packet Sender sends one packet, then waits for receiver response stop and wait
24
Reliable Data Transfer#23 rdt2.1: sender, handles garbled ACK/NAKs
25
Reliable Data Transfer#24 rdt2.1: receiver, handles garbled ACK/NAKs
26
Reliable Data Transfer#25 rdt2.1: discussion Sender: r seq # added to pkt r two seq. #’s (0,1) will suffice. Why? r must check if received ACK/NAK corrupted r twice as many states m state must “remember” whether “current” pkt has 0 or 1 seq. # Receiver: r must check if received packet is duplicate m state indicates whether 0 or 1 is expected pkt seq # r note: receiver can not know if its last ACK/NAK received OK at sender
27
Reliable Data Transfer#26 Rdt 2.1: correctness r Claim A: There is at most one packet in transit. r Inductive Claim I: In state “wait for call b” : m all data received (at sender) was delivered r Inductive Claim II: In state “wait ACK/NAK b” m all data received (except maybe last packet b) was delivered, and m eventually move to state “wait for call [1-b]”. r Inductive Claim III: In state wait for b below m all data, ACK received (except maybe the last data) m Eventually move to state wait for 1-b below
28
Reliable Data Transfer#27 rdt2.2: a NAK-free protocol r same functionality as rdt2.1, using ACKs only r instead of NAK, receiver sends ACK for last pkt received OK m receiver must explicitly include seq # of pkt being ACKed r duplicate ACK at sender results in same action as NAK: retransmit current pkt sender FSM !
29
Reliable Data Transfer#28 rdt3.0: channels with errors and loss New assumption: underlying channel can also lose packets (data or ACKs) m checksum, seq. #, ACKs, retransmissions will be of help, but not enough Q: how to deal with loss? m sender waits until certain data or ACK lost, then retransmits m feasible? Approach: sender waits “reasonable” amount of time for ACK r retransmits if no ACK received in this time r if pkt (or ACK) just delayed (not lost): m retransmission will be duplicate, but use of seq. #’s already handles this m receiver must specify seq # of pkt being ACKed r requires countdown timer
30
Reliable Data Transfer#29 Channel uc 3.0 r FIFO: m Data packets and Ack packets are delivered in order. r Errors and Loss: m Data and ACK packets might get corrupt or lost r No duplication: but can handle it! r Liveness: m If continuously sending packets, eventually, an uncorrupted packet arrives.
31
Reliable Data Transfer#30 rdt3.0 sender
32
Reliable Data Transfer#31 rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt) rdt 3.0 receiver rdt_rcv(rcvpkt) && corrupt(rcvpkt) udt_send(ACK[1]) Extract(rcvpkt,data) deliver_data(data) udt_send(ACK[1]) udt_send(ACK[0]) Extract(rcvpkt,data) deliver_data(data) udt_send(ACK[0]) rdt_rcv(rcvpkt) && corrupt(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt) Wait for 0 Wait for 1
33
Reliable Data Transfer#32 rdt3.0 in action
34
Reliable Data Transfer#33 rdt3.0 in action
35
Reliable Data Transfer#34 Rdt 3.0: Claims r Claim I: In “wait call 0” (sender) m all ACK in transit have seq. num. 1 r Claim II: In “wait for ACK 0” (sender) m ACK in transit have seq. num. 1 m followed by (possibly) ACK with seq. num. 0 r Claim III: In “wait for 0” (receiver) m packets in transit have seq. num. 1 m followed by (possibly) packets with seq. num. 0
36
Reliable Data Transfer#35 Rdt 3.0: Claims r Corollary II: In “wait for ACK 0” (sender) m when received ACK with seq. num. 0 m only ACK with seq. num. 0 in transit r Corollary III: In “wait for 0” (receiver) m when received packet with seq. num. 0 m all packets in transit have seq. num. 0
37
Reliable Data Transfer#36 rdt 3.0 - correctness Wait call 0 wait for 0 Wait Ack0 wait for 0 Wait Ack0 wait for 1 Wait Ack1 wait for 1 Wait call 1 wait for 1 Wait Ack1 wait for 0 rdt_send(data) udt_send(data,seq0) rdt_send(data) udt_send(data,seq1) rdt_rcv(data, seq0) rdt_rcv(ACK0) rdt_rcv(data,seq1) rdt_rcv(ACK1)
38
Reliable Data Transfer#37 rdt 3.0 - correctness Wait Ack0 wait for 0 Wait Ack0 wait for 1 rdt_rcv(data, seq0) Wait call 1 wait for 1 rdt_rcv(ACK0) Wait Ack0 wait for 1 All packets in transit have seq. Num. 0 All ACK in transit are ACK0
39
Reliable Data Transfer#38 Performance of rdt3.0 r rdt3.0 works, but performance stinks r example: 1 Gbps link, 15 ms e-e prop. delay, 1KB packet: T transmit = 8kb/pkt 10**9 b/sec = 8 microsec Utilization = U = = 8 microsec 30.016 msec fraction of time sender busy sending = 0.00015 m 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link m transport protocol limits use of physical resources!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.