复习题

R1

R1. Suppose the network layer provides the following service. The network layer in the source host accepts a segment of maximum size 1,200 bytes and a destination host address from the transport layer. The network layer then guarantees to deliver the segment to the transport layer at the destination host. Suppose many network application processes can be running at the destination host.
a. Design the simplest possible transport-layer protocol that will get application data to the desired process at the destination host. Assume the operating system in the destination host has assigned a 4-byte port number to each running application process.
b. Modify this protocol so that it provides a “return address” to the destination process.
c. In your protocols, does the transport layer “have to do anything” in the core of the computer network?
R1. 假定网络层提供了下列服务。在源主机中的网络层接受最大长度1200字节和来自运输层的目的主机地址的报文段。网络层则保证将该报文段交付给位于目的主机的运输层。假定在目的主机上能够运行许多网络应用进程。
a. 设计可能最简单的运输层协议,该协议将使应用程序数据到达位于目的主机的所希望的进程。假设在目的主机中的操作系统已经为每个运行的应用进程分配了一个4字节的端口号
b. 修改这个协议,使它向目的进程提供一个的“返回地址”。
c. 在你的协议中,该运输层在计算机网络的核心中“必须做任何事”吗?

a. 运输层报文只需要包含目的端口号与数据部分。端口4字节,数据1196字节。
b. 运输层报文需要包含源端口号,目的端口号与数据部分。源端口号4字节,目的端口号4字节,数据1192字节。
c. 运输层在网络核心中不需要做任何事。

R4

R4. Describe why an application developer might choose to run an application over UDP rather than TCP.
R4. 描述应用程序开发者为什么可能选择在UDP上运行应用程序而不是在TCP上运行的原因。

  1. 要求一定发送速率,不想被TCP的拥塞控制所束缚。
  2. 当应用程序通过UDP运行时,专用于特定应用程序的服务器可以支持更多活动的客户端。
  3. 即使通过TCP进行数据传输是可靠的,但某些应用程序也不需要可靠的TCP数据传输。 它允许少部分报文丢失。

R8

R8. Suppose that a Web server runs in Host C on port 80. Suppose this Web server uses persistent connections, and is currently receiving requests from two different Hosts, A and B. Are all of the requests being sent through the same socket at Host C? If they are being passed through different sockets, do both of the sockets have port 80? Discuss and explain.
R8.假定在主机C端口80上运行的一个Web服务器。假定这个Web服务器使用持续连接,并且正在接收来自两台不同主机A和B的请求。被发送的所有请求都通过位于主机C的相同套接字吗?如果它们通过不同的套接字传递,这两个套接字都具有端口80吗?讨论和解释之。

Web服务使用TCP,TCP的套接字是由源IP和端口号,目的IP和端口号共同确定的。因此他们通过不同的套接字传递。套接字都具有端口80。

R12

R12. Visit the Go-Back-N interactive animation at the companion Web site.
a. Have the source send five packets, and then pause the animation before any of the five packets reach the destination. Then kill the first packet and resume the animation. Describe what happens.
b. Repeat the experiment, but now let the first packet reach the destination and kill the first acknowledgment. Describe again what happens.
c. Finally, try sending six packets. What happens?
R12.在配套网站上使用Go-Back-N interactive animation(回退N步)Java小程序。
a.让源发送5个分组,在这5个分组的任何一个到达目的地之前暂停该动画。然后毁掉第一个分组并继续该动画。试描述发生的情况。
b.重复该实验,只是现在让第一个分组到达目的地并毁掉第一个确认。再次描述发生的情况
C.最后,尝试发送6个分组。发生了什么情况?

a. 第一个分组丢失后,接收方不会缓存任何失序到达的正确分组,因为之前没有正确接收过任何分组,所以不会回传上一个正确接收分组的 ACK (因为没有)。如果之前有正确接收过分组,那么会给每个失序到达的正确报文回传一个 ACK,ACK 的编号是之前正确接收过的分组的编号,接收方同样不缓存任何失序分组。发送方没有接收到对应 ACK 的确认,因此会产生超时事件,重发滑动窗口中所有已发送但未确认的分组。
b. 对第一个分组的确认报文丢失不会引起任何重传,因为每个确认报文携带的序号会更新发送方的最早发送未确认序号,因此,当剩余 4 个确认报文被发送方接收到后,发送方的最早发送未确认序号被更新为 5,此时,滑动窗口中没有任何已发送但未确认的报文等待重传。
c. 发不了,因为滑动窗口的长度是 5,一次只能发 5 个,等到滑动窗口中的 5 个分组都被接收方确认后才能发送第 6 个分组。

