\documentclass[全部作业]{subfiles}
\input{mysubpreamble}
\begin{document}
\chapter{计算机网络概述}
\begin{enumerate}
    \cnitem[3]{Consider an application that transmits data at a steady rate (for example, the
    sender generates an N-bit unit of data every k time units, where k is small and fixed).
    Also, when such an application starts, it will continue running for a relatively long
    period of time. Answer the following questions, briefly justifying your answer:}
    \begin{enumerate}
        \item Would a packet-switched network or a circuit-switched network be more
        appropriate for this application? Why?

        电路交换网络更合适，一方面，该应用以稳定的速率传输数据，因此只需要分配固定的频宽或时隙等即可方便实现电路交换的多路复用，而不需要分组交换；另一方面，该应用开始后会持续运行相当长的一段时间，因此不需要分组交换来应对突发情况，此时使用电路交换，不需要分片，也不需要处理，能达到更高的传输效率。
        \item Suppose that a packet-switched network is used and the only traffic in this network
        comes from such applications as described above. Furthermore, assume that the sum
        of the application data rates is less than the capacities of each and every link. Is some
        form of congestion control needed? Why?

        不需要拥塞控制，注意到“such applications”是复数，说明可能存在多个这样的应用，但由于应用传输速率小于每条连接的传输能力，而拥塞控制是用于在应用传输速率大于连接的传输能力时降低应用传输速率的，所以这时不需要拥塞控制。
    \end{enumerate}
    \cnitem[5]{This elementary problem begins to explore propagation delay and transmission
    delay, two central concepts in data networking. Consider two hosts, A and B,
    connected by a single link of rate $R$ bps. Suppose that the two hosts are separated by
    $m$ meters, and suppose the propagation speed along the link is $s$ meters/sec. Host A is
    to send a packet of size $L$ bits to Host B.}
    \begin{enumerate}
        \item Express the propagation delay, $d_{prop}$, in terms of $m$ and $s$.
        $$
        d_{prop}=\frac{m}{s}\ \mathrm{second}
        $$
        \item Determine the transmission time of the packet, $d_{trans}$, in terms of $L$ and $R$.
        $$
        d_{trans}=\frac{L}{R}\ \mathrm{second}
        $$
        \item Ignoring processing and queuing delays, obtain an expression for the end-to-end
        delay.
        $$
        d_{end\_to\_end}=d_{prop}+d_{trans}=(\frac{m}{s}+\frac{L}{R})\ \mathrm{second}
        $$
        \item Suppose Host A begins to transmit the packet at time $t = 0$. At time $t = d_{trans}$,
        where is the last bit of the packet?

        最后一个bit刚刚被Host A发出，但Host B还未收到。
        \item Suppose $d_{prop}$ is greater than $d_{trans}$. At time $t = d_{trans}$, where is the first bit of the
        packet?
        
        第一个bit仍然在传播过程中，未被Host B收到。
        \item Suppose $d_{prop}$ is less than $d_{trans}$. At time $t = d_{trans}$, where is the first bit of the packet?
        
        第一个bit已经被Host B收到了。

        \item Suppose $s = 2.5 \cdot 10^{8}$,$L=100 \mathrm{bits}$,and $R=28 \mathrm{kbps}$. Find the distance $m$ so that $d_{prop}$ equals $d_{trans}$.
        
        \begin{proof}[解]
        \begin{zhongwen}
            $$
            \begin{aligned}
            d_{prop}&=d_{trans} \\
            \frac{m}{s}&=\frac{L}{R} \\
            \frac{m}{2.5\cdot 10^{8}}&=\frac{100}{28\cdot 10^{3}} \\
            m = 2.5\cdot 10^{8}\times \frac{100}{28\cdot 10^{3}} &= \frac{6250000}{7} \approx  892857.142857143 \quad (\mathrm{meters})\\
            \end{aligned}
            $$
        \end{zhongwen}
        \end{proof}
    \end{enumerate}
    \cnitem[10]{Consider the queuing delay in a router buffer (preceding an outbound link).
    Suppose all packets are $L$ bits, the transmission rate is $R$ bps, and that N packets
    simultaneously arrive at the buffer every $LN/R$ seconds. Find the average queuing
    delay of a packet. (Hint: The queuing delay for the first packet is zero; for the second
    packet $L/R$; for the third packet $2L/R$. The $N$th packet has already been transmitted
    when the second batch of packets arrives.)}
    
    \begin{proof}[解]
    \begin{zhongwen}
        $$
        \begin{aligned}
        &第i个包的排队延迟为(i-1)\frac{L}{R}，每一批共N个包，且各批之间互不影响 \\
        &\therefore 一个包的平均排队延迟为： \\
        &\frac{1}{N}\sum_{i=1}^{N}(i-1)\frac{L}{R}=\frac{L}{NR}\sum_{i=1}^{N}(i-1)=\frac{L}{NR}\frac{N(N-1)}{2}=\frac{L(N-1)}{2R} \\
        \end{aligned}
        $$
    \end{zhongwen}
    \end{proof}
    \cnitem[12]{Consider a packet of length $L$ which begins at end system A and travels over one
    link to a packet switch, and travels from the packet switch over a second link to a
    destination end system. These two links are connected by one packet switch. Let $d_i$,
    $s_i$, and $R_i$ denote the length, propagation speed, and the transmission rate of link $i$, for $i
    = 1, 2$. The packet switch delays each packet by $d_{proc}$. Assuming no queuing delays, in
    terms of $d_i$, $s_i$, and $R_i,(i = 1,2)$, and $L$, what is the total end-to-end delay for the packet?}

    $$
    d_{end\_to\_end} = d_{proc} + d_{prop}+d_{trans} = d_{proc}+\sum_{i=1}^{2}\frac{d_i}{s_i}+ \sum_{i=1}^{2}\frac{L}{R_i}
    $$

    Suppose now the packet is 1,000 bytes, the propagation speed on both links is
    $2.5\cdot 10^{8}$ m/s, the transmission rates of all both links are 1 Mbps, the packet length is
    1,000 bytes, the packet switch processing delay is 1 msec, the length of the first link is
    4,000 km, and the length of the last link is 1,000 km. For these values, what is the
    end-to-end delay?

    $$
    \begin{aligned}
    d_{end\_to\_end} &= d_{proc} + d_{prop}+d_{trans} = d_{proc}+\sum_{i=1}^{2}\frac{d_i}{s_i}+ \sum_{i=1}^{2}\frac{L}{R_i} \\
    &=1 \cdot 10^{-3}\mathrm{s} + \frac{4000 \cdot 10^{3} \mathrm{m}}{2.5\cdot 10^{8} \mathrm{m/s}}+\frac{1000\cdot 10^{3}\mathrm{m}}{2.5\cdot 10^{8}\mathrm{m/s}} + 2\times \frac{1000 \times 8\ \mathrm{bits}}{1\cdot 10^{6}\mathrm{bits/s}} \\
    &=(1\cdot 10^{-3}+\frac{4000\cdot 10^{3}}{2.5\cdot 10^{8}}+\frac{1000\cdot 10^{3}}{2.5\cdot 10^{8}}+2\times \frac{1000\times 8}{1\cdot 10^{6}})\times 10^{3} \quad \mathrm{ms} \\
    &= 37 \quad \mathrm{ms} \\
    \end{aligned}
    $$

    \cnitem[17]{Consider the throughput example corresponding to Figure 1.16(b). Now
    suppose that there are $M$ client-server pairs rather than 10. Denote $R_s$, $R_c$, and
    $R$ for the rates of the server links, client links, and network link. Assume all other
    links have abundant capacity and that there is no other traffic in the network besides
    the traffic generated by the M client-server pairs. Derive a general expression for
    throughput in terms of $R_s$, $R_c$, $R$, and $M$.}
    \begin{figure}[h]
    \centering
    \includegraphics{imgs/2023-10-14-21-43-15.png}
    \caption{Figure 1.16(b)}
    \end{figure}

    吞吐量为：
    $$
    \min \left\{ R_s,R_c,\frac{R}{M} \right\} 
    $$
    \pagebreak[1]
    \cnitem[25]{Consider sending a large file of $F$ bits from Host A to Host B. There are two links
    (and one switch) between A and B, and the links are uncongested (that is, no
    queuing delays). Host A segments the file into segments of $S$ bits each and adds 40
    bits of header to each segment, forming packets of $L = 40 + S$ bits. Each link has a
    transmission rate of $R$ bps. Find the value of $S$ that minimizes the delay of moving the
    file from Host A to Host B. Disregard propagation delay.}

    \begin{proof}[解]
    \begin{zhongwen}
        $$
            设d_{all}(F,S,R)表示将文件从主机A发送到主机B的全部延迟，即需要求解
        $$ $$
            \mathop{\arg\min}_{S}
            \quad d_{all}(F,S,R)
        $$ $$
        \begin{aligned}
            d_{all}(F,S,R) &= \frac{\left\lceil \frac{F}{S} \right\rceil \times (40+S)}{R} + \frac{(40+S)}{R}\\
            &=\left(\left\lceil \frac{F}{S} \right\rceil + 1\right) \times \frac{40+S}{R} \\
            &=\frac{1}{R}\left( 40\left\lceil \frac{F}{S} \right\rceil +S\left\lceil \frac{F}{S} \right\rceil +40+S \right)  \\
        \end{aligned}
        $$ $$
            一般情况下， S\ll F，所以\left\lceil \frac{F}{S} \right\rceil \approx \frac{F}{S},所以
        $$ $$
        \begin{aligned}
            d_{all}(F,S,R)&\approx \frac{1}{R}\left(40 \times \frac{F}{S}+S\times \frac{F}{S}+40+S\right)\\
            &=\frac{1}{R}\left(S+\frac{40F}{S}+F+40\right) \\
            &\geqslant \frac{1}{R}\left(2\sqrt{40F}+F+40\right) \\
            &当且仅当S=\sqrt{40F}时，此不等式的等号成立 \\
        \end{aligned}
        $$ $$
            \therefore S取\sqrt{40F}时，将文件从主机A发送到主机B的全部延迟最小。
        $$
    \end{zhongwen}
    \end{proof}
\end{enumerate}
\end{document}