Lecture 4 (Feb. 11) Last Lecture -- layering architecture (cont'd) -- reliable transmission Today -- reliable transmission (cont'd) -- data link protocol- ARQ -- sliding window ______________________________________________________________________ Delay x Bandwidth (DBW)Product --Revisit ------------------------------ --- used for measuring link capacity --- for example, if two hosts, A and B, are connected by a 10Mbps link, and the (propagation) delay between A and B is 1 ms, DBW product is 1000 bits ~ 1KB --- if a packet size is 0.2 KB, we say, "there are 5 outstanding packets" in this link ARQ (automatic repeat request) Schemes -------------------------------------- --- these schemes are used to recover corrupted packets --- functions include sending acknowledgments from the receiving end, and time-out retransmissions from the transmitting end >>Stop-and-Wait --a type a ARQ schemes with some short comings --- transmission of only a single packet at a time (and wait for acknowledgment ACK or time-out) --- low utilization of link capacity (the "pipe" is not full) >>Sliding Window -- an alternative to Stop-and-Wait Role of Sliding Window ---------------------- 1) reliable delivery of frames across unreliable link(s) 2) preserve the order in which frames are transmitted 3) support flow control Features of Sliding Window -------------------------- --- can transmit multiple packets sequentially before receiving ACK for first packet(s)(i.e., tries to fill up the pipe) --- requires buffers (memory to store packets) in both transmitting and receiving ends --- assigns sequence numbers (integers) ,SeqNum, to label transmitted frames --- the buffer size (# of frames) of sender and receiver: SWS (send window size) and RWS (receiver window size), respectively *note: a frame is usually an integer multiple of packets Sliding Window Size --- SWS>= LFS - LAR (LFS=last frame sent, LAR=last ACK received) --- RWS>= LFA - NFE + 1 (LFA=last frame acceptable, NFE=next frame expected) Selecting Finite Sequence Numbers and Window Size --- SWS depends on DBW product --- RWS<=SWS (why?) --- when RWS=SWS, SWS < (maximum SeqNum + 1)/2 (why?) Example --- consider a 10 Mbps link between A (sender) and B (receiver) with RTT=10 ms DBW product= 100 Kbits = 12.5 KB --- if a frame size=3 KB, then A can send 4 frames (12KB) before receiving ACK the pipe is ~ (12/12.5)= 96%full --- then SWS=4, maximum SeqNum = 8 will suffice --- let's select 3-bit sequence numbers: 0,1,2,3,4,5,6,7 *note: sequence number selection is arbitrary. We could have chosen 23,24,25,26,27,28,29. Of course, the binary representation of these numbers may require more bits (5 bits in this case). In fact, in TCP, the starting SeqNum is not 0, but a random number. --- RWS<=4 (let's take RWS=3) --- sender's buffer: [2 3 4 5], LAR=1, LFS=5 (cannot send 6 since 2 is not yet ACK, and may need retransmission if no ACK=2 before time-out) --- receiver's buffer: [_ 3 _], NFE=2, LFA=4 (still waiting for 2, and there's one more buffer space for 4 if it arrives before 2) --- if 2 arrives before 4, then ACK=3 is sent; receiver's buffer: [_ _ _],NFE=4, LFA=6 --- if 4 arrives before 2, receiver's buffer: [_ 3 4], NFE=2, LFA=4 ACK options ----------- --there are several approaches the receiver can use to signal the sender that it is still waiting for frame #2. --- negative acknowledgment: send negative acknowledgment of 2, NAK=2 --- acknowledge again: send ACK=1 again to remind the sender that it is still waiting for 2 --- selective acknowledgment: send ACK=3 and 4 (adds complexity) Flow Control Using Sliding Window --------------------------------- --- the receiver can "control" data flow; i.e. the incoming data rate into the buffer, by delaying ACK --- an example is when RWS is much less than SWS --- delayed ACK for flow control is not efficient (why?), and as we will see later, TCP uses a different strategy