R13

R13. Repeat R12, but now with the Selective Repeat interactive animation. How are Selective Repeat and Go-Back-N different?
R13. 重复复习题R12, 但是现在使用 Selective Repeat interative animation(选择重传)Java小程序。选择重传和回退N步有什么不同?

a. 第一个分组丢失后,剩下的分组都被接收方接收到,并逐一缓存,并且给发送方回传 4 个确认报文,每个都携带有被接收方缓存的分组的序号。发送方接收到这些确认分组后,滑动窗口不会移动,但因为发送方知道,失序但正确到达的分组都已经被缓存,所以当发送方的超时事件发生时,发送方仅仅会重传第一个丢失的分组。
b. 第一个分组的确认报文丢失后,此时,接收方因为五个分组都正常接收,所以接收方的滑动窗口向前移动,但是由于发送方并不知道它到底是发送的第一个分组在被接收方接收前丢失,还是接收方正常接收到了该分组,但是回传的确认报文丢失,所以发送方的滑动窗口不会移动,它仍然会等待超时事件发生,然后重传滑动窗口内未被确认的第一个分组。
c. 发不了,因为滑动窗口的限制。

R14

R14. True or false?
a. Host A is sending Host B a large file over a TCP connection. Assume Host B has no data to send Host A. Host B will not send acknowledgments to Host A because Host B cannot piggyback the acknowledgments on data.
b. The size of the TCP rwnd never changes throughout the duration of the connection.
c. Suppose Host A is sending Host B a large file over a TCP connection. The number of unacknowledged bytes that A sends cannot exceed the size of the receive buffer.
d. Suppose Host A is sending a large file to Host B over a TCP connection. If the sequence number for a segment of this connection is m, then the sequence number for the subsequent segment will necessarily be m + 1.
e. The TCP segment has a field in its header for rwnd.
f. Suppose that the last SampleRTT in a TCP connection is equal to 1 sec. The current value of TimeoutInterval for the connection will necessarily be Ú 1 sec.
g. Suppose Host A sends one segment with sequence number 38 and 4 bytes of data over a TCP connection to Host B. In this same segment, the acknowledgment number is necessarily 42.
R14.是非判断题:
a. 主机A经过一条TCP连接向主机B发送一个大文件。假设主机B没有数据发往主机A。因为主机B不能随数据捎带确认,所以主机B将不向主机A发送确认。
b. 在连接的整个过程中,TCP的 rwnd 的长度决不会变化。
c. 假设主机A通过一条TCP连接向主机B发送一个大文件。主机A发送但未被确认的字节数不会超过接收缓存的大小。
d. 假设主机A通过一条TCP连接向主机B发送一个大文件。如果对于这条连接的一个报文段的序号为m,则对于后继报文段的序号将必然是m+1.
e. TCP报文段在它的首部中有一个 rwnd 字段。
f. 假定在一条TCP连接中最后的 SampleRTT 等于1秒,那么对于该连接的 TimeoutInterval 的当前值必定大于等于1秒。
g. 假设主机A通过一条TCP连接向主机B发送一个序号为38的4个字节的报文段。在这个相同的报文段中,确认号必定是42。

a. 错 主机 B 会对主机 A 发送的每个分组单独发送一个确认报文,并在确认报文段的确认号域填写期望接收的下一字节序号。
b. 错 rwnd 会一直变化,rwnd 的值从接收方回传给发送方,用来进行流量控制。
c. 对 但更为准确的描述应该是,主机 A 发送但未被确认的字节数不会超过 B 接收窗口 rwnd 的大小,(rwnd = 接收缓存 - [LastByteRead - LastByteRecv])
d. 错
对于握手报文段,的确是 m + 1 ,但是对于携带数据的报文段,下一个序号是前一个报文段携带数据的首字节序号加上数据的长度。
e. 对,就是接收窗口字段
f. 错 该连接当前的 TimeoutInterval 是由上一次的 SampleRTT 和 DevRTT 计算出来的,或者是超时重传加倍出来的,和这次的 SmapleRTT = 1 无关。
g. 错 同一报文中的确认号与该报文的初始序号和字节数无关,确认号是期待接收到接收端的下一个字节的序号。

R15

