ECE 610: Homework 4 Problems are taken from Kurose and Ross. Problem 1: Host A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 248. Suppose Host A then sends two segments to Host B back-to-back. The first and second segments contain 40 and 60 bytes of data, respectively. In the first segment, the sequence number is 249, the source port number is 503, and the destination port number is 80. Host B sends an acknowledgement whenever it receives a segment from Host A. a) In the second segment sent from Host A to B, what are the sequence number, source port number, and destination port number? b) If the first segment arrives before the second segment, in the acknowledgement of the first arriving segment, what is the acknowledgment number, the source port number, and the destination port number? c) If the second segment arrives before the first segment, in the acknowledgement of the first arriving segment, what is the acknowledgment number? d) Suppose the two segments sent by A arrive in order at B. The first acknowledgement is lost and the second acknowledgement arrives after the first timeout interval. Draw a timing diagram, showing these segments and all other segments and acknowledgements sent. (Assume there is no additional packet loss.) For each segment in your figure, provide the sequence number and the number of bytes of data; for each acknowledgement that you add, provide the acknowledgement number. Problem 2: Consider the following plot of TCP window size as a function of time. Assuming TCP Reno is the protocol experiencing the behavior shown below, answer the following questions. In all cases, you should provide a short discussion justifying your answer. a) Identify the intervals of time when TCP slow start is operating. b) Identify the intervals of time when TCP congestion avoidance is operating. c) After the 16th transmission round, is segment loss detected by a triple duplicate ACK or by a timeout? d) After the 22nd transmission round, is segment loss detected by a triple duplicate ACK or by a timeout? e) What is the initial value of Threshold at the first transmission round? f) What is the value of Threshold at the 18th transmission round? g) What is the value of Threshold at the 24th transmission round? h) During what transmission round is the 70th segment sent? i) Assuming a packet loss is detected after the 26th round by the receipt o a triple duplicate ACK, what will be the values of the congestion window size and of the threshold? 1
Problem 3: Let s consider the question of fairness in TCP with the following model (see figure below). Let's consider the simple case of two TCP connections sharing a single link with transmission rate R. Assume that the two connections have the same MSS and RTT (so that if they have the same congestion window size then they have the same throughput), that they have a large amount of data to send and that no other TCP connections or UDP datagrams traverse this shared link. Also, ignore the slow-start phase of TCP and assume the TCP connections are operating in Congestion Avoidance mode (AIMD) at all times. Figure 3.55 plots the throughput realized by the two TCP connections. If TCP is to share the link bandwidth equally between the two connections, then the realized throughput should fall along the 45-degree arrow (equal bandwidth share) emanating from the origin. Ideally, the sum of the two throughputs should equal R. (Certainly, each connection receiving an equal, but zero, share of the link capacity is not a desirable situation!) So the 2
goal should be to have the achieved throughputs fall somewhere near the intersection of the equal bandwidth share line and the full bandwidth utilization line in Figure 3.55. Suppose that the TCP window sizes are such that at a given point in time, connections 1 and 2 realize throughputs indicated by point A in Figure 3.55. Because the amount of link bandwidth jointly consumed by the two connections is less than R, no loss will occur, and both connections will increase their window by 1 MSS per RTT as a result of TCP's congestion-avoidance algorithm. Thus, the joint throughput of the two connections proceeds along a 45-degree line (equal increase for both connections) starting from point A. Eventually, the link bandwidth jointly consumed by the two connections will be greater than R, and eventually packet loss will occur. Suppose that connections 1 and 2 experience packet loss when they realize throughputs indicated by point B. Connections 1 and 2 then decrease their windows by a factor of two. The resulting throughputs realized are thus at point C, halfway along a vector starting at B and ending at the origin. Because the joint bandwidth use is less than R at point C, the two connections again increase their throughputs along a 45-degree line starting from C. Eventually, loss will again occur, for example, at point D, and the two connections again decrease their window sizes by a factor of two, and so on. You should convince yourself that the bandwidth realized by the two connections eventually fluctuates along the equal bandwidth share line. You should also convince yourself that the two connections will converge to this behaviour regardless of where they are in the two-dimensional space! Figure 3.55 Throughput realized by TCP connections 1 and 2 Although a number of idealized assumptions lie behind this scenario, it still provides an intuitive feel for why TCP results in an equal sharing of bandwidth among connections. 3
In our idealized scenario, we assumed that only TCP connections traverse the bottleneck link, that the connections have the same RTT value, and that only a single TCP connection is associated with a host-destination pair. In practice, these conditions are typically not met, and client/server applications can thus obtain very unequal portions of link bandwidth. Refer to Figure 3.55, which illustrates the convergence of TCP's AIMD algorithm. Suppose that instead of a multiplicative decrease, TCP decreased the window size by a constant amount. Would the resulting AIAD algorithm converge to an equal share algorithm? Justify your answer using a diagram similar to Figure 3.55 Problem 4: Host A is sending an enormous file to Host B over a TCP connection. Over this connection there is never any packet loss and the timers never expire. Denote the transmission rate of the link connecting Host A to the Internet by R bps. Suppose that the process in Host A is capable of sending data into its TCP socket at a rate S bps, where S = 10R. Further suppose that the TCP receive buffer is large enough to hold the entire file, and the send buffer can hold only one percent of the file. What would prevent the process in Host A from continuously passing data to its TCP socket at rate S bps? TCP flow control? TCP congestion control? Or something else? Elaborate. Problem 5: Consider sending a large file from a host to another over a TCP connection that has no loss. a) Suppose TCP uses AIMD for its congestion control without slow start. Assuming CongWin increases by 1 MSS every time a batch of ACKs is received and assuming approximately constant round-trip times, how long does it take for CongWin to increase from 1 MSS to 6 MSS (assuming no loss events)? b) What is the average throughout (in terms of MSS and RTT) for this connection up through time = 5 RTT? Problem 6: Given the saw-toothed behavior of TCP, it's natural to consider what the average throughput (that is, the average rate) of a long-lived TCP connection might be. In this analysis we'll ignore the slow-start phases that occur after timeout events. (These phases are typically very short, since the sender grows out of the phase exponentially fast.) During a particular round-trip interval, the rate at which TCP sends data is a function of the congestion window and the current RTT. a) When the window size is w bytes and the current round-trip time is RTT seconds, then what is roughly the TCP's transmission rate? b) TCP then probes for additional bandwidth by increasing w by 1 MSS each RTT until a loss event occurs. Denote by W the value of w when a loss event occurs. Assuming that RTT and W are approximately constant over the duration of the connection, the TCP transmission rate ranges from W/(2. RTT) to W/RTT. These assumptions lead to a 4
highly simplified macroscopic model for the steady-state behavior of TCP. The network drops a packet from the connection when the rate increases to W/RTT, the rate is then cut in half and then increases by MSS/RTT every RTT until it again reaches W/RTT. This process repeats itself over and over again. Noting that the TCP's throughput (that is, rate) increases linearly between the two extreme values, give a formula for the average throughput of a connection. c) Recall the macroscopic description of TCP throughput. In the period of time from when the connection's rate varies from W/(2. RTT) to W/RTT, only one segment is lost (at the very end of the period). Show that the loss rate (fraction of packets lost) is equal to d) Use the result above to show that if a connection has loss rate L, then its average rate is approximately given by Problem 7: In our discussion of TCP congestion control, we implicitly assumed that the TCP sender always had data to send. Consider now the case that the TCP sender sends a large amount of data and then goes idle (since it has no more data to send) at t1. TCP remains idle for a relatively long period of time and then wants to send more data at t2. What are the advantages and disadvantages of having TCP use the Congestion Window and Threshold values from t1 when starting to send data at t2? What alternative would you recommend? Why? 5