Solution To The Exercises of Lecture 8
Solution To The Exercises of Lecture 8
Question 1: Consider the state of a sliding window at the sending side of a TCP connection as shown in Fig. 1. Each number
Advertised window
1 2 3 4 5 6 7 8 9 10 11
Usable
window
Fig. 1
corresponds to one segment. The MSS is 536 bytes. Assume an ISN of 1 (used by the SYN segment).
1. Explain the difference between the advertised window and the usable window.
Advertised window is the size of the window advertised by the receiver.
Usable window is the window computed by the sender to determine how many bytes it can send.
2. Start with the state shown in Fig. 1. How many bytes can be transmitted in the shown state?
3 x 536 = 1608 bytes
What are the sequence numbers of the segments that can be transmitted?
3218, 3754, 4290 (given the sequence number of the first data segment is 2 and with an MSS of
536, we can figure out the sequence numbers of segments 7, 8, 9).
3. Start with the state shown in Fig. 1. Show how the advertised and usable windows change when the sender trans-
mits 2 segments.
Advertised window remains the same.
Usable window becomes just 1 segment (9).
4. Start with the state shown in Fig. 1. Show how the advertised and usable windows change when a segment with
(AckNo =2682, Window size = 2680) is received.
Advertised window moves two to the right - to extend from 6 to 10 (1680/536=5). Since the ackno
is 2682, it means upto segment 5 is acknowledged.
Usable window includes 7, 8, 9, 10.
5. Start with the state shown in Fig. 1. Show how the advertised and usable windows change when a segment with
(AckNo=1074, Window size =2680) is received.
Advertised window shrinks by two to become 3-4-5-6-7 since the advertised window size is only 5
segments now.
Usable window shrinks to segment 7 since up to 6 has already been transmitted.
Question 2: Assume that we have a TCP connection between A and B. Assume that A has the following initial values:
Congestion window: cwnd = 504 bytes (MSS = 504 bytes)
Slow-start threshold: ssthresh = 2520 bytes.
Advertised window stays the same at 5000 bytes throughout this data exchange (meaning on every ack, a
window size of 5000 is indicated).
Assume that the following events occur at A:
Time t=0: A sends 1 segment to B
Time t=1: A receives an ACK for 1 segment
Time t=2: A sends 1 segment to B
Time t=3: A receives an ACK for 1 segment
Time t=4: A sends 2 segments to B
Time t=5: A receives an ACK for both segments
Time t=6: A sends 2 segments to B
Time t=7: A receives an ACK for both segments
Time t=8: A sends 2 segments to B
Time t=9: A receives an ACK for 1 segment
Time t=10: A receives an ACK for the second segment
At each time, what is the size of cwnd and ssthresh? Use the information in Sections 20.6, 21.6 and 21.8 (include the error term
implemented, i.e., the segsize/8 term).
0 504 2520
1 1008 2520
2 1008 2520
3 1512 2520
4 1512 2520
5 2016 2520
6 2016 2520
7 2520 2520
8 2520 2520
9 3024 2520
10 3171 2520
Question 3: Consider an interactive TCP data exchange in which a total of 5 data bytes needs to be sent from the client to the
server, with one byte being generated by the application (and passed to the TCP layer) every 100 ms. The server does not have
any data to send to the client. Assume the following:
• All data bytes in the TCP buffer are included every time a TCP segment is sent.
• The advertised window size is larger than 5 bytes.
• The delayed ACK timer is 200ms.
• The total delay for a TCP segment sent from one end to reach the other is 5 ms.
• There is no queueing delay for the processing of TCP segments at either end.
• Use a 20-byte TCP header for each segment and a 20-byte IP header.
Compare the TCP/IP percentage overhead in the data sent from the client to the server in this TCP data exchange if Nagle’s
algorithm is enabled with one in which it is disabled. Overhead is expressed in the number of TCP/IP header bytes divided by
the total number of bytes sent expressed as a percentage.
Nagle’s algorithm disabled: each segment sent has only one byte. Percentage overhead is
40
------ × 100 = 97.6 %.
41
Nagle’s algorithm enabled: first segment has one byte. The second segment will have two bytes.
The third segment will have two bytes. Therefore the percentage overhead is
( 40 + 40 + 40 )
----------------------------------- × 100 = 96 %.
( 41 + 42 + 42 )
Time
client server
Application 0 1 byte segment
writes 1 byte assume system was rebooted here
5 ms (all timers start at this point)
200ms (delayed ACK timer expires)
5 ms
205 2 byte segment
210
Question 4: Assume that we have a TCP connection between A and B. Assume that A has the following initial values:
Congestion window: cwnd = 536 bytes (MSS = 536 bytes)
Slow-start threshold: ssthresh = 7 × 536 = 3752 bytes.
Assume that the following events occur at A:
Time t=0: A sends 1 segment to B
Time t=1: A receives an ACK for 1 segment
Time t=2: A sends 1 segment to B
Time t=3: A receives an ACK for 1 segment
Time t=4: A sends 2 segments to B
Time t=5: A receives an ACK for 2 segments
Time t=6: A sends 2 segments to B
Time t=7: A receives an ACK for 2 segments
Time t=8: A sends 2 segments to B
Time t=9: A receives an ACK for 2 segments
At each time, what is the size of cwnd and ssthresh? Use the information in Sections 20.6, 21.6 and 21.8 (include the error term
implemented, i.e., the segsize/8 term).
0 536 3752
1 1072 3752
2 1072 3752
3 1608 3752
4 1608 3752
5 2144 3752
6 2144 3752
7 2680 3752
8 2680 3752
time cwnd ssthresh
9 3216 3752