0% found this document useful (0 votes)
89 views10 pages

Homework 2 Solutions

1. The document provides solutions to homework problems about TCP congestion control and windowing mechanisms. It analyzes scenarios involving TCP send and receive windows, packet sequencing and acknowledgments. 2. The solutions examine concepts like slow start, congestion avoidance, fast retransmit, and how protocols like GoBackN and Selective Repeat handle lost packets. Threshold values and how they are set depending on detected packet loss are also discussed. 3. Various TCP properties are analyzed including how congestion control would work over a stop-and-wait protocol versus a pipelined one, throughput calculations for different bandwidth-delay products, and factors that influence how long it takes to fully utilize a high bandwidth-delay link.

Uploaded by

Josh at night
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views10 pages

Homework 2 Solutions

1. The document provides solutions to homework problems about TCP congestion control and windowing mechanisms. It analyzes scenarios involving TCP send and receive windows, packet sequencing and acknowledgments. 2. The solutions examine concepts like slow start, congestion avoidance, fast retransmit, and how protocols like GoBackN and Selective Repeat handle lost packets. Threshold values and how they are set depending on detected packet loss are also discussed. 3. Various TCP properties are analyzed including how congestion control would work over a stop-and-wait protocol versus a pipelined one, throughput calculations for different bandwidth-delay products, and factors that influence how long it takes to fully utilize a high bandwidth-delay link.

Uploaded by

Josh at night
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Homework 2 Solutions

1. P19:

a) Here we have a window size of N=3. Suppose the receiver has received packet k-1, and
has ACKed that and all other preceeding packets. If all of these ACK's have been received by
sender, then sender's window is [k, k+N-1]. Suppose next that none of the ACKs have been
received at the sender. In this second case, the sender's window contains k-1 and the N
packets up to and including k-1. The sender's window is thus [k-N,k-1]. By these arguments,
the senders window is of size 3 and begins somewhere in the range [k-N,k].

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

2. P22:

a) True. Suppose the sender has a window size of 3 and sends packets 1, 2, 3 at t0. At t1,
(t1>t0) the receiver ACKS 1, 2, 3. At t2, (t2>t1) the sender times out and resends 1, 2, 3.
At t3 the receiver receives the duplicates and re-acknowledges 1, 2, 3. At t4 the sender
receives the ACKs that the receiver sent at t1 and advances its window to 4, 5, 6. At t5
the sender receives the ACKs 1, 2, 3 the receiver sent at t2. These ACKs are outside its
window.

b) True. By essentially the same scenario as in (a).

c) True.

d) True. Note that with a window size of 1, SR, GBN, and the alternating bit protocol are
functionally equivalent. The window size of 1 precludes the possibility of out-of-order
packets (within the window). A cumulative ACK is just an ordinary ACK in this situation,
since it can only refer to the single packet within the window.

3. P25:

a. In the second segment from Host A to B, the sequence number is 197, 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 197, 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.
Host A Host B

Seq = 127, 70 bytes

Timeout Seq = 197, 50 bytes Ack = 197


interval

Ack = 247
Seq = 127, 70 bytes

Timeout Ack = 247


interval

4. P34:

Note that there is a typo in the textbook.


part b, “5” is missing in “ ⋅ RTT ”.
“If the timeout values for all three protocol are much longer than ⋅ RTT ”

“If the timeout values for all three protocol are much longer than 5 ⋅ RTT ”

a).
GoBackN:
A sends 9 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent
segments 2, 3, 4, and 5.
B sends 8 ACKs. They are 4 ACKS with sequence number 1, and 4 ACKS with sequence
numbers 2, 3, 4, and 5.

Selective Repeat:
A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent
segments 2.
B sends 5 ACKs. They are 4 ACKS with sequence number 1, 3, 4, 5. And there is one
ACK with sequence number 2.

TCP:
A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent
segments 2.
B sends 5 ACKs. They are 4 ACKS with sequence number 2. There is one ACK with
sequence numbers 6. Note that TCP always send an ACK with expected sequence
number.

b). TCP. This is because TCP uses fast retransmit without waiting until time out.

5. P37:

a) TCP slowstart is operating in the intervals [1,6] and [23,26]


b) TCP congestion advoidance 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 the 22nd transmission 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 slowtart 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, packet 1 is sent; packet 2-3 are sent in the 2nd
transmission round; packets 4-7 are sent in the 3rd transmission round; packets 8-15 are sent in the 4th
transmission round; packets 16-31 are sent in the 5th transmission round; packets 32-63 are sent in the
6th transmission round; packets 64 – 96 are sent in the 7th transmission round. 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.
j) Threshold is 21, and congestion window size is 1.
k) round 17, 1 packet; round 18, 2 packets; round 19, 4 packets; round 20, 8 packets; round
21, 16 packets; round 22, 21 packets. So, the total number is 52.

