---
tags: Computer Network
---
# NCCUCS NET22 HW01
## R11
**Suppose there is exactly one packet switch between a sending host and a receiving host. The transmission rates between the sending host and the switch and between the switch and the receiving host are R1 and R2, respectively. Assuming that the switch uses store-and-forward packet switching, what is the total end-to-end delay to send a packet of length L? (Ignore queuing, propagation delay, and processing delay.)**
:::success
R1 = Transmission rates between the sending host and the switch
R2 = Transmission rates between the switch and the receiving host
L = Packet of length
Total end-to-end delay to send a packet of length = L/R1 + L/R2
:::
<br>
## R13
**Suppose users share a 2 Mbps link. Also suppose each user transmits continuously at 1 Mbps when transmitting, but each user transmits only 20 percent of the time. (See the discussion of statistical multiplexing in Section 1.3.)**
### (a.)
**When circuit switching is used, how many users can be supported?**
:::success
$\rm \dfrac{2 Mbps}{1Mbps} = 2$ (users)
:::
### (b.)
**For the remainder of this problem, suppose packet switching is used. Why will there be essentially no queuing delay before the link if two or fewer users transmit at the same time? Why will there be a queuing delay if three users transmit at the same time?**
:::success
Since each user requires 1Mbps when transmitting, if two or fewer users transmit simultaneously, a maximum of 2Mbps will be required.
Since the available bandwidth of the shared link is 2Mbps, there will be no queuing delay before the link.
However, if three or more users transmit simultaneously, there will be queuing delay before the link.
:::
### (c.)
**Find the probability that a given user is transmitting.**
:::success
Probability that a given user is transmitting = 0.2
:::
### (d.)
**Suppose now there are three users. Find the probability that at any given time, all three users are transmitting simultaneously. Find the fraction of time during which the queue grows.**
:::success
$(0.2)^3 = 0.008$
:::
<br>
## R18
**A user can directly connect to a server through either long-range wireless or a twisted-pair cable for transmitting a 1500-bytes file. The transmission rates of the wireless and wired media are 2 and 100 Mbps, respectively. Assume that the propagation speed in air is 3 x 10$^8$ m/s, while the speed in the twisted pair is 2 x 10$^8$ m/s. If the user is located 1 km away from the server, what is the nodal delay when using each of the two technologies.**
:::success
**1. Wireless**
- Transmission Delay = $\rm \dfrac{L (bits)}{R (bps)} = \dfrac{1500 * 8 (bits)}{2 * 10^6 (bps)} = 0.006 (s) = 6 (ms)$
<br>
- Propagation Delay = $\rm \dfrac{d (m)}{s (m/s)} = \dfrac{1000 (m)}{3 * 10^8 (m/s)} = 0.00000333333 (s) = 0.003 (ms)$
<br>
- Nodal Delay = Transmission Delay + Propagation Delay = 6ms + 0.003ms = 6.003ms
<br>
**2. Wired**
- Transmission Delay = $\rm \dfrac{L (bits)}{R (bps)} = \dfrac{1500 * 8 (bits)}{100 * 10^6 (bps)} = 0.00012 (s) = 0.12 (ms)$
<br>
- Propagation Delay = $\rm \dfrac{d (m)}{s (m/s)} = \dfrac{1000 (m)}{2 * 10^8 (m/s)} = 0.000005 (s) = 0.005 (ms)$
<br>
- Nodal Delay = Transmission Delay + Propagation Delay = 0.12ms + 0.005ms = 0.125ms
:::
<br>
## R19
**Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links, of rate R1 = 500 kbps, R2 = 2 Mbps, and R3 = 1 Mbps.**
### (a.)
**Assuming no other traffic in the network, what is the throughput for the file transfer?**
:::success
Given: R1 = 500 kbps, R2 = 2 Mbps, R3 = 1 Mbps
The throughput for the file transfer = min(R1,R2,R3) = 500 kbps
:::
### (b.)
**Suppose the file is 4 million bytes. Dividing the file size by the throughput, roughly how long will it take to transfer the file to Host B?**
:::success
$\rm \dfrac{L (bits)}{R (bps)} = \dfrac{4 * 10^6 (B)}{500 (kbps)} = \dfrac{32 * 10^6 (bits)}{5 * 10^5 (bps)} = 64 (s)$
:::
### (c.)
**Repeat (a.) and (b.), but now with R2 reduced to 100 kbps.**
:::success
$\rm \dfrac{L (bits)}{R (bps)} = \dfrac{32 * 10^6 (bits)}{1 * 10^5 (bps)} = 320 (s)$
:::
<br>
## P2
**Equation 1.1 gives a formula for the end-to-end delay of sending one packet of length L over N links of transmission rate R. Generalize this formula for sending P such packets back-to-back over the N links.**
:::success
N = Total number of links
R = Transmission rate
L = Packet length
P = packets that tramnsmit over the N link
Back-to-back delay of sending P packets over N links of transmisson rate R =
$\rm N*\dfrac{L}{R} + (P - 1)*\dfrac{L}{R} = (N+P-1)*\dfrac{L}{R}$
:::
:::danger
Note:
Equation 1.1: $\rm \dfrac{NL}{R}$ 沒有考慮 Propagation Delay (只考慮Transmission)
所以每過$\rm \dfrac{L}{R}$ 時間,packet 會到下一個 link
而因為是 back-to-back,最後的 packet 要等前面的都送出去,因此要多等$\rm (P - 1)*\dfrac{L}{R}$
:::
<br>
## P4
**Consider the circuit-switched network in Figure 1.13. Recall that there are 4 circuits on each link. Label the four switches A, B, C, and D, going in the clockwise direction.(左上順時針開始分別是A,B,C,D)**