R15. Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; the second has sequence number 110.
a. How much data is in the first segment?
b. Suppose that the first segment is lost but the second segment arrives at B. In the acknowledgment that Host B sends to Host A, what will be the acknowledgment number?
R15.假设主机A通过一条TCP连接向主机B发送两个紧接着的TCP报文段。第一个报文段的序号为90, 第二个报文段序号为110。
a. 第一个报文段中有多少数据?
b. 假设第一个报文段丢失而第二个报文段到达主机B。那么在主机B发往主机A的确认报文中,确认号应该是多少?

a. 第一个报文段中有 119 - 90 + 1 = 20 字节的序号
b. TCP 是累积确认的,因此假如第一个报文段丢失,而第二个报文段到达主机 B,那么主机 B 发往主机 A 的确认报文中,确认号是 90。

R17

R17. Suppose two TCP connections are present over some bottleneck link of rate R bps. Both connections have a huge file to send (in the same direction over the bottleneck link). The transmissions of the files start at the same time. What transmission rate would TCP like to give to each of the connections?
R17. 假设两条 TCP 连接存在于一个带宽为R bps的瓶颈链路上。它们都要发送一个很大的文件(以相同方向经过瓶颈链路),并且两者是同时开始发送文件。那么TCP将为每条连接分配什么样的传输速率?

两个都是R/2左右的速率

R19

R19. In the discussion of TCP splitting in the sidebar in Section 3.7, it was claimed that the response time with TCP splitting is approximately 03 运输层 - 图1. Justify this claim.
R19. 在3.7节的“TCP分岔”讨论中,对于TCP分岔的响应时间,断言大约是03 运输层 - 图2。评价该断言。

03 运输层 - 图3 是客户与前端服务器连接通信所需的时间。 在前端服务器收到请求时,会与远端服务器通信,由于TCP连接是持续的,没有建立连接的时间,因此所花时间为03 运输层 - 图4。 再加上中间服务器处理的事件。

习题

P1

P1. Suppose Client A initiates a Telnet session with Server S. At about the same time, Client B also initiates a Telnet session with Server S. Provide possible source and destination port numbers for
a. The segments sent from A to S.
b. The segments sent from B to S.
c. The segments sent from S to A.
d. The segments sent from S to B.
e. If A and B are different hosts, is it possible that the source port number in the segments from A to S is the same as that from B to S?
f. How about if they are the same host?
P1. 假设客户A向服务器S发起一个 Telnet会话。与此同时,客户B也向服务器S发起一个 Telnet会话。给出下面报文段的源端口号和目的端口号
a.从A向S发送的报文段。
b.从B向S发送的报文段。
c.从S向A发送的报文段。
d.从S向B发送的报文段。
e.如果A和B是不同的主机,那么从A向S发送的报文段的源端口号是否可能与从B向S发送的报文段的源端口号相同?
f.如果它们是同一台主机,情况会怎么样?

a. 从 A 向 S 发送的报文段:(a, 23)
b. 从 B 向 S 发送的报文段:(b, 23)
c. 从 S 向 A 发送的报文段:(23, a)
d. 从 S 向 B 发送的报文段:(23, b)
e. A, B 是不同主机的话, 那么 a 有可能等于 b,但是因为 TCP 套接字是根据四元组来标识的 (dst_ip, dst_port, src_ip, src_port),而我们知道,主机 A 和 主机 B 的 IP 地址不会相同,因此相同端口号的报文段到达主机 S 仍然能被定位到不同的套接字中。
f. 如果它们是同一台主机,那么源端口号不可能相同。

P6

P6. Consider our motivation for correcting protocol rdt2.1. Show that the receiver, shown in Figure 3.60, when operating with the sender shown in Figure 3.11, can lead the sender and receiver to enter into a deadlock state, where each is waiting for an event that will never occur.
P6.考虑我们改正协议rd2.1的动机。试说明如图3-57所示的接收方与如图3-11所示的发送方运行时,接收方可能会引起发送方和接收方进入死锁状态,即双方都在等待不可能发生的事件。
image.png

image.png

假设发送方发来分组 0,接收方正确接收到该分组 0,并给发送方回传 ACK 作为确认,但该 ACK 抵达发送方前损坏,于是发送方重传分组 0,当接收方正确接收到该分组 0 时,接收方处于 wait 1 状态,于是给发送方回传 NAK。此时进入死锁,无论发送方是否正确接收到该 NAK,都会重传分组 0,无论接收方是否正确接收该分组 0,都会回传 NAK。产生死锁。

P14

