TELCOM 2310 HW2 Soln PDF
TELCOM 2310 HW2 Soln PDF
HW 2: Solutions
Each Question weighs 25 points. Total: 4 ×25 = 100 pts (+10 bonus points from question 5).
1. In lecture, we mentioned that for a reliable data transfer protocol using the Selective Repeat
approach, the sequence number space must be at least twice the window size (assume the
sender and receiver use the same window size, and the network does not re-order messages).
(a) Explain in your own words why this is true, and give an example that shows why the
sequence space cannot be smaller. Specifically, for your example, consider a window size
of 4. In this case, we need at least 8 valid sequence numbers (e.g. 0-7). Give a specific
scenario that shows where we could encounter a problem if the sequence space was less
than 8 (i.e. explain what messages and acks are sent and received; it may be helpful to
draw sender and receiver windows). (10pts)
The sequence space must be at least twice the window size to ensure that the receiver
cannot misinterpret a retransmitted message as a valid new transmission that fits within
its window. The receiver can buffer up to one window (N) packets, and the sender can
have one window (N) of unacknowledged packets at any time. In the worst case, the
receiver has received the full window of packets and advanced its window, but all of
the acknowledgments have been lost, so the sender’s window is exactly one full window
“behind” the receiver. Let the sequence number at the beginning of the sender’s win-
dow be 0. Then, in the worst case, the sender’s window contains sequence numbers 0
through N − 1, and the receiver’s window contains sequence numbers N through 2N − 1.
Therefore, to ensure that no sequence number in the sender’s window can be interpreted
as a valid new packet in the receiver’s window, we must have that the largest possible
sequence number is at least 2N − 1, for a total of at least 2N distinct sequence numbers.
Figure 1: Example illustrating that 7 sequence numbers are not sufficient for selective repeat with
a window N=4
1
sequence number 0. So, if the sender times out and retransmits the packet with sequence
number 0 (which was already received by the receiver), the receiver will misinterpret it
as a new packet, instead of correctly recognizing it as a duplicate.
Figure 2: Example illustrating that 8 sequence numbers are sufficient for selective repeat with
window N=4
In Figure 2, we see that if we use 8 distinct sequence numbers, the problem described
above cannot occur: the sender and receiver windows cannot contain the same sequence
number but have it refer to different packets.
(b) What relationship between sequence number space and window size is needed for Go-
Back-N? Explain in your own words why this is true, and give an example that shows
why the sequence space cannot be smaller. (15pts)
For a window of size N , the sequence space must be at least N + 1. This will ensure
that no message retransmitted by the sender is incorrectly interpreted as a valid new
message by the receiver. In contrast to selective repeat, the receiver does not buffer
packets received out of order. Therefore, a packet will only be accepted as valid if it has
the next expected sequence number.
In the worst case, the sender’s window contains sequence numbers 0 through N − 1, but
the receiver has actually already received all of those packets and is expecting sequence
number N . So, to make sure that the receiver’s expected sequence number is not also a
valid sequence in the sender’s window, we need that the maximum sequence number is
at least N (giving us at least N + 1 distinct sequence numbers).
Figure 3: Example illustrating minimum sequence number space for Go-Back-N with N=4
In the example above, the window size is 4 and we have exactly 4 distinct sequence
numbers (0-3). In this case, the sender has sent messages with sequence numbers 0-3.
The receiver has received all of those messages, so it is expecting sequence number 0.
But, all of the acks sent by the receiver were lost, so the sender will try to retransmit
the old message with sequence number 0. The receiver will misinterpret this as a new
message. Extending the sequence space to include sequence numbers 0-4 solves this
problem (in this example, the receiver would expect sequence number 4, which is not in
the sender’s window)
2. Consider TCP’s algorithm for setting and dynamically adapting its timeout value, as described
in lecture. Assume α = 0.125 and β = 0.25. Assume that at some point in time the
EstimatedRTT is 200ms and the DevRTT is 40ms. From this point on, all measured RTTs
are exactly 20ms.
2
(a) What is the timeout interval after 10 RTT measurements? (10pts)
Timeout = 336.88 ms (see attached code)
(b) How many such RTT measurements are needed before the timeout interval falls below
50ms? (15pts)
29 At that point, the timeout interval is 49.7 ms (see attached code, run with -i 30)
Note: You will likely find it useful to write a small program or use a spreadsheet (particularly
for part b). If you use this approach, please attach the code or spreadsheet to your solution.
3. Consider a TCP connection where the sender sends segments at a constant rate of one every
10ms, and the receiver sends ACKs back at the same rate without delay. Assume the roundtrip
propagation delay is 300ms. A segment is lost, and upon receipt of the third duplicate ACK,
the fast retransmit algorithm detects the loss and retransmits the lost segment. Assume that
3
the lost segment is not the first data segment of the connection, and ignore transmission,
processing, and queuing delays.
If the sender must wait to receive an acknowledgment for the lost segment before sliding its
window forward and transmitting new data:
(a) How much total time does the sender lose compared with lossless transmission (i.e. how
much longer does it wait to receive the ack and slide the window forward, compared to
the case where there is no loss)?
Hint: consider that the lost segment is initially sent at time T = 0. At what time would
the sender receive the ACK for that segment in the no-loss case? At what time does
that happen if the sender first needs to detect the loss, retransmit the segment, and then
receive the ACK? (15pts)
Consider that the lost segment is initially sent at time T=0. If there is no loss, we would
expect to receive an ACK and move the window forward exactly one RTT later, or at
time T = 300 ms.
The next three segments after the lost segment are sent 10 ms apart, at T = 10 ms, T =
20 ms, T = 30 ms.
If the segment is lost, we will receive our third duplicate ACK at time T = 330 ms (1
RTT after the third packet is sent at time T = 30).
We will then immediately retransmit the lost segment and receive an ACK for it 1 RTT
later, at time T = 630 ms. Therefore, we lose 630 ms − 300 ms = 330 ms compared with
lossless transmission.
(b) Assuming a timeout of 400ms is set at the time the lost segment is originally transmitted,
how much total time does the sender save by using fast retransmit, compared with
waiting for the timeout to expire before retransmitting the segment (i.e. how much
sooner is it able to slide the window forward than in the case where it waits for the
timeout to occur)? (10pts)
In this case, the lost segment will be retransmitted when the timeout expires at T = 400 ms.
The acknowledgment will be received 1 RTT later, at time T = 700. Therefore, fast retransmit
lets the sender receive the ACK 700 ms − 630 ms = 70 ms sooner than waiting for the timeout
to expire.
4. Consider that only a single TCP (Reno) connection uses one 100Mbps link, which does not
buffer any data. Suppose that this link is the only congested link between the sending and
receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and
the receiver’s receive buffer is much larger than the congestion window. We also make the
following assumptions: each TCP segment size is 1460 bytes; the roundtrip propagation delay
of this connection is 50msec; and this TCP connection is always in congestion avoidance phase
(i.e. ignore slow start).
(a) What is the maximum window size (in segments) that this TCP connection can achieve
(round to the nearest whole segment if needed)? (10pts)
Wmax × 1460 × 8
100 Mbps =
0.050 sec
5 Mbits = Wmax × 11680 bits
4
5 × 106 bits
= Wmax
11680 bits
Wmax = 428.08 ≈ 428
(b) What is the average window size (in segments) and average throughput (in Mbps) of
this TCP connection? (15pts)
Since we ignore slow start, the average window size is repeatedly increasing linearly from
Wmax
Wmax +Wmax
2 up to Wmax . Therefore the average window size is: 2
2 = 0.75Wmax =
0.75 × 428 = 321 segments.
The average throughput is 0.75 × 100 Mbps = 75 Mbps.
Alternatively, we could calculate this as 321 segments×1460 bytes/segment×8
0.05 sec
bits/byte
= 74.9856 Mbps ≈
75 Mbps (rounding to whole segments gives us a slightly lower throughput here)
5. (Bonus) Recall that parallel HTTP connections are often used to improve load performance
for webpages.
(a) Given what we’ve learned about TCP, why are parallel connections not an ideal solution
to HTTP performance problems (from a network perspective)? (5pts)
Because TCP congestion control attempts to enforce per-connection fairness, an appli-
cation that opens up multiple parallel connections can get a larger bandwidth share than
an application that only uses a single connection.
(b) Why are parallel HTTP connections commonly used anyway? (Recall our discussion
from Chapter 2, and be as specific as you can) (5pts)
The introduction of request pipelining in HTTP/1.1 attempted to reduce incentives to
open up parallel connections by allowing multiple requests to be sent over a single connec-
tion without waiting for responses. However, this approach still suffers from Head-of-line
blocking. Because requests are processed in order, small objects can get stuck “waiting
in line” for a larger object to be transmitted, resulting in poor perceived page load time.
By requesting objects on separate parallel connections instead, the HOL blocking issue
is eliminated: small objects requested on separate connections can be received and ren-
dered without waiting for a large object that is being retrieved in parallel. Note that
HTTP/2.0 interleaved object transmission tries to fix this problem.
Partial credit for contrasting with non-pipelined HTTP and explaining how paralleliza-
tion can improve response time by allowing propagation delays for requesting/retrieving
different objects to overlap with each other.