ECE/CS 372–Introduction to Computer Networks Solutions

advertisement

1

ECE/CS 372–Introduction to Computer Networks

Solutions – Assignment #2

Stephen Redfield, School of EECS, Oregon State University

Credit to Bechir Hamdaoui and Kurose & Ross

(Textbook Version 6)

Problem 22, Page 292 a) Since the next in-order packet that the receiver is expecting is k (meaning packet with sequence number k), then the receiver must have received packet k-1 and all packets that proceed packet k-1. The receiver must have also

ACK’ed all and up to packet k-1. There are two extreme cases to consider:

1) all ACKs (ACKs for packet k-1, k-2, and all before that) have been received by sender. In this case, the sender’s window is [k, k+1, k+2, k+3]; that is, the sender has sent packets k, k+1, k+2, and k+3 and is waiting for ACKs. 2)

None of the ACKs have been received by sender. In this case, the sender’s window is [k-4,k-3,k-2,k-1]. Note here that since the receiver has received packet k-1, then the sender must have sent it, and that’s why packet k-1 must be the last packet of the window. Therefore, the possible sets of sequence numbers inside the sender’s window at time t are

[k-4,k-3,k-2,k-1], [k-3,k-2,k-1,k], [k-2,k-1,k,k+1], [k-1,k,k+1,k+2], and [k,k+1,k+2,k+3]. b) If the receiver is waiting for packet k, then it must have received (and ACKed) packets k-4, k-3, k-2, and k-1. If none of those 4 ACKs have been yet received by the sender, then ACK messages with values of [k-4,k-3,k-2,k-1] may still be propagating back. Because the sender has sent packets [k-4,k-3,k-2,k-1], it must be the case that the sender has already received an ACK for packet k-5. Once the receiver has sent an ACK for packet k5, it will never send an ACK that is less than k-5. Thus the range of in-flight ACK values can range from k-5 to k-1.

Problem 27, Page 293 a) In the second segment from Host A to B, the sequence number is 207, source port number is 302 and destination port number is 80. b) If the first segment arrives before the second, in the acknowledgement of the first arriving segment, the acknowledgement number is 207, the source port number is 80 and the destination port number is 302. c) If the second segment arrives before the first segment, in the acknowledgement of the first arriving segment, the acknowledgement number is 127, indicating that it is still waiting for bytes 127 and onwards. d) See figure below.

2

Problem 32, Page 295 a) and b) Let EstimatedRTT

( n ) denote the RTT estimate after the n th

RTT sample. We can then write:

EstimatedRTT

EstimatedRTT

EstimatedRTT

( n ) = α

SampleRTT

( n − 1 ) = α

SampleRTT

( n − 2 )

1

+ (1 – α )

EstimatedRTT ( n − 1 )

= α

SampleRTT

2

+ (1− α )

EstimatedRTT

( n − 2 )

3

+ (1− α )

EstimatedRTT

( n − 3 )

. . .

EstimatedRTT (3) = αSampleRTT n−2

+ (1 − α)EstimatedRTT (2)

EstimatedRTT (2) = αSampleRTT n−1

+ (1 – α)EstimatedRTT (1)

EstimatedRTT (1) = SampleRTT n

(Eq 1)

(Eq 2)

(Eq 3)

(Eq n-2)

(Eq n -1)

(Eq n)

First, note that the last equation (Eq n) is different from all others because EstimatedRTT

( 1 ) is the first estimate, and hence, it is set to the first RTT sample. Now, by multiplying both sides of Eq (i) by

(1− α ) i −1 , and then adding up all n equations, we obtain:

EstimatedRTT

( n )

= α (1− α ) 0

SampleRTT

1

+ α (1 − α ) 1

SampleRTT

2

+ . . .

+ α (1− α ) n −2

SampleRTT n

1

+(1− α ) n −1

SampleRTT n

SampleRTT i

+ (1− α ) n −1

SampleRTT n

For n=4, we get EstimatedRTT

( 4 ) = ∑ 3 i =1

α (1− α ) i −1

SampleRTT i

+(1− α ) 3

SampleRTT

4 c) Note that, in the expression of EstimatedRTT

SampleRTT j

( n ) given above, the weight associated with the j th RTT sample (i.e.,

) is

α (1− α ) j −1

(ignore the first estimate which corresponds to j = n

; it is set to

(1− α ) n −1 since the first RTT estimate was simply set to the first sample and didn’t follow the moving average rule). Also note that the higher the index j

, the older the sample. Since