### (a.)
**What is the maximum number of simultaneous connections that can be in progress at any one time in this network?**
:::success
We can have 4 connections between the upper left switch and the upper right switch.
Similarly, we can have 4 connections between each of the 3 other pairs of switches.
Thus, this network can support up to 16 simultaneous connections.
:::
### (b.)
**Suppose that all connections are between switches A and C. What is the maximum number of simultaneous connections that can be in progress?**
:::success
We can have 4 connections passing through the switch in the upper-right-hand corner and another 4 connections passing through the switch in the lower-left-hand corner, giving a total of 8 connections.
:::
### (c.)
**Suppose we want to make four connections between switches A and C, and another four connections between switches B and D. Can we route these calls through the four links to accommodate all eight connections?**
:::success
For the connections between A and C, we route two connections through B and two connections through D.
For the connections between B and D, we route two connections through A and two connections through C.
In this manner, there are at most 4 connections passing through any link and all eight connections are accommodated.
:::
<br>
## P5
**Review the car-caravan analogy in Section 1.4. Assume a propagation speed of 100 km/hour. Tollbooths are 75 km apart, and the cars propagate at 100km/hr. A tollbooth services a car at a rate of one car every 12 seconds. There are 10 cars.**
### (a.)
**Suppose the caravan travels 150 km, beginning in front of one tollbooth, passing through a second tollbooth, and finishing just after a third tollbooth. What is the end-to-end delay?**
:::success
Propagation speed = 100 (km/hr), Distance between tollbooth = 75 (km)
Propogation Delay = Distance / Propagation Speed = 75(km) / 100(km/hr) = 45 (min)
Time for taken by each tollbooth to reach 10 cars = 12(s) x 10 = 2 (min)
End-to-end Delay (3 Toolbooths and 2 Hops in between) = 45 x 2 + 2 x 3 = 96 (min)
:::
### (b.)
**Repeat (a.), now assuming that there are eight cars in the caravan instead of ten.**
:::success
Propagation speed = 100 (km/hr), Distance between tollbooth = 75 (km)
Propogation Delay = Distance / Propagation Speed = 75(km) / 100(km/hr) = 45 (min)
Time for taken by each tollbooth to reach 8 cars = 12(s) x 8 = 96 (s) = 1.6 (min)
End-to-end Delay (3 Toolbooths and 2 Hops in between) = 45 x 2 + 1.6 x 3 = 94.8 (min)
:::
<br>
## P6
**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.**
### (a.)
Express the propagation delay, $d{prop}$, in terms of m and s.
:::success
$\rm d_{prop}$ = m / s seconds
:::
### (b.)
Determine the transmission time of the packet, $\rm d{trans}$, in terms of L and R.
:::success
$\rm d_{trans}$ = L / R seconds
:::
### (c.)
Ignoring processing and queuing delays, obtain an expression for the end-to-end delay.
:::success
$\rm d_{nodal}$ = (m / s) + (L / R) seconds
:::
### (d.)
Suppose Host A begins to transmit the packet at time t = 0. At time t = $\rm d_{trans}$, where is the last bit of the packet?
:::success
The bit is just leaving Host A.
:::
### (e.)
Suppose $\rm d_{prop}$ is greater than $\rm d_{trans}$. At time t = $\rm d_{trans}$, where is the first bit of the packet?
:::success
The first bit is in the link and has not yet reached Host B.
:::
### (f.)
Suppose $\rm d_{prop}$ is less than $\rm d_{trans}$. At time t = $\rm d_{trans}$, where is the first bit of the packet?
:::success
The first bit has already reached Host B.
:::
### (g.)
Suppose s = 2.5 * $10^8$ (m/s) , L = 120 (bits), and R = 56 (kbps).
Find the distance (m) so that $\rm d_{prop}$ equals $\rm d_{trans}$.
:::success
$\rm \dfrac{L}{R}$ = $\rm \dfrac{m}{s}$
$\rm m = \dfrac{L}{R} * s = \rm \dfrac{120}{56 * 10^3} * (2.5 * 10^8) = 535714.285$ (m)
:::
<br>
## P7
**In this problem, we consider sending real-time voice from Host A to Host B over a packet-switched network (VoIP). Host A converts analog voice to a digital 64 kbps bit stream on the fly. Host A then groups the bits into 56-byte packets. There is on link between Hosts A and B; its transmission rate is 2 Mbps and its propagation delay is 10 msec. As soon as Host A gathers a packet, it sends it to Host B. As soon as Host B receives an entire packet, it converts the packet’s bits to an analog signal. How much time elapses from the time a bit is created (from the original analog signal at Host A) until the bit is decoded (as part of the analog signal at Host B)?**
:::success
- Packet Generation Time = $\rm \dfrac{56 (B)}{64 (kbps)} = \dfrac{56*8 (bits)}{64*10^3 (bps)} = 0.007 (s) = 7 (ms)$
<br>
- Transmission Delay = $\rm \dfrac{L (bits)}{R (bps)} = \dfrac{56 (B)}{2 (Mbps)} = \dfrac{56 * 8 (bits)}{2*10^6 (bps)} = 224 (µs)$
<br>
- Propagation Delay = $\rm 10 (ms)$
<br>
Elapsed Time = 2 * 7 (ms) + 10 (ms) + 224 (µs) = 24.224 (ms)
:::
<br>
## P8
**Suppose users share a 3 Mbps link. Also suppose each user requires 150 kbps when transmitting, but each user transmits only 10 percent of the time. (See the discussion of packet switching versus circuit switching in Section 1.3.)**
### (a.)
When circuit switching is used, how many users can be supported?
:::success
$\rm \dfrac{3 (Mbps)}{150(kbps)} = \dfrac{3 * 10^6 (bps)}{150 * 10^3(bps)} = 20 (users)$
:::
### (b.)
For the remainder of this problem, suppose packet switching is used. Find the probability that a given user is transmitting.
:::success
$\rm p = 0.1$
:::
### (c.)
Suppose there are 120 users. Find the probability that at any given time, exactly n users are transmitting simultaneously. (Hint: Use the binomial distribution.)
:::success
$\rm \left(
\begin{array}{c}
120 \\
\rm n \\
\end{array}
\right)
p^n(1-p)^{120-n}$
:::
### (d.)
Find the probability that there are 21 or more users transmitting simultaneously.
:::success
$\rm 1 -\sum_{n=0}^{20}
\left(
\begin{array}{c}
120 \\
\rm n \\
\end{array}
\right)
p^n(1-p)^{120-n}$
:::
<br>
## P9
**Consider the discussion in Section 1.3 of packet switching versus circuit switching in which an example is provided with a 1 Mbps link. Users are generating data at a rate of 100 kbps when busy, but are busy generating data only with probability p = 0.1. Suppose that the 1 Mbps link is replaced by a 1 Gbps link.**
### (a.)
What is the maximum number of users that can be supported simultaneously under circuit switching?
:::success
$\rm \dfrac{1 (Gbps)}{100(kbps)} = \dfrac{1 * 10^9(bps)}{100 * 10^3(bps)} = 10000 (users$)
:::
### (b.)
Now consider packet switching and a user population of M users. Give a formula(in terms of p, M, N) for the probability that more than N users are sending data.
:::success
$\rm 1 -\sum_{n=0}^{M}
\left(
\begin{array}{c}
\rm M \\
\rm n \\
\end{array}
\right)
p^n(1-p)^{120-n}$
:::
<br>
## P10
**Consider the network illustrated in Figure 1.16. Assume the two hosts on the left of the figure start transmitting packets of 1500 bytes at the same time towards Router B. Suppose the link rates between the hosts and Router A is 4-Mbps. One link has a 6-ms propagation delay and the other has a 2-ms propagation delay. Will queuing delay occur at Router A?**

