180 likes | 302 Views
Communication Networks. Recitation 7 RDT, CLOS & DV Revisited. Reliable Transmission. How do we send a packet reliably when it can be lost and/or corrupted in the network? Mechanisms Acknowledgements Timeouts Simplest reliable protocol: Simple Stop and Wait send a packet
E N D
Communication Networks Recitation 7 RDT, CLOS & DV Revisited Comnet 2010
Reliable Transmission • How do we send a packet reliably when it can be lost and/or corrupted in the network? • Mechanisms • Acknowledgements • Timeouts • Simplest reliable protocol: Simple Stop and Wait • send a packet • stop and wait until an ACK arrives from the receiver • retransmit if timeout occurs before ACK arrives • Is this protocol CORRECT ?! Comnet 2010
Simple Stop and Wait Comnet 2010
Recovering from Errors packet duplicate duplicate +missing Comnet 2010
Problems with Simple Stop and Wait • Duplicate packets: • How does the receiver recognize a duplicate transmission (e.g. in the case of a lost ACK)? • Missing Packet: • In early timeout case. • Duplicate ACK. • Solution: Put sequence number in packet Comnet 2010
Sequence Numbers • Detect retransmissions using sequence numbers • both packets and ACKs • Simple: unbounded # • Realistic: sequence # in packet is finite • Assuming FIFO channel • How many bits do we need? • 1 bit for stop and wait • Won’t send seq #1 until receive ACK for seq #0 Comnet 2010
Sender: Init: n=1 Wait for data(n) Send data(n) Receive ACK(m) If m=n Then n = n+1 When timeout Send data(n) Receiver Init: n=1 Receive data(k) IF k=n then Deliver data(n) n = n+1 Send ACK(n-1) Stop and Wait: unbounded seq # Comnet 2010
What if packets are reordered? • Never reuse a seq #? Finite… • Require in order delivery? Unreliable network … • Prevent very late delivery? • TTL: Decrement hop count per packet, discard if exceeded • Seq # not reused within delay bound Comnet 2010
Problems with Stop and Wait • Performance • No pipeline effect • Example • For a l.5 Mbps link with 45 ms RTT • Bandwidth-delay product = 67.5 Kb (~8KB) • 1KB packets imply 1/8th link utilization Comnet 2010
rdt3.0 sender: Stop and Wait Comnet 2010 Reliable Data Transfer #10
rdt 3.0 receiver: Stop and Wait rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt) Extract(rcvpkt,data) deliver_data(data) udt_send(ACK[0]) rdt_rcv(rcvpkt) && corrupt(rcvpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt) udt_send(ACK[0]) udt_send(ACK[1]) Wait for 1 Wait for 0 rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) udt_send(ACK[0]) udt_send(ACK[1]) Extract(rcvpkt,data) deliver_data(data) udt_send(ACK[1]) Comnet 2010 Reliable Data Transfer #11
Distance Vector Routing: Basic Idea At node i, the basic update rule for dest. v where - di(v) denotes the distance estimation from i to the destination v, - N(i) is set of neighbors of node i, and - dij is the distance of the direct link from i to j;assume positive destination v j i Comnet 2010 Lecture 6: Network Layer
Distance Vector: poisoned reverse 60 4 1 50 X Z Y If Z routes through Y to get to X : • Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) • will this completely solve count to infinity problem? algorithm terminates Comnet 2010 Lecture 6: Network Layer
A B 1 1 1 C 1 D Example: poisoned reverse fails • When link breaks, C marks D as unreachable and reports that to A and B • Suppose A learns it first. A now thinks best path to D is through B. A reports a route of cost=3 to C. • C thinks D is reachable through A at cost 4 and reports that to B. • B reports a cost 5 to A who reports new cost to C. • etc... Comnet 2010
Clos Network 2x2 2x2 2x2 Clos(N, n , k) : N - inputs/outputs; cross-points: 2 (N/n)nk + k(N/n)2 kxn nxk (N/n)x(N/n) 2x2 3x3 N=6 n=2 k=2 2x2 N 3x3 2x2 k N/n N/n Comnet 2010
Example 2x3 4x4 3x2 2x3 4x4 3x2 N=8 n=2 k=3 2x3 3x2 4x4 2x3 3x2 Clos(8,2,3) Need to route a new call Comnet 2010
Clos Network Why is k=n NOT strict sense non-blocking? Proof gives counter example: kxn nxk (N/n)x(N/n) 2x2 3x3 2x2 N=6 n=2 k=2 2x2 2x2 3x3 2x2 2x2 Blocking means NOT rearrangeable (NOT strict sense non-blocking) Comnet 2010
Clos Network Why is k<n NOT rearrangeable? Proof gives counter example: kxn nxk (N/n)x(N/n) 3x2 3x3 2x3 N=6 n=3 k=2 3x2 2x3 3x3 3x2 2x3 Blocking means NOT rearrangeable (NOT strict sense non-blocking) Comnet 2010