P14. Consider a reliable data transfer protocol that uses only negative acknowledgments. Suppose the sender sends data only infrequently. Would a NAK-only protocol be preferable to a protocol that uses ACKs? Why? Now suppose the sender has a lot of data to send and the end-to-end connection experiences few losses. In this second case, would a NAK-only protocol be preferable to a protocol that uses ACKs? Why?
P14. 考虑一种仅使用否定确认的可靠数据传输协议。假定发送方只是偶尔发送数据。只用NAK的协议是否会比使用ACK的协议更好?为什么?现在我们假设发送方要发送大量的数据,并且该端到端连接很少丢包。在第二种情况下,只用NAK的协议是否会比使用ACK的协议更好?为什么?

  1. 不合适。因为发送端如果接收不到数据,无法判定是丢包还是正确接收了。
  2. 如果发送方要发送大量数据,并且很少丢包,那么仅使用 NAK 的协议更好,因为分组 x 的丢失能很快被恢复(因为发送方发包很频繁),并且减少了大量 ACK 的确认,而 NAK 只占很少的一部分(题目假设端到端很少丢包)

P18

P18. In the generic SR protocol that we studied in Section 3.4.4, the sender transmits a message as soon as it is available (if it is in the window) without waiting for an acknowledgment. Suppose now that we want an SR protocol that sends messages two at a time. That is, the sender will send a pair of messages and will send the next pair of messages only when it knows that both messages in the first pair have been received correctly.
Suppose that the channel may lose messages but will not corrupt or reorder messages. Design an error-control protocol for the unidirectional reliable transfer of messages. Give an FSM description of the sender and receiver. Describe the format of the packets sent between sender and receiver, and vice versa. If you use any procedure calls other than those in Section 3.4 (for example, udt_send(), start_timer(), rdt_rcv() , and so on), clearly state their actions. Give an example (a timeline trace of sender and receiver) showing how your protocol recovers from a lost packet.
P18.在3.4.4节我们学习的一般性SR协议中,只要报文可用(如果报文在窗口中),发送方就会不等待确认而传输报文。假设现在我们要求一个 SR 协议,一次发出一对报文,而且只有在知道第一对报文中的两个报文都正确到达后才发送第二对报文。
假设该信道中可能会丢失报文,但报文不会发生损坏和失序。试为报文的单向可靠传输而设计一个差错控制协议。画出发送方和接收方的FSM描述。描述在发送方和接收方之间两个方向发送的报文格式。如果你使用了不同于3.4节(例如 udt_send(), start_timer(), rdt_rcv()等)中的任何其他过程调用,详细地阐述这些动作。举例说明(用发送方和接收方的时序踪迹图)你的协议是如何恢复报文丢失的。

不会

在我们的解决方案中,发送方将等待接收到一对消息(seqnum和seqnum + 1)的ACK,然后再继续处理下一对消息。 数据包具有一个数据字段,并携带一个两位的序列号。 也就是说,有效的序号是0、1、2和3。(注意:您应该考虑为什么1位序号空间0、1仅在下面的解决方案中不起作用。)ACK消息携带他们正在确认的数据包的序列号。

发送方和接收方的FSM如图所示。请注意,发送方状态记录(i)当前对没有接收到ACK,(ii)已接收到seqnum(仅)的ACK,或接收到用于 seqnum + 1 的ACK (仅)。 在此图中,我们假设seqnum最初为0,并且发送方已发送了前两个数据消息(以使事情顺利进行)。 发送者和接收方从丢失的数据包中恢复的时序踪迹图如下所示: image.png

image.png

P22

P22. Consider the GBN protocol with a sender window size of 4 and a sequence number range of 1,024. Suppose that at time t, the next in-order packet that the receiver is expecting has a sequence number of k. Assume that the medium does not reorder messages. Answer the following questions:
a. What are the possible sets of sequence numbers inside the sender’s window at time t? Justify your answer.
b. What are all possible values of the ACK field in all possible messages currently propagating back to the sender at time t? Justify your answer.
P22. 考虑一个GBN 协议,其发送方窗口为4,序号范围为1024。假设在时刻t,接收方期待的下一个有序分组的序号是k。假设媒体不会对报文重新排序。回答以下问题
a. 在 t 时刻,发送方窗口内的报文序号可能是多少?论证你的回答。
b. 在 t 时刻,在当前传播回发送方的所有可能报文中,ACK字段的所有可能值是多少?论证你的回答。