:::success
Transmission Delay $= \rm \dfrac{L}{R} = \dfrac{1500 (B)}{4 (Mbps)} = \dfrac{1500 * 8 (bits)}{4 * 10^6 (bps)} = 0.003 (s) = 3 (ms)$
Delay of last bit on the 2-ms link = 3ms + 2ms = 5ms
Propagation Delay the other (fastest) bit is already 6ms, so there's no Queuing Delay at A.
:::
<br>
## P11
**Consider the scenario in Problem P10 again, but now assume the links between the hosts and Router A have different rates R1 and R2 byte/s in addition to different propagation delays d1 and d2. Assume the packet lengths for the two hosts are of L bytes. For what values of the propagation delay will no queuing delay occur at Router A?**
:::success
Assume that $\rm d_2>d_1$, there will be no queueing delay at Router A when $\rm \dfrac{L}{R_1} + d_1 < d_2$.
:::
<br>
## P12
**Consider a client and server connected through one router. Assume the router can start transmitting an incoming packet after receiving its first h bytes instead of the whole packet. Suppose that the link rates are R byte/s and that the client transmits one packet with a size of L bytes to the server. What is the end-to-end delay? Assume the propagation, processing, and queuing delays are negligible. Generalize the previous result to a scenario where the client and the server are interconnected by N routers.**
:::success
One Router: $\rm d_{end-to-end} = \dfrac{h}{R} + \dfrac{L}{R}$
N Routers: $\rm d_{end-to-end} = N*\dfrac{h}{R} + \dfrac{L}{R}$
:::
:::danger
Scenario 1: One Router
C-----Router-----S
C-----Router : $\rm \dfrac{L}{R}$ + Router-----S : $\rm\dfrac{h}{R}$
<br>
Scenario 2: N = 3 Routers
C-----Router-----Router-----Router-----S
$\rm d_{end-to-end} = 3*\dfrac{h}{R} + \dfrac{L}{R}$
:::
<br>
## P13
### (a.)
Suppose N packets arrive simultaneously to a link at which no packets are currently being transmitted or queued. Each packet is of length $L$ and the link has transmission rate $R$. What is the average queuing delay for the $N$ packets?
:::success
$\rm (\dfrac{\dfrac{L}{R} + 2\dfrac{L}{R} + 3\dfrac{L}{R} + .... + (N-1)\dfrac{L}{R}}{N}) = \dfrac{L}{RN} * \dfrac{N(N-1)}{2} \\= \dfrac{(N-1)L}{2R}$
:::
:::danger
第一個是0,第二個是 $\rm \dfrac{L}{R}$,第三個是 $\rm \dfrac{2L}{R}$,第四個是 $\rm \dfrac{3L}{R}$,第N個是$\rm \dfrac{(N-1)L}{R}$
:::
### (b.)
Now suppose that N such packets arrive to the link every $N*\dfrac{L}{R}$ seconds. What is the average queuing delay of a packet?
:::success
There will be N packets every $\rm \tfrac{NL}{R}$, so the buffer is already empty after $\rm \tfrac{NL}{R}$, so the average delay is the same as (a.).
:::
<br>
## P14
**Consider the queuing delay in a router buffer. Let $\rm I$ denote traffic intensity; that is $\rm I = La/R$. Suppose that the queuing delay takes the form $\rm IL/R (1 - I)$ for $\rm I < 1$.**
### (a.)
Provide a formula for the total delay, that is, the queuing delay plus the transmission delay.
:::success
Transmission Delay = $\rm \dfrac{L}{R}$
Queuing Delay = $\rm \dfrac{IL}{R(1-I)}$
Total Delay = $\rm \dfrac{L}{R} + \dfrac{IL}{R(1-I)} = \dfrac{L/R}{(1-I)}$
:::
### (b.)
Plot the total delay as a function of L/R.
:::success
$\rm f(x) = \dfrac{L}{R}$ and $\rm I = \dfrac{La}{R}$
Total Delay = $\rm \dfrac{L/R}{(1-I)}$ = $\rm
\dfrac{f(x)}{(1-af(x))}$
<br>
1. If $\rm f(x) = 0$, Total Delay = 0.
2. Total Delay grows as $\rm f(x)$ grows.
3. When $\rm f(x)$ is approximately $\rm \dfrac{1}{a}$, Total Delay is approximately infinite.
:::
<br>
## P15
**Let $\rm a$ denote the rate of packets arriving at a link in packets/sec, and let $\rm u$ denote the link’s transmission rate in packets/sec. Based on the formula for the total delay (i.e., the queuing delay plus the transmission delay) derived in the previous problem, derive a formula for the total delay in terms of $a$ and $μ$.**
:::success
Total Delay = $\rm \dfrac{L/R}{(1-I)} = \dfrac{L/R}{(1-aL/R)} = \dfrac{1/u}{(1-a/u)} = \dfrac{1}{(u-a)}$
:::
<br>
## P16
**Consider a router buffer preceding an outbound link. In this problem, you will use Little’s formula, a famous formula from queuing theory. Let $\rm N$ denote the average number of packets in the buffer plus the packet being transmitted. Let $\rm a$ denote the rate of packets arriving at the link. Let $\rm d$ denote the average total delay (i.e., the queuing delay plus the transmission delay) experienced by a packet. Little’s formula is $\rm N = a * d$ . Suppose that on average, the buffer contains 10 packets, and the average packet queuing delay is 10 msec. The link’s transmission rate is 100 packets/sec. Using Little’s formula, what is the average packet arrival rate, assuming there is no packet loss?**
:::success
The total number of packets in the system includes those in the buffer and the packet that is being transmitted. (N = 10+1 = 11)
Queuing Delay = 10 (ms) = 0.01 (s)
Transmission Delay = 1 (pkt) / 100 (pkts/s) = 0.01 (s)
$\rm N = a * d$
11 = a x (Queuing Delay + Transmission Delay)
$\rm 11 = a *(0.01 + 0.01)$
$\rm a = 550$ (pkts/s)
:::
<br>
## P20
**Consider the throughput example corresponding to Figure 1.20(b). Now suppose that there are M client-server pairs rather than 10. Denote $\rm Rs$, $\rm Rc$, and $\rm 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 $\rm M$ client-server pairs. Derive a general expression for throughput in terms of $\rm Rs$, $\rm Rc$, $\rm R$, and $\rm M$.**