6. P39:
If TCP were a stop-and-wait protocol, then the doubling of the time out interval would
suffice as a congestion control mechanism. However, TCP uses pipelining (and is therefore
not a stop-and-wait protocol), which allows the sender to have multiple outstanding
unacknowledged segments. The doubling of the timeout interval does not prevent a TCP
sender from sending a large number of first-time-transmitted packets into the network, even
when the end-to-end path is highly congested. Therefore a congestion-control mechanism is
needed to stem the flow of “data received from the application above” when there are signs
of network congestion.
7. P40:
In this problem, there is no danger in overflowing the receiver since the receiver’s receive
buffer can hold the entire file. Also, because there is no loss and acknowledgements are
returned before timers expire, TCP congestion control does not throttle the sender. However,
the process in host A will not continuously pass data to the socket because the send buffer
will quickly fill up. Once the send buffer becomes full, the process will pass data at an
average rate or R << S.

8. P43:

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.1=10*10^6, then W is about 84 (ceiling of 83.3) segments.
As congestion window size varies from W/2 to W, then the average window size is
0.75W=63 segments. Average throughput is 63*1500*8/0.1=7.56Mbps.
84/2 *0.1= 4.2 seconds, as the number of RTTs (that this TCP connections needs in order
to increase its window size from W/2 to W) is given by W/2. Recall the window size
increases by one in each RTT.

9. P44:

Let W denote max window size. Let S denote the buffer size. For simplicity, suppose TCP
sender sends data packets in a round by round fashion, with each round corresponding to a
RTT. If the window size reaches W, then a loss occurs. Then the sender will cut its
congestion window size by half, and waits for the ACKs for W/2 outstanding packets before
it starts sending data segments again. In order to make sure the link always busying sending
data, we need to let the link busy sending data in the period W/(2*C) (this is the time interval
where the sender is waiting for the ACKs for the W/2 outstanding packets). Thus, S/C must
be no less than W/(2*C), that is, S>=W/2.
Let Tp denote the one-way propagation delay between the sender and the receiver.
When the window size reaches the minimum W/2 and the buffer is empty, we need to make
sure the link is also busy sending data. Thus, we must have W/2/(2Tp)>=C, thus,
W/2>=C*2Tp.
Thus, S>=C*2Tp.

10. P45:

a. Let W denote the max window size. Then, W*MSS/RTT = 10Gbps, as packets will be
dropped if maximum sending rate reaches link capacity. Thus, we have
W*1500*8/0.1=10*10^9, then W= 83334 segments.
b. As congestion window size varies from W/2 to W, then the average window size is
0.75W=62501 segments. Average throughput is 62501*1500*8/0.1=7.5Gbps.
c. 83334/2 *0.1 /60= 69 minutes. In order to speed up the window increase process, we can
increase the window size by a much larger value, instead of increasing window size only by
one in each RTT. Some protocols are proposed to solve this problem, such as ScalableTCP or
HighSpeed TCP.
11. P47:
a. The key difference between C1 and C2 is that C1’s RTT is only half of that of C2.
Thus C1 adjusts its window size after 100 msec, but C2 adjusts its window size after 200
msec.
Assume that whenever a loss event happens, C1 receives it after 100msec and C2
receives it after 200msec.

We further have the following simplified model of TCP.


After each RTT, a connection determines if it should increase window size or not. For C1,
we compute the average total sending rate in the link in the previous 100 msec. If that
rate exceeds the link capacity, then we assume that C1 detects loss and reduces its
window size. But for C2, we compute the average total sending rate in the link in the
previous 200msec. If that rate exceeds the link capacity, then we assume that C2 detects
loss and reduces its window size.
Note that it is possible that the average sending rate in last 100msec is higher than the
link capacity, but the average sending rate in last 200msec is smaller than or equal to the
link capacity, then in this case, we assume that C1 will experience loss event but C2 will
not.

The following table describes the evolution of window sizes and sending rates based on
the above assumptions.

C1 C2

Time Window Size Average data sending Window Average data sending
(msec) rate (segments per Size(num. rate (segments per
(num. of second, =Window/0.1) of segments second, =Window/0.2)
segments sent sent in next
in next 200msec)
100msec)

0 10 100 (in [0-100]msec] 10 50 (in [0-100]msec)

100 5 50 (in [100-200]msec] 50 (in [100-200]msec)