a. k-4, k-3, k-2, k-1, k, k+1, k+2, k+3
k-4, k-3, k-2, k-1的极端情况:此时发送端发送了k-4, k-3, k-2, k-1的报文,接收方收到,但是ACK报文接收方还没有收到。
k, k+1, k+2, k+3的极端情况:发送方发送了k, k+1, k+2, k+3报文,接收方还没有收到。
b. k-5, k-4, k-3, k-2, k-1
k-4, k-3, k-2, k-1, k的极端情况:发送方发送k-5,接收方收到并且返回ACK(k-5)。发送方收到之前就超时,重发k-5。 发送方收到ACK(k-5), 发送k-4, k-3, k-2, k-1。接收方收到重发k-5,返回ACK(k-5)。收到k-4, k-3, k-2, k-1,返回ACK(k-4),ACK(k-3),ACK(k-2),ACK(k-1)

P27

P27. Host A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Suppose Host A then sends two segments to Host B back-to-back. The first and second PROBLEMS 293 segments contain 80 and 40 bytes of data, respectively. In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80. Host B sends an acknowledgment 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 acknowledgment 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 acknowledgment 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 acknowledgment is lost and the second acknowledgment arrives after the first timeout interval. Draw a timing diagram, showing these segments and all other segments and acknowledgments 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 acknowledgment that you add, provide the acknowledgment number.
P27.主机A和B经一条TCP连接通信,并且主机B已经收到了来自A的最长为126字节的所有字节。假定主机A随后向主机B发送两个紧接着的报文段。第一个和第二个报文段分别包含了80字节和40字节的数据。在第一个报文段中,序号是127,源端口号是302,目的地端口号是80。无论何时主机B接收到来自主机A的报文段,它都会发送确认。
a.在从主机A发往B的第二个报文段中,序号、源端口号和目的端口号各是什么?
b.如果第一个报文段在第二个报文段之前到达,在第一个到达报文段的确认中,确认号、源端口号和目的端口号各是什么?
c.如果第二个报文段在第一个报文段之前到达,在第一个到达报文段的确认中,确认号是什么?
d.假定由A发送的两个报文段按序到达B。第一个确认丢失了而第二个确认在第一个超时间隔之后到达。画出时序图,显示这些报文段和发送的所有其他报文段和确认。(假设没有其他分组丢失。)对于图上每个报文段,标出序号和数据的字节数量;对于你增加的每个应答,标出确认号。

a. 序号 207 源端口号 302 目的端口号 80
b. 确认号 207 源端口号 80 目的端口号 302
c. 确认号 127,表示它仍在等待字节127及以后

d. 03 运输层 - 图9

P31

P31. Suppose that the five measured SampleRTT values (see Section 3.5.3) are 106 ms, 120 ms, 140 ms, 90 ms, and 115 ms. Compute the EstimatedRTT after each of these SampleRTT values is obtained, using a value of α = 0.125 and assuming that the value of EstimatedRTT was 100 ms just before the first of these five samples were obtained. Compute also the DevRTT after each sample is obtained, assuming a value of β = 0.25 and assuming the value of DevRTT was 5 ms just before the first of these five samples was obtained. Last, compute the TCP TimeoutInterval after each of these samples is obtained.
P31.假设测量的5个 SampleRTT 值(参见3.5.3节)是106ms、120ms、140ms、90ms和115ms。在获得了每个 SampleRTT 值后计算 EstimatedRTT, 使用 α = 0.125 并且假设在刚获得前5个样本之后 EstimatedRTT 的值为100 ms。在获得每个样本之后,也计算 DevRTT,假设B=0.25,并且假设在刚获得前5个样本之后 DevRTT 的值为5 ms。最后,在获得这些样本之后计算 TCP TimeoutInterval.

03 运输层 - 图10

03 运输层 - 图11

03 运输层 - 图12

03 运输层 - 图13

03 运输层 - 图14

P32

P32. Consider the TCP procedure for estimating RTT. Suppose that α = 0.1. Let 03 运输层 - 图15 be the most recent sample RTT, let 03 运输层 - 图16 be the next most recent sample RTT, and so on.
a. For a given TCP connection, suppose four acknowledgments have been returned with corresponding sample RTTs: 03 运输层 - 图17, 03 运输层 - 图18, 03 运输层 - 图19, and 03 运输层 - 图20. Express EstimatedRTT in terms of the four sample RTTs.
b. Generalize your formula for n sample RTTs.
c. For the formula in part (b) let n approach infinity. Comment on why this averaging procedure is called an exponential moving average.
P32.考虑 TCP 估计 RTT 的过程。假设α = 0.1,令 03 运输层 - 图21 设置为最新样本RTT,令 03 运输层 - 图22 设置为下一个最新样本 RTT,等等。
a.对于一个给定的TCP连接,假定4个确认报文相继到达,带有4个对应的RTT值: 03 运输层 - 图23, 03 运输层 - 图24, 03 运输层 - 图25, and 03 运输层 - 图26。根据这4个样本RTT表示 EstimatedRTT.
b.将你得到的公式一般化到 n 个 RTT 样本的情况。
c.对于在(b)中得到的公式,令n趋于无穷。试说明为什么这个平均过程被称为指数移动平均。