:::success
$\rm Throughput = min(Rs, Rc, \dfrac{R}{M})$
:::
<br>
## P21
**Assume a client and a server can connect through either network (a) or (b) in Figure 1.19. Assume that $R_i = (R_c + R_s) / i, i = 1, 2, …, N$. In what case will network (a) have a higher throughput than network (b)?**

:::success
Two scenarios:
1. If throughput of A = $\rm R_s$ then $\rm R_s > (R_s + R_c)/N$
2. If throughput of A = $\rm R_c$ then $\rm R_c > (R_s + R_c)/N$
i.e.,
1. $\rm Rc > Rs/(N − 1)$
2. $\rm Rs > Rc/(N − 1)$
:::
<br>
## P22
**Consider Figure 1.19(b). Suppose that each link between the server and the client has a packet loss probability $p$, and the packet loss probabilities for these links are independent. What is the probability that a packet (sent by the server) is successfully received by the receiver? If a packet is lost in the path from the server to the client, then the server will re-transmit the packet. On average, how many times will the server re-transmit the packet in order for the client to successfully receive the packet?**

:::success
Probability of successfully receiving a packet = $\rm P_s = (1 - p)^N$
The probability that the packet transmitted by the server is received by the client successfully is $\rm \dfrac{1}{P_s}$
So, the server has to re-transmit $\rm \dfrac{1}{P_s} - 1$ times in order to let the client receive the packet successfully.
:::
<br>
## P23
Consider Figure 1.19(a). Assume that we know the bottleneck link along the path from the server to the client is the first link with rate $R_s$ bits/sec. Suppose we send a pair of packets back to back from the server to the client, and there is no other traffic on this path. Assume each packet of size $L$ bits, and both links have the same propagation delay $d_{prop}$.

