sample problems and Solutions-20121231

Chapter 1
1) p. 98: P-6
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 single link of rate R bps. Suppose that the two hosts are separated by
m meter, 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, dprop, in terms of m and s.
b. Determine the transmission time of the packet, dtrans, in terms of L and R.
c. Ignoring processing and queuing delays, obtain an expression for the
end-to-end delay.
d. 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?
e. Suppose dprop is greater than dtrans. At time t = dtrans, where is the first bit of the
packet?
f. Suppose dprop is less than dtrans. At time t = dtrans, where is the first bit of the
packet?
g. Suppose s = 2.5‧108, L = 120 bits, and R = 56 kbps. Find the distance m so
that dprop equals dtrans.
Answer:
a) d prop = m / s seconds.
b) d trans = L / R seconds.
c) d end в€’toв€’end = ( m / s + L / R ) seconds.
d) The bit is just leaving Host A.
e) The first bit is in the link and has not reached Host B.
f) The first bit has reached Host B.
g) Want
m=
(
)
L
120
s=
2.5 Г— 10 8 = 536 km.
3
R
56 Г— 10
2) p. 102: P-25
Suppose two hosts, A and B, are separated by 20,000 kilometers and are connected by
a direct link of R= 2Mbps. Suppose the paopagation speed over the link is 2.5‧108
meters/sec.
a. Calculate the bandwidth-delay product, R‧dprop.
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?
c. Provide and interpretation of the bandwidth-delay product.
d. What is the width ( in meters ) of a bit in the link? Is it longer than a foot-ball
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.
Answer:
a) 160,000 bits
b) 160,000 bits
c) The bandwidth-delay product of a link is the maximum number of bits that can
be in the link.
d) the width of a bit = length of link / bandwidth-delay product, so 1 bit is 125
meters long, which is longer than a football field
e) m/((m/s)*R) = s/R
Chapter 2
1) p. 200: P-10
Consider a short, 15-meters link, over which a sender can transmit at a rate of 160
bits/sec in both directions. Suppose that packets containing data are 200,000 bits long,
and packets containing only control (e.g., ACK or handshaking) are 100 bits long.
Assume that N parallel connections each get 1/N of the link bandwidth. Now consider
the HTTP protocol, and suppose that each downloaded object is 200 Kbits long, and
that the initial downloaded object contains 10 referenced objects from the same sender.
Would parallel downloads via parallel instances of non-persistent HTTP makes sense
in this case? Now consider persistent HTTP. Do you expect significant gains over the
non-persistent case? Justify and explain your answer.
Answer:
Note that each downloaded object can be completely put into one data packet. Let Tp
denote the one-way propagation delay between the client and the server.
First consider parallel downloads via non-persistent connections. Parallel download
would allow 10 connections share the 160 bits/sec bandwidth, thus each gets just 16
bits/sec. Thus, the total time needed to receive all objects is given by:
(100/160+Tp + 100/160 +Tp + 100/160+Tp + 200,000/160+ Tp )
+ (100/(160/10)+Tp + 100/(160/10) +Tp + 100/(160/10)+Tp + 200,000/(160/10)+ Tp )
= 13771 + 8*Tp (seconds)
Then consider persistent HTTP connection. The total time needed is give by:
(100/60+Tp + 100/160 +Tp + 100/160+Tp + 200,000/160+ Tp )
+ 10*(100/160+Tp + 200,000/160+ Tp )
=13758 + 24*Tp (seconds)
Assume the speed of light is 300*106 m/sec, then Tp=15/(300*106)=0.05 microsec. Tp
is negligible compared with transmission delay.
Thus, we see that the persistent HTTP does not have significant gain over the
non-persistent case with parallel download.
2) p. 200: P-11
Consider the scenario introduced in the previous problem. Now suppose that the
link is shared by Bob with four other users. Bob uses parallel instances of
non-persistent HTTP, and the other four users use non-persistent HTTP without
parallel downloads.
a. Do Bob’s parallel connections help him get Web pages more quickly?
Why or why not?
b. If all five users open five parallel instances of non-persistent HTTP, then
would Bob’s parallel connections still be beneficial? Why or why not?
Answer:
a) Yes, because Bob has more connections, he can get a larger share of the link
bandwidth.
b) Yes, Bob still needs to perform parallel downloads; otherwise he will get less
bandwidth than the other four users.
Chapter 3
1) P.321: P-37
Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values
for all three protocols are sufficiently long such that 5 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 5 data segments to Host B, and the 2nd segment (sent from A) is lost. In
the end, all 5 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?
Answer:
a) Go Back N:
A sends 9 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later
re-sent segments 2, 3, 4, and 5.
B sends 8 ACKs. They are 4 ACKS with sequence number 1, and 4 ACKS with
sequence numbers 2, 3, 4, and 5.
Selective Repeat:
A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later
re-sent segments 2.
B sends 5 ACKs. They are 4 ACKS with sequence number 1, 3, 4, 5. And there is
one ACK with sequence number 2.
TCP:
A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later
re-sent segments 2.
B sends 5 ACKs. They are 4 ACKS with sequence number 2. There is one ACK
with sequence numbers 6. Note that TCP always send an ACK with expected
sequence number.
b) TCP. This is because TCP uses fast retransmit without waiting until time out.
2) P. 324: P-46
Consider that only a single TCP (Reno) connection uses one 15Mbps link which does
not buffer any data. Suppose that this link is the only congested link between the
sending and receiving hosts. Assume that the TCP sender has a huge file to send to the
receiver, and the receiver’s receive buffer is much larger than the congestion window.
We also make the following assumptions: each TCP segment size is 1,200 bytes; the
two-way propagation delay of this connection is 160 msec; and this TCP connection is
always in congestion avoidance phase, that is, ignore slow start.
a. What is the maximum window size (in segment) that this TCP connection can
achieve?
b. What is the average window size (in segment) and average throughput (in bps) of
this TCP connection?
c. How long would it take for this TCP connection to reach its maximum window
again after recovering from a packet loss?
Answer:
a) Let W denote the max window size measured in segments. Then, W*MSS/RTT =
15Mbps, as packets will be dropped if the maximum sending rate exceeds link
capacity. Thus, we have W*1200*8/0.16=15*10^6, then W is about 250.
b) As congestion window size varies from W/2 to W, then the average window size is
0.75W=187.5 segments. Average throughput is 187.5*1200*8/0.16=11.25Mbps.
c) (250/2) *0.16= 20 seconds, as the number of RTTs (that this TCP connections
needs in order to increase its window size from W/2 to W) is given by W/2. Recall
the window size increases by one in each RTT.
Chapter 4
1) P. 448: P-26
Consider the following network. With the indicated link costs, use Dijkstra’s
shortest-path algorithm to compute the shortest path from x to all network nodes.
Show how the algorithm works by computing a table similar to Table 4.3.
Answer:
Step
N’
D(t),p(t)
D(u),p(u)
D(v),p(v)
D(w),p(w)
D(y),p(y)
D(z),p(z)
0
x
в€ћ
в€ћ
3,x
6,x
6,x
8,x
1
xv
7,v
6,v
3,x
6,x
6,x
8,x
2
xvu
7,v
6,v
3,x
6,x
6,x
8,x
3
xvuw
7,v
6,v
3,x
6,x
6,x
8,x
4
xvuwy
7,v
6,v
3,x
6,x
6,x
8,x
5
xvuwyt
7,v
6,v
3,x
6,x
6,x
8,x
6
xvuwytz
7,v
6,v
3,x
6,x
6,x
8,x
2) P. 449-P.27
Consider the network shown in Problem 26. Using Dijkstra’s algorithm, and
showing your work using a table similar to Table 4.3, do the following:
a. Compute the shortest path from t to all network nodes.
b. Compute the shortest path from u to all network nodes.
c. Compute the shortest path from v to all network nodes.
d. Compute the shortest path from w to all network nodes.
e. Compute the shortest path from y to all network nodes.
f. Compute the shortest path from z to all network nodes.
Answer:
a)
Step
N’
D(x), p(x)
D(u),p(u)
D(v),p(v)
D(w),p(w)
D(y),p(y)
D(z),p(z)
0
t
в€ћ
2,t
4,t
в€ћ
в€ћ
1
tu
в€ћ
2,t
4,t
2
tuv
7,v
2,t
4,t
3
tuvw
7,v
2,t
4,t
4
tuvwx
7,v
2,t
4,t
5
tuvwxy
7,v
2,t
4,t
6
tuvwxyz
7,v
2,t
4,t
5,u
5,u
5,u
5,u
5,u
5,u
7,t
7,t
7,t
7,t
7,t
7,t
7,t
N’
D(x), p(x)
D(t),p(t)
D(v),p(v)
D(w),p(w)
D(y),p(y)
D(z),p(z)
u
в€ћ
2,u
3,u
в€ћ
в€ћ
ut
в€ћ
2,u
3,u
6,v
2,u
3,u
utvw
6,v
2,u
3,u
utvwx
6,v
2,u
3,u
utvwxy
6,v
2,u
3,u
utvwxyz
6,v
2,u
3,u
9,t
9,t
9,t
9,t
9,t
9,t
в€ћ
utv
3,u
3,u
3,u
3,u
3,u
3,u
3,u
N’
D(x), p(x)
D(u),p(u)
D(t),pt)
D(w),p(w)
D(y),p(y)
D(z),p(z)
v
3,v
3,v
4,v
3,v
3,v
4,v
vxu
3,v
3,v
4,v
vxut
3,v
3,v
4,v
vxutw
3,v
3,v
4,v
vxutwy
3,v
3,v
4,v
vxutwyz
3,v
3,v
4,v
8,v
8,v
8,v
8,v
8,v
8,v
8,v
в€ћ
vx
4,v
4,v
4,v
4,v
4,v
4,v
4,v
в€ћ
в€ћ
в€ћ
15,x
15,x
15,x
b)
Step
в€ћ
в€ћ
14,x
14,x
14,x
c)
Step
d)
11,x
11,x
11,x
11,x
11,x
11,x
Step
N’
D(x), p(x)
D(u),p(u)
D(v),p(v)
D(t),p(t)
D(y),p(y)
D(z),p(z)
w
6,w
3,w
4,w
в€ћ
в€ћ
в€ћ
wu
6,w
3,w
4,w
в€ћ
в€ћ
wuv
6,w
3,w
4,w
6,w
3,w
4,w
wuvtx
6,w
3,w
4,w
wuvtxy
6,w
3,w
4,w
wuvtxyz
6,w
3,w
4,w
12,v
12,v
12,v
12,v
12,v
в€ћ
wuvt
5,u
5,u
5,u
5,u
5,u
5,u
N’
D(x), p(x)
D(u),p(u)
D(v),p(v)
D(w),p(w)
D(t),p(t)
D(z),p(z)
y
6,y
в€ћ
8,y
в€ћ
12,y
yx
6,y
в€ћ
8,y
yxt
6,y
9,t
8,y
yxtv
6,y
9,t
8,y
yxtvu
6,y
9,t
8,y
yxtvuw
6,y
9,t
8,y
yxtvuwz
6,y
9,t
8,y
12,x
12,x
12,x
12,x
12,x
12,x
7,y
7,y
7,y
7,y
7,y
7,y
7,y
N’
D(x), p(x)
D(u),p(u)
D(v),p(v)
D(w),p(w)
D(y),p(y)
D(t),p(t)
z
8,z
в€ћ
в€ћ
в€ћ
в€ћ
zx
8,z
в€ћ
11,x
14,x
zxv
8,z
14,v
11,x
14,x
zxvy
8,z
14,v
11,x
zxvyu
8,z
14,v
11,x
zxvyuw
8,z
14,v
11,x
zxvyuwt
8,z
14,v
11,x
14,x
14,x
14,x
14,x
12,z
12,z
12,z
12,z
12,z
12,z
12,z
в€ћ
14,x
14,x
14,x
e)
Step
12,y
12,y
12,y
12,y
12,y
12,y
f)
Step
в€ћ
15,v
15,v
15,v
15,v
15,v
3) P. 450: P-34
Consider Figure 4.31. Suppose there is another router w, connected to router y and
z. The costs of all links are given as follows: c(x, y) = 4, c (x, z) = 50, c (y, w) = 1,
c (z, w) = 1, c (y, z) = 3. Suppose that poisoned reverse is used in the
distance-vector routing algorithm.
a. When the distance vector routing is stabilized, router w, y, and z inform their
distances to x to each other. What distance values do they tell each other?
b. Now suppose that the link cost between x and y increases to 60. Will there be
a count-to-infinity problem even if poisoned reverse is used? Why or why not?
If there is a count-to infinity problem, then how many iterations are needed for
the distance-vector routing to reach a stable state again? Justify your answer.
c. How do you modify c (y, z) such that there is no count-to-infinity problem at
all if c (y, x) changes from 4 to 60?
Answer:
a)
Router z
Informs w, Dz(x)=в€ћ
Informs y, Dz(x)=6
Router w
Informs y, Dw(x)=в€ћ
Informs z, Dw(x)=5
Router y
Informs w, Dy(x)=4
Informs z, Dy(x)=4
b)
Yes, there will be a count-to-infinity problem. The following table shows the routing
converging process. Assume that at time t0, link cost change happens. At time t1, y
updates its distance vector and informs neighbors w and z. In the following table, “à ”
stands for “informs”.
Time t0
t1
t2
t3
Г w, Dz(x)=в€ћ
Г y, Dz(x)=11
Z
Г w, Dz(x)=в€ћ
Г y, Dz(x)=6
No change
W
Г y, Dw(x)=в€ћ
Г z, Dw(x)=5
Г y, Dw(x)=в€ћ
Г z, Dw(x)=10
Y
Г w, Dy(x)=4
Г z, Dy(x)=4
Г w, Dy(x)=9
Г z, Dy(x)= в€ћ
t4
No change
No change
Г w, Dy(x)=14
Г z, Dy(x)= в€ћ
We see that w, y, z form a loop in their computation of the costs to router x. If we
continue the iterations shown in the above table, then we will see that, at t27, z
detects that its least cost to x is 50, via its direct link with x. At t29, w learns its least
cost to x is 51 via z. At t30, y updates its least cost to x to be 52 (via w). Finally, at
time t31, no updating, and the routing is stabilized.
Time t27
Z
t28
t29
t30
via w, в€ћ
via y, 55
via z, 50
Г w, Dz(x)=50
Г y, Dz(x)=50
W
Г y, Dw(x)=в€ћ
Г z, Dw(x)=50
Y
via w, в€ћ
via y, в€ћ
via z, 51
Г y, Dw(x)=51
Г z, Dw(x)= в€ћ
Г w, Dy(x)= в€ћ
Г z, Dy(x)= 52
Г w, Dy(x)=53
Г z, Dy(x)= в€ћ
c)
t31
via w, 52
via y, 60
via z, 53
cut the link between y and z.
Chapter 5
1) p. 530: P-8
In section 5.3, we provide an outline of the derivation of the efficiency of slotted
ALOHA. In this problem we’ll complete the derivation.
a. Recall that when there are N active nodes, the efficiency of slotted ALOHA is
NP(1-P)N-1. Find the value of p that maximizes this expression.
b. Using the value of p found in (a), find the efficiency of slotted ALOHA by
letting N approach infinity. Hint: (1-1/N)N approaches 1/e as N approaches
infinity.
Answer:
a)
E ( p ) = Np(1 в€’ p ) N в€’1
E ' ( p ) = N (1 в€’ p ) N в€’1 в€’ Np( N в€’ 1)(1 в€’ p ) N в€’2
= N (1 в€’ p ) N в€’2 ((1 в€’ p ) в€’ p ( N в€’ 1))
E ' ( p ) = 0 в‡’ p* =
1
N
b)
E ( p*) = N
lim (1 в€’
N в†’в€ћ
Thus
1
1
1
(1 в€’ ) N в€’1 = (1 в€’ ) N в€’1
N
N
N
1
) =1
N
lim (1 в€’
N в†’в€ћ
1 N
)
N
=
1
1в€’
N
(1 в€’
1 N 1
) =
N
e
lim E ( p*) =
N в†’в€ћ
1
e
2) P. 532: P-18
Suppose nodes A and B are on the same 12 Mbps broadcast channel, and the
propagation delay between the two nodes is 316 bit times. Suppose CSMA/CD
and Ethernet packets are used for this broadcast channel. Suppose node A beings
transmitting a frame and, before it finishes, node B begins transmitting a frame.
Can A finish transmitting before it detects that B has transmitted? Why or why not?
If the answer is yes, then A incorrectly believes that its frame was successful
transmitted without a collision. Hint: Suppose at time t = 0 bits, A begins
transmitting a frame. In the worst case, A transmits a minimum-sized frame of
512 + 64 bit times. So A would finish transmitting the frame at t =512 + 64 bit
times. Thus, the answer is no, if B’s signal reaches A before bit time t =512 + 64
bits. In the worst case, when does B’s signal reach A?
Answer:
At t = 0 , A transmits. At t = 576 , A would finish transmitting. In the worst case,
B begins transmitting at time t=315, which is the time right before the first bit of A’s
frame arrives at B. At time t=315+316=631, B 's first bit arrives at A . Because 631 >
576, A finishes transmitting before it detects that B has transmitted. So A
incorrectly thinks that its frame was successfully transmitted without a collision.
Chapter 7
1) P. 685: P-2
Recall the simple model for HTTP streaming shown in Figure 7.3. Recall that B
denotes the size of the client’s application buffer, and Q denotes the number of
bits that must be buffered before the client application begins playout.
Also r denotes the video consumption rate. Assume that the server sends bits at a
constant rate x whenever the client buffer is not full.
a. Suppose that x < r. As discussed in the text, in this case playout will alternate
between periods of continuous playout and period of freezing.
Determine the length of each continuous playout and freezing period as a
function of Q, r, and x.
b. Now suppose that x > r. At what time t = tf does the client application buffer
become full?
Answer:
a) During a playout period, the buffer starts with Q bits and decreases at rate r - x.
Thus, after Q/(r - x) seconds after starting playback the buffer becomes empty. Thus,
the continuous playout period is Q/(r - x) seconds. Once the buffer becomes empty,
it fills at rate x for Q/x seconds, at which time it has Q bits and playback begins.
Therefore, the freezing period is Q/x seconds.
b) Time until buffer has Q bits is Q/x seconds. Time to add additional B - Q bits is (B
- Q)/(x - r) seconds. Thus the time until the application buffer becomes full is
seconds.
2) P. 685: P-3
Recall the simple model for HTTP streaming shown in Figure 7.3. suppose the
buffer size is infinite but the server sends bits at variable rate x(t). Specifically,
suppose x (t) has the following saw-tooth shape. The rate is initially zero at time
t = 0 and linearly climbs to H at time t = T. It then repeats this pattern again and
again, as shown in the figure below.
a. What is the server’s average send rate?
b. Suppose that Q = 0, so that the client starts playback as soon as it receives a
video frame. What will happen?
c. Now suppose Q > 0. Determine as a function of Q, H, and T the time at which
playback first begins.
d. Suppose H > 2r and Q = HT/2. Prove there will be no freezing after the initial
playout delay.
e. Suppose H > 2r. Find the smallest value of Q such that there will be no
freezing after the initial playback delay.
f. Now suppose that the buffer size B is finite. Suppose H > 2r. As a function of
Q, B, T, and H, determine the time t = tf when the client application buffer first
becomes full.
Answer:
a) The server’s average send rate is
.
b) This part (b) is an odd question and will be removed from the next edition. After
playing out the first frame, because x(t) < r, the next frame will arrive after the
scheduled playout time of the next frame. Thus playback will freeze after
displaying the first frame.
c) Let q(t) denote the number of bits in the buffer at time t. Playout begins when q(t) =
Q. Let’s assume throughout this problem that HT/2 ≥ Q, so that q(t) = Q by the end
of the first cycle for x(t). We have
.
Therefore, q (t) = Q when t =
= tp.
d) At time t = T, q (t) = HT/2 = Q, so that playout begins. If subsequently there is no
freezing, we need q(t + T) > 0 for all t ≥ T, we have
>
With t = nT + ∆, with 0 < ∆ < T, we have from above
=
Which is easily seen to be possible for all 0 < ∆ < T.
e) First consider the [0, T]. We have
for tp ≤ t ≤ T
q (t) is minimized at t = rT/H. It can then be shown that q (rT/H) ≥ 0 if and only if
tp ≥ rT/2H. Furthermore, if tp = rT/2H, proof can be extended to show q (t) > 0 for
all t ≥ T thus, tp < rT/2H and Q = r2T/8H.
f) This is a very challenging problem. Assuming that B is reached before time T, then
tf is solution to
= B.