a.
03 运输层 - 图27
03 运输层 - 图28
03 运输层 - 图29
03 运输层 - 图30
b.
03 运输层 - 图31
c. 当n趋于无穷时,离n越近的EstimatedRTT的影响越大, 过去样本的权重呈指数衰减。

P37

P37. Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such that five consecutive data segments and their corresponding ACKs can be received (if not lost in the channel) by the receiving host (Host B) and the sending host (Host A) respectively. Suppose Host A sends five data segments to Host B, and the second segment (sent from A) is lost. In the end, all five data segments have been correctly received by Host B.
a. How many segments has Host A sent in total and how many ACKs has Host B sent in total? What are their sequence numbers? Answer this question for all three protocols.
b. If the timeout values for all three protocol are much longer than 5 RTT, then which protocol successfully delivers all five data segments in shortest time interval?
P37.比较GBN、SR和TCP(无延时的ACK)。假设对所有3个协议的超时值足够长,使得5个连续的数据报文段及其对应的ACK能够分别由接收主机(主机B)和发送主机(主机A)收到(如果在信道中无丢失)。假设主机A向主机B发送5个数据报文段,并且第二个报文段(从A发送)丢失。
最后,所有5个数据报文段已经被主机B正确接收。
a.主机A总共发送了多少报文段和主机B总共发送了多少ACK?它们的序号是什么?对所有3个协议回答这个问题。
b.如果对所有3个协议超时值比5RT长得多,则哪个协议在最短的时间间隔中成功地交付所有5个数据报文段?

a.

  • 对于 GBN 协议:发送报文段9次,ACK8次

第二个报文丢失后,接收方丢弃 3,4,5,回传的 ACK 序号分别为 1 1 1 1,第一轮 4 个 ACK。
第二轮发送方重传 2, 3, 4, 5,接收方回传的 ACK 序号分别为 2 3 4 5,第二轮 4 个 ACK。
因此 GBN 协议总共发送9 个报文段, 8 个 ACK

  • 对于 SR 协议:发送报文段6次,ACK5次

第二个报文丢失后,接收方缓存 3, 4, 5,回传的 ACK 序号分别为 1 3 4 5,第一轮 4 个 ACK。
第二轮发送方重传 2,接收方回传的 ACK 为 2,第二轮 1 个 ACK
因此 SR 协议总共发送 6 个报文段,5 个 ACK

  • 对于 TCP 协议:发送报文段6次,ACK5次

第二个报文丢失后,接收方缓存 3,4,5 回传的 ACK 序号分别为 2 2 2 2 (接收方期待接受的分组序号,而不是已经正确接收到的分组序号),第一轮 4 个 ACK。
第二轮发送方在接收到 3 个冗余 ACK 后进入快速重传,因此重传 2 分组,接收方在将缓存的分组和丢失的分组排序后,回传 ACK 6,因此第二轮 1 个 ACK。
因此 TCP 协议总共发送5 个报文段, 5 个 ACK
b. TCP协议时间最短,因为 GBN 和 SR 都在根据超时间隔等待,直到超时间隔流逝后才能确定。但是 TCP 接收到 3 个冗余 ACK 后立刻进入快速重传,因此 TCP 最快。

P40