### (a.)
What is the packet inter-arrival time at the destination? That is, how much time elapses from when the last bit of the first packet arrives until the last bit of the second packet arrives?
:::success
$\rm d_{trans} = \dfrac{L}{R_s}$
:::
### (b.)
Now assume that the second link is the bottleneck link (i.e., $R_c < R_s$). Is it possible that the second packet queues at the input queue of the second link? Explain. Now suppose that the server sends the second packet $T$ seconds after sending the first packet. How large must $T$ be to ensure no queuing before the second link? Explain.
:::danger
(1) Yes, there will be queueing delay.
(2)
$\rm \frac{L}{R_s}+\frac{L}{R_s}+d_{\text {prop }}<\frac{L}{R_s}+\frac{L}{R_c}+d_{\text {prop }}$
$\rm \frac{L}{R_s}+\frac{L}{R_s}+d_{\text {prop }}+T \geq \frac{L}{R_s}+\frac{L}{R_c}+d_{p 10 p}$
$\rm \Rightarrow \frac{2 L}{R_s}+d_{p r o p}+T \geq \frac{L}{R_s}+\frac{L}{R_c}+d_{p r o p}$
$\rm \Rightarrow \frac{L}{R_s}+d_{p r p p}+T \geq \frac{L}{R_c}+d_{p r c p}$
$\rm \Rightarrow \frac{L}{R_s}+T \geq \frac{L}{R_c}$
$\rm \Rightarrow T \geq \frac{L}{R_c}-\frac{L}{R_s}$
:::
<br>
## P24
Consider a user who needs to transmit 1.5 gigabytes of data to a server. The user lives in a small town where only dial-up access is available. A bus visits the small town once a day from the closest city, located 150 km away, and stops in front of the user’s house. The bus has a 100-Mbps WiFi connection. It can collect data from users in rural areas and transfer them to the Internet through a 1 Gbps link once it gets back to the city. Suppose the average speed of the bus is 60km/hr. What is the fastest way the user can transfer the data to the server?
:::success
$\rm 1.5 (GB) = 1.5 * 10^9(B) = 12 * 10^9 (bits)$
- Dial Up Scenario
$\rm \dfrac{12 * 10^9 (bits)}{56 * 10^3 (bps)} = 214286 (s) = 59.5 (hr)$
<br>
- Bus Scenario
1. To bus: $\rm \dfrac{1.5 (GB)}{100 (Mbps)} = \dfrac{12 * 10^9 (bits)}{100 * 10^6 (bps)} = 120 (s)$
<br>
3. Drive from rural to city: $\rm \dfrac{150 (km)}{60 (km/hr)} = 2.5 (hr)$
<br>
5. Wi-Fi connection in city: $\rm \dfrac{1.5 (GB)}{1 (Gbps)} = \dfrac{12 * 10^9 (bits)}{1 * 10^9 (bps)} = 12 (s)$
The option of bus is surely faster.
:::
<br>
## P25
**Suppose two hosts, A and B, are separated by 20,000 kilometers and are connected by a direct link of R = 2Mbps. Suppose the propagation speed over the link is $2.5*10^8$ meters/sec.**
### (a.)
Calculate the bandwidth-delay product: $\rm R* d_{prop}$.
:::success
$\rm d_{prop} = \dfrac{2 * 10^7}{2.5*10^8} = 0.08s$
$\rm R = 2Mbps = 2 * 10^6 bps$
Bandwidth-Delay Product $= 0.08 * (2 * 10^6) = 160000$ (bits)
:::
### (b.)
Consider sending a file of 800,000 bits from Host A to Host B. Suppose the file is sent continuously as one large message. What is the maximum number of bits that will be in the link at any given time?
:::success
160000 (bits)
:::
### (c.)
Provide an interpretation of the bandwidth-delay product.
:::success
The bandwidth-delay product of a link is the maximum number of bits that can be in the link.
:::
### (d.)
What is the width (in meters) of a bit in the link? Is it longer than a football field?
:::success
$\rm \dfrac{2*10^7}{160000} = 125meters/s$
1 bit is longer than a football field.
:::
### (e.)
Derive a general expression for the width of a bit in terms of the propagation speed s, the transmission rate R, and the length of the link m.
:::success
width of a bit = Length of Link / Bandwidth-Delay = m / R * (m/s)
width of a bit = $\rm \dfrac{m}{R(m/s)} = \dfrac{m}{R}\dfrac{1}{(m/s)} = \dfrac{s}{R}$
:::
<br>
## P26
**Consider problem P25 but now with a link of R = 1 Gbps.**
### (a.)
Calculate the bandwidth-delay product, $R$ * $d_{prop}$.
:::success
$\rm d_{prop} = \dfrac{2 * 10^7}{2.5*10^8} = 0.08s$
$\rm R = 1Gbps = 1 * 10^9$ (bps)
Bandwidth-Delay Product $= 0.08 * (1 * 10^9) = 80000000$ (bits)
:::
### (b.)
Consider sending a file of 800,000 bits from Host A to Host B. Suppose the file is sent continuously as one big message. What is the maximum number of bits that will be in the link at any given time?
:::success
800000 (bits)
:::
### (c.)
What is the width (in meters) of a bit in the link?
:::success
$\rm \dfrac{s}{R} = \dfrac{2.5*10^8}{10^9} = 0.25m$
:::
<br>
## P27
**Consider the scenario illustrated in Figure 1.19(a). Assume Rs is 20 Mbps, Rc is 10 Mbps, and the server is continuously sending traffic to the client. Also assume the router between the server and the client can buffer at most four messages. After how many messages sent by the server will packet loss starts occurring at the router?**