α (1− α ) j −1 decreases exponentially as j goes to infinity (because

α is less than 1), weights associated with the RTT samples also decay exponentially with age of samples. Weights given to past samples decay exponentially.

Problem 40, Page 296 a) TCP slowstart is operating in the intervals [1,6] and [23,26] b) TCP congestion avoidance is operating in the intervals [6,16] and [17,22] c) After the 16th transmission round, packet loss is recognized by a triple duplicate ACK. If there was a timeout, the congestion window size would have dropped to 1. d) After 22nd round, segment loss is detected due to timeout, and hence the congestion window size is set to 1. e) The threshold is initially 32, since it is at this window size that slowstart stops and congestion avoidance begins. f) The threshold is set to half the value of the congestion window when packet loss is detected. When loss is detected during transmission round 16, the congestion windows size is 42. Hence the threshold is 21 during the 18th transmission round. g) The threshold is set to half the value of the congestion window when packet loss is detected. When loss is detected during transmission round 22, the congestion windows size is 26. Hence the threshold is 13 during the 24th transmission round. h) During the 1st transmission round, w=1, so packet 1 is sent; during the 2nd transmission round w=2, so packets 2-3 are sent; during the 3rd transmission round w=4, so packets 4-7 are sent; during the 4th transmission round w=8, so packets 8-15 are sent; during the 5th transmission round w=16, so packets 16-31 are sent; during the

6th transmission round, w=32, so packets 32-63 are sent; during the 7th transmission round w=32+1=33, so packets

6496 are sent. Thus packet 70 is sent in the 7th transmission round. i) The congestion window and threshold will be set to half the current value of the congestion window (8) when the loss occurred. Thus the new values of the threshold and window will be 4.

3 j) The congestion window will be set to 1 when packet loss is detected via three duplicate ACKs, and the threshold will be set to half the current value of the congestion window (42) when the loss occurred; that is, threshold is set to 21 during the 17th transmission round. TCP Tahoe invokes Slow Start after round 17, and hence, at round

17, the window is 1; at round 18, the window is 2; and at round 19, the widow is 4. The threshold at round 19 is also still 21. k) Again, we assume TCP Tahoe here, and at round 17, TCP Tahoe invokes Slow Start where the threshold is set to 21 (as shown in j) above). Hence, during round 17, 1 packet is sent; during round 18, 2 packets are sent; during round 19, 4 packets are sent; during round 20, 8 packets are sent; during round 21, 16 packets are sent; during round 22, 21 packets are sent (reaching the threshold, which equals 21). So, the total number is 52.

Problem 44, Page 297 a) It takes 1 RTT to increase CongWin to 7 MSS; 2 RTTs to increase to 8 MSS; 3 RTTs to increase to 9 MSS;4

RTTs to increase to 10 MSS; 5 RTTs to increase to 11 MSS; and 6 RTTs to increase to 12 MSS. b) In the first RTT, 6 MSSs were sent; in the second RTT, 7 MSSs were sent; in the third RTT, 8 MSSs were sent; in the fourth RTT, 9 MSSs were sent; in the fifth RTT, 10 MSSs were sent; and in the sixth RTT, 11 MSS was sent. Thus, up to time 6 RTT, 6+7+8+9+10+11 = 51 MSSs were sent (and acknowledged). Thus, we can say that the average throughput up to time 6 RTT was (51 MSS)/(6 RTT) = (51/6) MSS/RTT.

Problem 45, Page 297 a) The loss rate, L , is the ratio of the number of packets lost over the number of packets sent. In a cycle, 1 packet is lost. The number of packets sent in a cycle is

Hence, the loss rate is b) For

W large, . Thus . From the lecture, we know that average throughput . Hence, replacing

W with , we get average throughput

1.22 π‘₯ 𝑀𝑆𝑆

𝑅𝑇𝑇 √𝐿

Problem 46, Page 298 a) Let W denote the max window size measured in segments. Then, W*MSS/RTT = 10Mbps, as packets will be dropped if the maximum sending rate exceeds link capacity. Thus, we have W

∗1500∗8 / 0 .

15 = 10∗10 6

, then W is about 125 segments. b) As congestion window size varies from W/2 to W, then the average window size is 0.75W=93.75 segments.

Average throughput is

93 .

75∗1500∗8 / 0 .

15 = 7 .

5

Mbps. c) (125/2)*0.15= 9.375 seconds, as the number of RTTs this TCP connections needs in order to increase its window size from W/2 to W is W/2. Recall the window size increases by one in each RTT.

Download