P40. Consider Figure 3.61. Assuming TCP Reno is the protocol experiencing the behavior shown above, 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 ssthresh at the first transmission round?
f. What is the value of ssthresh at the 18th transmission round?
g. What is the value of ssthresh 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 of a triple duplicate ACK, what will be the values of the congestion window size and of ssthresh?
j. Suppose TCP Tahoe is used (instead of TCP Reno), and assume that triple duplicate ACKs are received at the 16th round. What are the ssthresh and the congestion window size at the 19th round?
k. Again suppose TCP Tahoe is used, and there is a timeout event at 22nd round. How many packets have been sent out from 17th round till 22nd round, inclusive?
P40.考虑图3-58。假设 TCP Reno是一个经历如上所示行为的协议,回答下列问题。在各种情况中,简要地论证你的回答。
a.指出TCP慢启动运行时的时间间隔。
b.指出TCP拥塞避免运行时的时间间隔。
c.在第16个传输轮回之后,报文段的丢失是根据3个冗余ACK还是根据超时检测出来的?
d.在第22个传输轮回之后,报文段的丢失是根据3个冗余ACK还是根据超时检测出来的?
e.在第1个传输轮回里, ssthresh 的初始值设置为多少?
f.在第18个传输轮回里, ssthresh 的值设置为多少?
g.在第24个传输轮回里, ssthresh 的值设置为多少?
h.在哪个传输轮回内发送第70个报文段?
i.假定在第26个传输轮回后,通过收到3个冗余ACK检测出有分组丢失,拥塞的窗口长度和 ssthresh 的值应当是多少?
j.假定使用 TCP Tahoe(而不是 ICP Reno),并假定在第16个传输轮回收到3个冗余ACK。在第19个传输轮回, ssthresh 和拥塞窗口长度是什么?
k.再次假设使用 TCP Tahoe,在第22个传输轮回有一个超时事件。从第17个传输轮回到第22个传输轮回(包括这两个传输轮回),一共发送了多少分组?
image.png
a. TCP 在慢启动阶段 cwnd 按照指数增长,因此 [0, 6]、[23, 26]
b. TCP 拥塞避免时拥塞窗口线性增长,因此 [6, 16]、[17, 22]
c. 在第 16 个传输轮回之后,丢包是根据3个冗余 ACK 检测出来的,如果是超时检测出来的,那么拥塞窗口长度会变为 1
d. 在第 22 个传输轮回之后,丢包是根据超时检测出来的,因为拥塞窗口长度下降为 1
e. 在第 1 个传输轮回中,ssthresh 初始值被设置为 32,因为慢启动阶段在拥塞窗口长度达到 32 时开始进入拥塞避免。
f. 在 18 个传输轮回中,ssthresh 的值被设置为拥塞窗口的一半,此时拥塞窗口为 42,因此 ssthresh 被设置为 21。
g. 在第 24 个传输轮回里,ssthresh 的值被设置为拥塞窗口的一半,当时拥塞窗口为 28,因此 ssthresh 被设置为 14。
h. 在第 7 个传输轮回中发送第 70 个报文。
i. 假定在第 26 个传输轮回后,通过收到 3 个冗余 ACK 检测出有分组丢失,拥塞的窗口长度和 ssthresh 的值应当分别为:03 运输层 - 图33
03 运输层 - 图34
j. TCP Tahoe 没有快速重传,因此接收到 3 个冗余 ACK 的做法也是 ssthresh 变为拥塞窗口的一半,即 21,拥塞窗口变为 1 MSS
k. 假设使用 TCP Tahoe, 在第 22 个传输轮回有一个超时事件。从第 17 个传输轮回到第 22 个传输轮回 (包括这两个传输轮回), 16 轮回冗余 ACK, 因此 17 轮回 1,18 -> 2,19 -> 4,20 -> 8,21 -> 16,22 -> 21,因此总共是 1 + 2 + 4 + 8 + 16 + 21 = 52 个分组。

P50

P50. Consider a simplified TCP’s AIMD algorithm where the congestion window size is measured in number of segments, not in bytes. In additive increase, the congestion window size increases by one segment in each RTT. In multiplicative decrease, the congestion window size decreases by half (if the result is not an integer, round down to the nearest integer). Suppose that two TCP connections, 03 运输层 - 图35 and 03 运输层 - 图36, share a single congested link of speed 30 segments per second. Assume that both 03 运输层 - 图37 and 03 运输层 - 图38 are in the congestion avoidance phase. Connection 03 运输层 - 图39’s RTT is 50 msec and connection 03 运输层 - 图40’s RTT is 100 msec. Assume that when the data rate in the link exceeds the link’s speed, all TCP connections experience data segment loss.
a. If both 03 运输层 - 图41 and 03 运输层 - 图42 at time 03 运输层 - 图43 have a congestion window of 10 segments, what are their congestion window sizes after 1000 msec?
b. In the long run, will these two connections get the same share of the bandwidth of the congested link? Explain.
P50。考虑一种简化的 TCP 的 AIMD 算法,其中拥塞窗口长度用报文段的数量来度量,而不是用字节度量。在加性增中,每个RTT拥塞窗口长度增加一个报文段。在乘性减中,拥塞窗口长度减小一半(如果结果不是一个整数,向下取整到最近的整数)。假设两条TCP连接03 运输层 - 图4403 运输层 - 图45,它们共享一条速率为每秒30个报文段的单一拥塞链路。假设03 运输层 - 图4603 运输层 - 图47均处于拥塞避免阶段。连接03 运输层 - 图48的RTT 是50ms,连接03 运输层 - 图49的RTT是100ms。假设当链路中的数据速率超过了链路的速率时,所有 TCP 连接经受数据报文段丢失。
a. 如果在时刻,03 运输层 - 图5003 运输层 - 图51具有03 运输层 - 图52个报文段的拥塞窗口,在1000ms后它们的拥塞窗口为多长?
b. 经长时间运行,这两条连接将取得共享该拥塞链路的相同的带宽吗?