:::success
$\rm R_s : R_c = 2 : 1$
As router receive 2 messages continuously, one of the messages will be in queue, and since there's only 4 buffers, packet loss may occur when the 10th packet is sent.
:::
<br>
## P28
**Generalize the result obtained in Problem P27 for the case where the router can buffer m messages.**
:::success
Let n = the nth message received ($\rm [\dfrac{n}{2}]$ in buffer)
Router will drop message when $\rm [\dfrac{n}{2}] > m$
Cases where the router can buffer m messages:
1. If n is even, $\rm n > 2m$
2. If n is odd, $\rm n > 2m + 1$
:::
<br>
## P29
Suppose there is a 10-Mbps microwave link between a geostationary satellite and its base station on Earth. Every minute the satellite takes a digital photo and sends it to the base station. Assume a propagation speed of $2.4*10^8$ meters/sec.
### (a.)
What is the propagation delay of the link?
:::success
$\rm d_{prop} = \dfrac{3.6 * 10 ^ 7}{2.4*10^8} = 0.15s$
:::
### (b.)
What is the bandwidth-delay product, $R*d{prop}$?
:::success
$\rm d_{prop} = \dfrac{3.6 * 10^7}{2.4*10^8} = 0.15s$
$\rm R = 10Mbps = 10 * 10^6 bps$
bandwidth-delay product $= 0.15 * (10 * 10^6) = 1500000$ (bits)
:::
### (c.)
Let x denote the size of the photo. What is the minimum value of x for the microwave link to be continuously transmitting?
:::success
minimum of x = $60 * 10$ Mbps $= 60 * 10^7$ bps $= 600000000 = 6 * 10^8$ bits
:::
<br>
## P31
In modern packet-switched networks, including the Internet, the source host segments long, application-layer messages (for example, an image or a music file) into smaller packets and sends the packets into the network. The receiver then reassembles the packets back into the original message. We refer to this process as message segmentation. Figure 1.27 illustrates the end-to-end transport of a message with and without segmentation. Consider a message that is $8*10^6$ bits long that is to be sent from source to destination in Figure 1.27. Suppose each link in the figure is **2 Mbps**. Ignore propagation, queuing, and processing delays.