(decreases
window size
as the avg.
total sending
rate to the link
in last
100msec is
150= 100+50)

200 2 20 5 25

(decreases (decreases
window size window size
as the avg. as the avg.
total sending total
rate to the link sending rate
in last to the link in
100msec is last
100= 50+50) 200msec is
125=
(100+50)/2
+
(50+50)/2)

300 1 10 25

(decreases
window size
as the avg.
total sending
rate to the link
in last
100msec is
45= (20+25)

400 1 10 2 10

(no further (decreases


decrease, as window size
window size as the avg.
is already 1) total
sending rate
to the link in
last
200msec is
40=
(20+10)/2 +
(25+25)/2)

500 2 20 10

600 3 30 3 15

700 1 10 15

800 2 20 1 5

900 3 30 5

1000 1 10 2 10

(decreases (increases
window size window size
as the avg. as the avg.
total sending total
rate to the link sending rate
in last to the link in
100msec is last
35= (30+5) 200msec is
30=
(20+30)/2 +
(5+5)/2)

1100 2 20 10

1200 3 30 3 15

1300 1 10 15

1400 2 20 1 5

1500 3 30 5

1600 1 10 2 10

1700 2 20 10

1800 3 30 3 15

1900 1 10 15

2000 2 20 1 5
2100 3 30 5

2200 1 10 2 10

Based on the above table, we find that after 2200 msec, C1’s window size is 1 segment
and C2’s window size is 2 segments.

b. No. In the long run, C1’s bandwidth share is roughly twice as that of C2’s, because C1
has shorter RTT, only half of that of C2, so C1 can adjust its window size twice as fast as
C2. If we look at the above table, we can see a cycle every 600msec, e.g. from 1400msec
to 1900msec, inclusive. Within a cycle, the sending rate of C1 is
(20+30+10+20+30+10)/6 = 120, which is twice as large as the sending of C2 given by
(5+5+10+10+15+15)/6=60.

12. P48:
a. Similarly as in last problem, we can compute their window sizes over time in the following
table. Both C1 and C2 have the same window size 2 after 2200msec.

C1 C2
Time (msec) Window Size Data sending Window Data sending
(num. of speed (segments Size(num. of speed (segments
segments sent in per second, segments sent in per second,
next 100msec) =Window/0.1) next 100msec) =Window/0.1)
0 15 150 (in [0- 10 100 (in [0-
100]msec] 100]msec)
100 7 70 5 50
200 3 30 2 20
300 1 10 1 10
400 2 20 2 20
500 1 10 1 10
600 2 20 2 20
700 1 10 1 10
800 2 20 2 20
900 1 10 1 10
1000 2 20 2 20
1100 1 10 1 10
1200 2 20 2 20
1300 1 10 1 10
1400 2 20 2 20
1500 1 10 1 10
1600 2 20 2 20
1700 1 10 1 10
1800 2 20 2 20
1900 1 10 1 10
2000 2 20 2 20
2100 1 10 1 10
2200 2 20 2 20

b. Yes, this is due to the AIMD algorithm of TCP and that both connections have the same
RTT.
c. Yes, this can be seen clearly from the above table. Their max window size is 2.
d. No, this synchronization won’t help to improve link utilization, as these two connections
act as a single connection oscillating between min and max window size. Thus, the link is not
fully utilized (recall we assume this link has no buffer). One possible way to break the
synchronization is to add a finite buffer to the link and randomly drop packets in the buffer
before buffer overflow. This will cause different connections cut their window sizes at
different times. There are many AQM (Active Queue Management) techniques to do that,
such as RED (Random Early Detect), PI (Proportional and Integral AQM), AVQ (Adaptive
Virtual Queue), and REM (Random Exponential Marking), etc.

13. P51:
An advantage of using the earlier values of cwnd and ssthresh at t2 is that TCP would not
have to go through slow start and congestion avoidance to ramp up to the throughput value
obtained at t1. A disadvantage of using these values is that they may be no longer accurate. In
particular, if the path has become more congested between t1 and t2, the sender will send a
large window’s worth of segments into an already (more) congested path.

14. P53:

a) Referring to the figure below, we see that the total delay is


RTT + RTT + S/R + RTT + S/R + RTT + 12S/R = 4RTT + 14 S/R
b) Similarly, the delay in this case is:
RTT+RTT + S/R + RTT + S/R + RTT + S/R + RTT + 8S/R = 5RTT +11 S/R
c) Similarly, the delay in this case is:
RTT + RTT + S/R + RTT + 14 S/R = 3 RTT + 15 S/R
15. Wireshark TCP:

See the separate pdf file.

You might also like