a. 在t0,03 运输层 - 图53的速率为10/50ms = 200,03 运输层 - 图54的速率为10/100ms = 100,远远超过链路速率,因此他们都要减半。又注意到,假设03 运输层 - 图5503 运输层 - 图56的拥塞窗口为1,他们的速率为20和10,正好与链路速率相等,因此03 运输层 - 图5703 运输层 - 图58会一直减半到1。
b. 不会。从长远来看,03 运输层 - 图59的带宽份额大约是03 运输层 - 图60的两倍,因为03 运输层 - 图61的RTT较短,仅为03 运输层 - 图62的一半,因此03 运输层 - 图63的窗口大小调整速度是03 运输层 - 图64的两倍。在后期03 运输层 - 图65全部都能在每个 RTT 开始领先于03 运输层 - 图66调整滑动窗口

P52

P52. Consider a modification to TCP’s congestion control algorithm. Instead of additive increase, we can use multiplicative increase. A TCP sender increases its window size by a small positive constant 03 运输层 - 图67 (03 运输层 - 图68) whenever it receives a valid ACK. Find the functional relationship between loss rate L and maximum congestion window W. Argue that for this modified TCP, regardless of TCP’s average throughput, a TCP connection always spends the same amount of time to increase its congestion window size from 03 运输层 - 图69 to 03 运输层 - 图70.
P52.考虑修改 TCP 的拥塞控制算法。不使用加性增,使用乘性增。无论何时某 TCP 收到一个合法的ACK,就将其窗口长度增加一个小正数03 运输层 - 图71 (03 运输层 - 图72)。求出丢包率 L 和最大拥塞窗口 W 之间的函数关系。论证:对于这种修正的 TCP ,无论 TCP 的平均吞吐量如何,一条TCP连接将其拥塞窗口长度从 03 运输层 - 图73 增加到 03 运输层 - 图74,总是需要相同的时间。

设 S 为窗口从 W/2 增加到 W 期间发送的总报文段数目,因此有
03 运输层 - 图75
03 运输层 - 图76 得到 03 运输层 - 图77
03 运输层 - 图78
窗口由 W/2 增加到 W 期间所经历的时间 T 为 03 运输层 - 图79
因此该 TCP 的平均吞吐量为 03 运输层 - 图80
拥塞窗口长度从 03 运输层 - 图81 增加到 03 运输层 - 图82与吞吐量无关

P56

P56. In this problem, we consider the delay introduced by the TCP slow-start phase. Consider a client and a Web server directly connected by one link of rate R. Suppose the client wants to retrieve an object whose size is exactly equal to 15 S, where S is the maximum segment size (MSS). Denote the round-trip time between client and server as RTT (assumed to be constant). Ignoring protocol headers, determine the time to retrieve the object (including TCP connection establishment) when
a. 03 运输层 - 图83
b. 03 运输层 - 图84
c. 03 运输层 - 图85
P56. 在这个习题中,我们考虑由 TCP 慢启动阶段引入的时延。考虑一个客户和一个 Web 服务器直接连接到速率 R 的一条链路。假定该客户要取回一个对象,其长度正好等于15 S,其中 S 是最大段长度(MSS)。客户和服务器之间的往返时间表示为 RTT(假设为常数)。忽略协议首部,确定在下列情况下取回该对象的时间(包括TCP连接创建):
a. 03 运输层 - 图86
b. 03 运输层 - 图87
c. 03 运输层 - 图88

a. 03 运输层 - 图89
b. 03 运输层 - 图90
c. 03 运输层 - 图91

image.png