### (a.)
Consider sending the message from source to destination without message segmentation. How long does it take to move the message from the source host to the first packet switch? Keeping in mind that each switch uses store-and-forward packet switching, what is the total time to move the message from source host to destination host?
:::success
$\rm \dfrac{8*10^6}{2*10^6} = 4$ (s)
There are 3 hops in between, so the total time is 12 (s)
:::
### (b.)
Now suppose that the message is segmented into 800 packets, with each packet being 10,000 bits long. How long does it take to move the first packet from source host to the first switch? When the first packet is being sent from the first switch to the second switch, the second packet is being sent from the source host to the first switch. At what time will the second packet be fully received at the first switch?
:::success
$\rm \dfrac{1*10^4}{2*10^6} = 5$ (ms)
2*5 = 10 (ms)
:::
### (c.)
How long does it take to move the file from source host to destination host when message segmentation is used? Compare this result with your answer in part (a) and comment.
:::success
15 (ms) + (800-1)*5 (ms) = 4.01 (s)
First packet to arrive: 15 (ms)
Packets arrive every 5 (ms) after the first packet.
[Approximately 3 times faster than (a.)]
:::
### (d.)
In addition to reducing delay, what are reasons to use message segmentation?
:::success
There is no need to retransmit the whole message when loss occur. (We only need to retransmit the packet.)
:::
### (e.)
Discuss the drawbacks of message segmentation.
:::success
1. Packets have to be put in sequence at the destination.
2. Utilization may be relatively low if we split the message into too many packets.
:::
<br>
## P32
Consider Problem P31 and assume that the propagation delay is 250 ms.
Recalculate the total time needed to transfer the source data with and without segmentation. Is segmentation more beneficial or less if there is propagation delay?
:::success
without message segmentation: 12s + 250 (ms) * 3 = 12.75 (s)
message segmentation: 4.01 + 250 (ms) * 3 = 4.76 (s)
12.75 / 4.76 = 2.67 < 4
It's less benificial.
:::
<br>
## P33
Consider sending a large file of $F$ bits from Host A to Host B. There are three links (and two switches) 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 80 bits of header to each segment, forming packets of $L = 80 + 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
:::success
The number of segments that the file is divided $=\frac{F}{S}$
The header size is 80 bits
The packet size $(L)$ is $80+S$ bits
The transmission rate $(R)$ is Rbps
$$
\rm
T_{\text {deley }}=\frac{L}{R}=\frac{80+S}{R} \text { seconds }
$$
The time $(T)$ required for the first packet to be transmitted to destination:
$\rm T=T_{\text {delay }}$ number of links $\rm =\left(\frac{80+S}{R}\right) \times 3$ seconds
After the first packet reaches the destination, one packet is received at destination for every $\rm \left(\frac{80+S}{R}\right)$ seconds.
Total delay in transmitting the whole file:
$\rm T_{\text {total }}=$ delay for first packet $+$ (number of packets $\times$ delay for one packet $)$
$$
\rm
\begin{aligned}
&=\left(\frac{80+S}{R}\right) \times 3+\left(\frac{F}{S}-1\right) \times\left(\frac{80+S}{R}\right) \\
&=\left(\frac{80+S}{R}\right)\left(\frac{F}{S}+2\right)
\end{aligned}
$$
Differentiate the equation $\rm T_{\text { }}=\left(\frac{80+S}{R}\right)\left(\frac{F}{S}+2\right)$ with respective to $S$.
$$
\rm
\begin{aligned}
\rm \frac{d T_{\text { }}}{d S} &=0 \\
\rm\frac{d}{d S}\left[\left(\frac{80+S}{R}\right)\rm\left(\frac{F}{S}+2\right)\right] &=0 \\
\rm\left(\frac{F}{S}+2\right) \frac{d}{d S}\left(\frac{80+S}{R}\right)+\left(\frac{80+S}{R}\right) \frac{d}{d S}\left(\frac{F}{S}+2\right) &=0 \\
\rm\left.\left(\frac{F}{S}+2\right)\left(\frac{d}{d S}\left(\frac{80}{R}\right)+\frac{d}{d S}\left(\frac{S}{R}\right)\right)+\left(\frac{80+S}{R}\right)\rm\left(\frac{d}{d S}\left(\frac{F}{S}\right)+\frac{d}{d S}(2)\right)\right) &=0 \\
\rm\left(\frac{F}{S}+2\right)\left(0+\frac{1}{R}\right)+\rm\left(\frac{80+S}{R}\right)\left(\frac{-F}{S^2}+0\right) &=0 \\
\rm\left(\frac{F+2 S}{S}\right)\left(\frac{1}{R}\right)+\rm\left(\frac{80+S}{R}\right)\left(\frac{-F}{S^2}\right) &=0 \\
2 S^2-80 F &=0
\end{aligned}
$$
S = $\sqrt{40F}$
:::