410 likes | 637 Views
Discussion #8 EE450, 10/13/2010. Sample Problems: -ARQ protocols (Sliding window). Draw a timeline diagram for the sliding window algorithm with SWS=RWS=4 frames for two given scenarios using the following assumptions:
E N D
Discussion #8EE450, 10/13/2010 Sample Problems: -ARQ protocols (Sliding window)
Draw a timeline diagram for the sliding window algorithm with SWS=RWS=4 frames for two given scenarios using the following assumptions: The receiver sends a duplicate acknowledgement if it does not receive the expected frame. For example it sends dupack[2] when it expects to see frame[2] but receives frame[3] instead. The receiver sends a cumulative acknowledgement after it receives all the outstanding frames. For example it sends ACK[5] when it receives the lost frame[2] after it already received frame[3], frame[4] and frame[5]. The timeout interval is about 2RTT. Problem#1: Description
Problem#1: Two Scenarios • Frame[2] is lost. Retransmission takes place upon timeout (as usual). • Frame[2] is lost. Retransmission takes place either upon receipt of the first dupack or upon timeout. Does this scheme reduce the transaction time? Note that some end-to-end protocols (e.g. variants of TCP) use a similar scheme for fast retransmission.
Problem#1 Solution: Scenario (a) Receiver Sender Transmission time Frame[1] Frame[2] Frame[3] Ttrans + RTT Ack[1] Frame[4] Dupack[2] Frame[5] Dupack[2] Ttrans + RTT Dupack[2] Frame[2] Timeout=2RTT Ack[5] Frame[6] Ack[6] time time
Problem#1 Solution: Scenario (b) Receiver Sender Transmission time Frame[1] Frame[2] Frame[3] Ttrans + RTT Ack[1] Frame[4] Dupack[2] Frame[5] Dupack[2] Frame[2] Dupack[2] Ttrans + RTT Ack[5] Frame[6] Ack[6] time time
Comparing the two scenarios Transmission time Transmission time Frame[1] Frame[1] Ttrans Frame[2] Frame[2] 2Ttrans Frame[3] Frame[3] Ack[1] Frame[4] Ack[1] Frame[4] Dupack[2] Dupack[2] Frame[5] Frame[5] Timeout=2RTT Dupack[2] Dupack[2] Frame[2] 2Ttrans + 2RTT Dupack[2] Dupack[2] Frame[2] Ack[5] Ttrans + RTT Ack[5] Frame[6] Frame[6] Ack[6] Ack[6] (b) Delay2= 4Ttrans + 2RTT (a) Delay1= 2Ttrans + 3RTT
Comparing the transaction time (transfer delay) in the two scenarios RTT=2Tprop Delay1= 2Ttrans + 3RTT= 2Ttrans + 6Tprop Delay2= 4Ttrans + 2RTT=4Ttrans + 4Tprop ? 2Ttrans + 6Tprop > 4Ttrans + 4Tprop ? 2Tprop > 2Ttrans If Tprop > Ttrans , in Scenario (b) the transaction time is reduced!
Problem#2: Description • A is connected to B via an intermediate router R. • The A-R and R-B links each accept and transmit only one packet per second in each direction (so two packets take 2 seconds). • The two directions transmit independently. • A sends to B using the sliding window protocol with SWS=4.
Problem#2: Questions? • For Time=0, 1, 2, 3, 4, 5 state what packets arrive at and leave each node, or label them on a timeline. 1 pkt/sec 1 pkt/sec A R B What happens if the links have a propagation delay of 1 seconds, but accept immediately as many packets as are offered (i.e. latency= 1 second but bandwidth is infinite). BW=∞ BW=∞ A R B Tprop=1 sec Tprop=1 sec
Part (a) SolutionSWS=4 packets, RTT=4 sec Data[3] Data[2] Data[1] T=0 sec Data[0] A R B Data[3] Data[2] 0<T<1 sec Data[1] Data[0] A R B Data[3] Data[2] 1<T<2 sec Data[1] Data[0] A R B
Part (a) Solution Ctd.Ignoring Ack Transmission Time At T=2 sec Data[0] arrives at B Data[0] Data[3] 2<T<3 sec Data[1] Data[2] A R B Ack[0] At T=3 sec Data[1] arrives at B Data[1] Data[3] Data[2] 3<T<4 sec A R B Ack[0] Ack[1] At T=4 sec Data[2] arrives at B Data[2] Data[4] Data[3] 4<T<5 sec A R B Ack[0] Ack[1] Ack[2] At T=5 sec Data[3] arrives at B, and Data[4] arrives at R
Part (b) SolutionSWS=4 packets, infinite BW, RTT=4 sec Data[3] Data[2] Data[1] T=0 Data[0] A R B Data[3] Data[2] Data[1] Data[0] T=0+sec A R B Data[3] Data[2] Data[1] Data[0] T=1 sec A R B
Part (b) Solution Ctd.Virtually No Transmission Time! Data[3] Data[2] Data[1] Data[0] T=1+ sec A R B Data[0] Data[1] Data[2] T=2 sec Data[3] A R B A R B T=2+ sec Ack[0] Ack[1] Ack[2] Ack[3]
Part (b) Solution Ctd. A R B T=3 sec Ack[0] Ack[1] Ack[2] Ack[3] A R B T=3+ sec Ack[0] Ack[1] Ack[2] Ack[3] Data[7] Data[6] Data[5] Data[4] A R B T=4 sec Ack[0] Ack[1] Ack[2] Ack[3]
Part (b) Solution Ctd. Data[7] Data[6] Data[5] Data[4] T=4+sec A R B Data[7] Data[6] Data[5] Data[4] T=5 sec A R B Data[7] Data[6] Data[5] Data[4] T=5+sec A R B
Problem#3: Description • A is connected to B via an intermediate router R. • The A-R link is instantaneous but the R-B link transmit only one packet per second (so two packets take 2 seconds). • The two directions transmit independently. • A sends to B using the sliding window protocol with SWS=4.
Problem#3 : Questions? Buffer • For Time=0, 1, 2, 3, 4, 5 state what packets arrive at and are sent from each node. • How large does the queue at R grow? BW=Infinity 1 pkt/sec A R B Tprop=0 sec
Part (a) SolutionSWS=4 packets, RTT=2 sec Data[3] Data[2] Data[1] T=0 sec Data[0] A R B Data[3] Data[2] T=0+sec Data[1] Data[0] A R B Data[3] 0<T<1 sec Data[2] Data[0] Data[1] A R B
Part (a) Solution Ctd.Ignoring Ack Transmission Time At T=1 sec Data[0] arrives at B Data[3] Data[0] 1<T<2 sec Data[1] Data[2] A R B Ack[0] Data[1] Data[2] Data[3] T=2 sec A R B Ack[1] Ack[0]
Part (a) Solution Ctd. Data[1] Data[4] T=2+sec Data[2] Data[3] A R B Ack[0] Ack[1] At T=3 sec Data[2] arrives at B, and Ack[1] arrives at R Data[2] 3<T<4sec Data[3] Data[4] A R B Ack[1] Ack[2]
Part (a) Solution Ctd. Data[2] Data[5] T=3+sec Data[3] Data[4] A R B Ack[1] Ack[2] At T=4 sec Data[3] arrives at B, and Ack[2] arrives at R Data[3] 4<T<5sec Data[4] Data[5] A R B Ack[2] Ack[3]
Part (a) Solution Ctd. Data[3] Data[6] T=4+sec Data[4] Data[5] A R B Ack[2] Ack[3] At T=5 sec Data[4] arrives at B, and Ack[3] arrives at R Part (b) Solution The steady-state queue size at R is two Data Frames.
Problem#4: Description • Consider the same topology and situation as in problem #2. • Assume that the router has a buffer size of 1, i.e. it can hold one packet (or frame) in to addition to the one it is sending (in each direction). • Assume that A has a timeout interval of 4 sec and SWS=4.
Problem#4 : Questions? From Time=0, show what happens at each second until all four packets successfully arrive at B. Buffer size=1 BW=∞ 1 pkt/sec A R B Tprop=0 sec
SolutionSWS=4 packets, RTT=2 sec Data[3] Data[2] Data[1] T=0 sec Data[0] A R B Dropped Data[3] Data[0] Data[2] T=0+sec Data[1] A R B 0<T<1 sec Data[0] Data[1] A R B
Solution Ctd.Ignoring Ack Transmission Time Data[0] Data[1] A R B 1<T<2 sec Ack[0] Data[1] T=2 sec A R B Ack[0] Ack[1] Data[4] A R B T=2+sec Ack[0] Ack[1]
Solution Ctd.Ignoring Ack Transmission Time Data[4] A R B T=3 sec Ack[1] Data[4] Data[5] Buffered at B. A R B T=3+sec Ack[1] B receives an out of order frame, it does not send an Ack. At T=4 Timeout for Data[2] and Data[3]. A starts retransmitting them. At T=4 sec Data[5] also arrives at B. Data[3] Data[4] Data[2] T=4 Data[5] A R B Buffered at B.
Solution Ctd.Ignoring Ack Transmission Time Data[2] Data[4] Data[3] T=4+sec Data[5] A R B Buffered at B. At T=4+sec, R has started transmitting Data[2] while Data[3] is enqueued. Data[4] Data[3] Data[2] A R B Data[5] 4<T<5 sec Buffered at B.
Solution Ctd. Data[3] Data[2] Data[4] Data[5] A R B T=5+sec Buffered at B. Data[4] 5<T<6sec Data[2] Data[3] Data[5] A R B Buffered at B. Ack[2] B received Data[2] which was in-order, so it sends an Ack[2]. T=6sec Data[3] Data[4] A R B Data[5] Buffered at B. Ack[2] B receives Data[3] and can send a Cumulative Ack for Data[3],Data[4] and Data[5]
Solution Ctd. Data[6] T=6+sec A R B Ack[2] Ack[5] Cumulative Data[6] 6<T<7 sec A R B Ack[5] Cumulative Data[9] Data[6] Data[8] Data[7] A R B T=7+sec Ack[5] Ack[6] Cumulative
Problem#5: Description Suppose we run: • A sliding Window Protocol (or algorithm) • With SWS=5, RWS=3 • And no out of order arrivals
Problem#5 : Questions? • What is the smallest value for MaxSeqNum? Hint: Assume that it suffices to find the smallest MaxSeqNum such that if Data[MaxSeqNum] is in the receive window, Data[0] can no longer arrive. • Give an example showing that MaxSeqNum-1 is not sufficient. • State a general rule for the minimum MaxSeqNum in terms of SWS and RWS.
Part (a) Solution • The smallest working value for MaxSeqNum is SWS+RWS= 5 +3 =8. • The earliest possible receive window is Data[6], Data[7], Data[8]. • Data[5] was delivered and Acknowledged. • Since SWS=5, all Data[0]s were sent before Data[5] and by the “no out of order” hypothesis, Data[0] can no longer arrive.
Part (b) Solution • MaxSeqNum-1=7 is not enough because: • When the receiver is expecting Data[7], an old Data[0] can still arrive. • 0 and 7 are indistinguishable in mod (MaxSeqNum-1) so receiver can not tell which one has arrived. • Consider this example: • Sender sends Data[0] through Data[4] and they all arrive so receiver sends Ack[4] but it’s slow. • The receive window is now Data[5],Data[6] and Data[7]. • Sender times out and retransmits Data[0]. • Receiver accepts it as Data[7].
Part (c) Solution • A general rule for minimum MaxSeqNum in terms of SWS and RWS: MaxSeqNum >= SWS+ RWS
Problem#6: Description Suppose we run: • A sliding Window Protocol (or algorithm) • With SWS=RWS=3 • And no out of order arrivals • And infinite-precision sequence numbers
Problem#6 : Questions? • If Data[6] is in the receive window, Data[0] (or in general any older data) can no longer arrive (hence that MaxSeqNum = 6 would have sufficed). • Show that if Ack[6] may be sent ( or more literally, that DATA[5] is in the sending window) then ACK[2] (or earlier) cannot be received.
Problem #6: Hints • Reminder: Let ACK[N] denote the acknowledgment of all data packets less than N. • Note that data below the sending window (that is, <LAR) is never sent again. • Hence – because out-of-order arrival is disallowed – if DATA[N] arrives at the receiver then nothing at or before DATA[N-3] can arrive later. • Similarly for ACKs, if ACK[N] arrives then (because ACKs are cumulative) no ACK before ACK[N] can arrive later.
Part (a) Solution • If DATA[6] is in the receive window, then the earliest that window can be is DATA[4]-DATA[6]. • This implies ACK[4] was sent, thus DATA[1]-DATA[3] were received, and thus DATA[0] can no longer arrive.
Part (b) Solution • If ACK[6] may be sent, then the lowest the sending window can be is DATA[3]...DATA[5]. • This means that ACK[3] must have been received. • Once an ACK is received, no smaller ACK can ever be received later.
Problem#7 • Design a sliding window ARQ protocol for: • A 1Mbps point-to-point link to the moon • With a one-way latency of 1.25sec • And a frame size of 1KB Minimum number of bits needed for the sequence number? Solution: RTT=2 × 1.25sec=2.5 sec BW=1Mbps=125 KBps Window size=BW × RTT=125KB/sec × 2.5 sec=312 KB or 312 frames Sequence number space= 2 × window size= 2 × 312=624 bits required for sequence number space= log2 624=9.285 ~10 bits