Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Homework 3
The solution is from one of students, only for reference.
P261
5(a). The data in the first segment=The Second segment sequence numberThe first segment sequence number
=110-90=20
(b). The acknowledgment number that host B puts in its segment is the sequence
number of the next byte host B is expecting from host A. Since the first segment is lost,
host B is expecting for the first segment. The sequence number of the first segment is 90,
the acknowledgement number is 90.
P262
3. After the sender send the first packet, the receiver is at the state “Wait for 1 from
below”. If the event rdt_rcv(rcvpkt)&&(corrupt(rcvpkt//has_seq0(rcvpkt)) accur, the
receiver takes the following action :
compute chksum make_pkt(sndpkt,NAK,chksum) udt_send(sndpkt).
The receiver sends only NAK to the sender. The sender is at the state “Wait for ACK or
NAK0” and is waiting for event rdt_rcv(rcvpkt)&¬corrupt(rcvpkt)&&is ACK(rcvpkt)
to accur which will never accur. Because there will never be a ACK, the sender remains
waiting and will not send any new packet. The receiver is still at the state “Wait for 1
from below” and remains waiting for event
rdt_rcv(rcvpkt)&¬corrupt(rcvpkt)&&has_seq1(rcvpkt)) to happen which will never
happen.
Hint: Suppose the sender sends packet 0. After receiving the packet the receiver moves to state, “Wait for
1 from below” and sends the ACK to the sender. The ACK is corrupted, the sender will Waite for ACK 0
therefore it will assume that the receiver didn’t receive packet correctly and it will send the packet 0
again. But now receiver has already moved to the next state in which it is waiting for packet 1. So the
receiver will discard the packet 0 and send a NAK for the packet. In this way, there is a deadlock because
sender will send packet 0 again after receiving NAK while the server will keep sending NAK.
9. Assuming the window size=w kbits
Ttrans=w/c=wkbits/109bits/sec=w*10-6sec
Tprop=15msec=0.015sec
With the last bit of the packet emerging at the receiver at
T1=Ttrans+Tprop=(w*10-6+0.015)sec
Since the last bit of the ACK packet emerges back at the sender at
T2=T1+0.015+8*10-6=(w+8)*10-6+0.03
Usender=w*10-6/((w+3)*10-6+0.03)=90/100
w=72+27000=27072
1
Standard answer:
Util = 90/100 = (0.008*n)/30.016
N= 3377 packets
N, window size or packets.
12. FSM of A
rdt_send(data)
compute chksum
make_pkt(sndpkt,B,0,data,chksum)
make_pkt(sndpkt,C,0,data,chksum)
udt_send(sndpkt,B)
udt_send(sndpkt,C)
rdt_rcv(rcvpkt,B)&&
rdt_rcv(rcvpkt,C)
Wait for
call from
above 0
Wait
ACK0
[rdt_rcv(rcvpkt,B)&&
(corrupt(rcvpkt,B )//
isACK(rcvpkt,B,1))]//
[rdt_rcv(rcvpkt,C)&&
(corrupt(rcvpkt,C)//
isACK(rcvpkt,C,1))]
timeout
udt_send(sndpkt,B)&&
udt_send(sndpkt,C)
start_timer
[rdt_rcv(rcvpkt,B)&&
notcorrupt(rcvpkt,B)&&
isACK(rcvpkt,B,1)]&&
[rdt_rcv(rcvpkt,C)&&
notcorrupt(rcvpkt,C)&&
isACK(rcvpkt,C,1)]
timeout
udt_send(sndpkt,B)&&
udt_send(sndpkt,C)
start_timer
[rdt_rcv(rcvpkt,B)&&
(corrupt(rcvpkt,B )//
isACK(rcvpkt,B,0))]//
[rdt_rcv(rcvpkt,C)&&
[rdt_rcv(rcvpkt,B)&&
notcorrupt(rcvpkt,B)&&
isACK(rcvpkt,B,0)]&&
[rdt_rcv(rcvpkt,C)&&
notcorrupt(rcvpkt,C)&&
isACK(rcvpkt,C,0)]
rdt_rcv(rcvpkt,B)&&
rdt_rcv(rcvpkt,C)
Wait
ACK1
Wait for
call from
above 1
2
(corrupt(rcvpkt,C)//
isACK(rcvpkt,C,0))]
rdt_send(data)
compute chksum
make_pkt(sndpkt,B,1,data,chksum)
make_pkt(sndpkt,C,1,data,chksum)
udt_send(sndpkt,B)
udt_send(sndpkt,C)
FSM of C
rdt_rcv(rcvpkt,C)
&& notcorrupt(rcvpkt,C)
&& has_seq0(rcvpkt,C)
extract(rcvpkt,C,data)
deliver_data(data)
compute chksum
make_pkt(sendpkt,C,ACK,chksum)
udt_send(sndpkt,C)
rdt_rcv(rcvpkt,C)
&& corrupt(rcvpkt,C)
rdt_rcv(rcvpkt)
&& corrupt(rcvpkt)
compute chksum
make_pkt(sndpkt,C,
NAK,chksum)
udt_send(sndpkt,C)
compute chksum
make_pkt(sndpkt,C,
NAK,chksum)
udt_send(sndpkt,C)
Wait for
0 from
below
Wait for
1 from
below
rdt_rcv(rcvpkt,C)
&& notcorrupt(rcvpkt,C)
&& has_seq1(rcvpkt,C)
compute chksum
make_pkt(sndpkt,C,
ACK,chksum)
udt_send(sndpkt,C)
rdt_rcv(rcvpkt,C)
&& notcorrupt(rcvpkt,C)
&& has_seq0(rcvpkt,C)
rdt_rcv(rcvpkt,C)
&& notcorrupt(rcvpkt,C)
&& has_seq1(rcvpkt,C)
compute chksum
make_pkt(sndpkt,C,
ACK,chksum)
udt_send(sndpkt,C)
extract(rcvpkt,C,data)
deliver_data(data)
compute chksum
make_pkt(sendpkt,C,ACK,chksum)
udt_send(sndpkt,C)
The packet format is (sndpkt,X,Y,data,chksum). X equals B or C. Y equals 0 or 1.
3
Hint: broadcast channel connection is from A to B and C using the same packet
number. If one of B and C lost or ACK in wrong, A have to resend again to both
using the same packet number.
Q12, answer from one of examples: sender A
rdt_rec(rcvpkt)&&(notcorrupt(rcvpkt)
&&(seqnum=x)&&isACK(rcypkt,B))
udt_send(sndpkt)
seqnum=x+1
rdt_send (data)
compute checksum
make_pkt(sndpkt,x,data,checksum)
udt_send(sndpkt)
Wait for
ACK
from B
rdt_rec(rcvpkt)&&(corrupt(rcvpkt)||isNAK(rcypkt,B))
Wait for
call from
above
Wait for
ACK from B
and C
(seqnum=x)
rdt_rec(rcvpkt)&&(corrupt(rcvpkt)||isNAK(rcypkt,C))
Wait for
ACK
from C
rdt_rcv(rcvpkt)&&
(isACK(rcvpkt,B)&&isACK(rcvpkt,C))
rdt_rcv(rcvpkt)&&
((isNAK(rcvpkt,B)&&
(isNAK(rcvpkt,C))
udt_send(sndpkt)
rdt_rec(rcvpkt)&&(notcorrupt(rcvpkt)
&&(seqnum=x)&&isACK(rcypkt,C))
udt_send(sndpkt)
seqnum=x+1
receiver B or C the same state:
rdt_rcv(rcvpkt)&&(corrupt(rcvpkt))
udt_send(sndpkt,x,NAK,C)
rdt_rcv(rcvpkt)&&(notcorrupt(rcvpkt)
&&(seqnum=x+1)
udt_send(sndpkt,x,NAK,C)
Wait for
call from
below
(seqnum=x
))
rdt_rcv(rcvpkt)&&(notcorrupt(rcvpkt)
&&(seqnum=x))
extract(rcvpkt,data)
deliver_data(data)
udt_send(sndpkt,x,ACK,C)
udt_send(sndpkt,ACK,C))
Another example: almost correct :????
13a. At time t, the possible sets of sequence numbers inside the sender’s window are
4
{k-3,k-2,k-1}, {k-2,k-1,k}, {k-1,k,k+1},{k,k+1,k+2}. Because at time t, the next
in-order packet that the receiver is expecting has a sequence number of k, that
means, the receiver has received the packet k-3, k-2, k-1. Since the sender window
size is 3, there are four conditions inside the sender’s window:
<1>Packets k-3, k-2, k-1 have been sent but not yet acknowledged, the sequence
numbers inside the sender’s window are k-3, k-2, k-1
<2>Packet k-3 has been acknowledged, packets k-2,k-1 have not yet been
acknowledged. k is the next packet to be sent and is inside the sender’s
window. The sequence numbers inside the sender’s window are k-2, k-1,k
<3>Packets k-3, k-2 have been acknowledged, k-1 has not yet been acknowledged.
k, k+1 are the packets to be sent and are inside the sender’s window. The
sequence numbers inside the sender’s window are k-1, k, k+1
<4>Packets k-3, k-2 , k-1 have all been acknowledged, k, k+1, k+2 are the packets
to be sent and are inside the sender’s window. The sequence numbers inside
the sender’s window are k, k+1, k+2
hint Answer:
k-3 k-2 k-1 k k+1 k+2
k-3 k-2 k-1
k-2 k-1 k
k-1 k k+1
k k+1 k+2
b. The possible values of ACK field in the message currently propagating back to the
sender at time t is k-3, k-2, k-1. There are three conditions:
<1>Packets k-3, k-2, k-1 have been sent but not yet acknowledged, the ACK field
is k-3.
<2>Packets k-2, k-1 have been sent but not yet acknowledged, ACK field is k-2.
<3>Packet k-1 has been sent but not yet acknowledged, the ACK field is k-1.
17a. Since the TCP sequence number field has four bytes, each byte has 8 bits, there 32
bits in all. The maximum value of L=232bit
b. There are L/MSS=232/1460*8 segments, each segment add 66 bytes header.
The total length of the resulting file = (232+8*66*229/1460) bit
The time elapse to transmit the file = 232(1+66/1460)/(10*106)=448.92 sec
Hunt: T = (L + H)/R
Packets: 232/1460
L = 8*232
H = (66*232/1460)*8
R = 107
21a. The loss rate L=[MSS/(w/2+1)RTT]/0.75wMSS/RTT
=1/[(w/2+1)3w/4]
=1/(3w2/8+3w/4)
5
L=8/3w2
w2=8/3L w=sqrt(8/3L)
The average bandwidth of connection =0.75wMSS/RTT
=(3/4)sqrt(8/3L)MSS/RTT
=1.22MSS/[RTT*sqrt(L)]
So the average bandwidth is approximately given by:
Average bandwidth of connection ~ 1.22MSS/[RTT*sqrt(L)]
b. From a, if we ignore 3w/4:
22
. From the formula Latency = 2RTT+O/R+(K-1)[S/R+RTT-WS/R]+
when S/R+RTT-WS/R=0 , the lantency is the smallest
a. Lantency=2RTT+O/R=2*100*10-3+100*8/28=28.8sec
As R=28Kbps, W=(R/S)RTT+1=[(28*103)/(536*8)]*100*10-3+1=2
b. As R=100Kbps, W=(R/S)RTT+1=[(100*103)/(536*8)]*100*10-3+1=4
c. As R=1Mbps, W=(R/S)RTT+1=[106/(536*8)]*100*10-3+1=25
d. As R=10Mbps, W=(R/S)RTT+1=[107/(536*8)]*100*10-3+1=235
Answer:
Problem 22:
a.
The minimum possible latency
2 RTT O / R
2 0.1
100 10 3 8
28.77 sec ond
28 10 3
The minimum window size W that achieves this latency
WS / R RTT S / R
WS S
S (W 1)
RTT
RTT
R R
R
536 (W 1) 8
0.1 0.15(W 1) 0.1
28 10 3
W 1 0.66 W 1.66
Because the W is an integer, so the minimum W=2.
b.
The minimum possible latency
6
2 RTT O / R
2 0.1
100 10 3 8
8.2 sec onds
100 10 3
The minimum window size W that achieves this latency
WS / R RTT S / R
WS S
S (W 1)
RTT
RTT
R R
R
536 (W 1) 8
0.1 0.042(W 1) 0.1
100 10 3
W 1 2.38 W 3.38
Because the W is an integer, so the minimum W =4.
c.
The minimum possible latency
2 RTT O / R
2 0.1
100 10 3 8
1sec onds
1 10 6
The minimum window size W that achieves this latency
WS / R RTT S / R
WS S
S (W 1)
RTT
RTT
R R
R
536 (W 1) 8
0.1 0.0042(W 1) 0.1
1 10 6
W 1 23.80 W 24.80
Because the W is an integer, so the minimum W=25.
d.
The minimum possible latency
2 RTT O / R
2 0.1
100 10 3 8
0.28 sec onds
10 10 6
Because the W is an integer, so the minimum W=235
7
Rate
Minimum Latency (sec)
28 Kbps
100 Kbps
1 Mbps
10 Mbps
28.77
8.2
1
.28
Window Size (rounded to the
nearest integer)
2
4
26
245
23a. K=min{k: 30+31+…+3k-1>O/S}
=min{k: 3k-1>O/S}
=min{k:k>log3(O/S+1)}
=[log3(O/S+1)]
b. Q=max{k:RTT+S/R-(S/R)3 k-1.0}
=max{k:3k-1<1+RTT/(S/R)}
=max{k:k<log3(1+RTT/(S/R))+1}
=[log3(1+RTT/(S/R))]+1
c. Latency=O/R+2RTT+ (RTT+S/R-(S/R)3k-1)
3 k-1=3p-1
Lantency=2RTT+O/R+P{RTT+S/R]-(3p-1)S/R
Answer
Lantency=2RTT+O/R+P{RTT+S/R]-(3p-1)/2*S/R
28a. With persistent HTTP, every object is transferred with pipeline
The three-way-handshaking takes time 2RTT,
The transfer time is RTT,
The transmission time of M+1 objects is (M+1)O/R
The response time = (M+1)O/R+2RTT+RTT+lantency due to slow start
= (M+1)O/R+3RTT+ latency due to slow start
nonpersistent : (M+1)*2RTT
b. K’=min{k’: 20+21+…2k’-1>(M+1)O/S}
=min{k’:2k’-1>(M+1)O/S}
=min{k’:k’>log2((M+1_)O/S+1)}=[log2((M+1)O/S+1)]
Latency=2RTT+O/R+ [S/R+RTT-2k’-1S/R]+
= 2RTT+ O/R+ (RTT+S/R-(S/R)2k’-1)
=2RTT+ O/R+P’[RTT+S/R]-(2p’-1)S/R
Since the sever can send the images without waiting for the formal request
for the images from the client,
Approx response time = (MO/R)+Latency
= 2RTT+(M+1)O/R+P’[RTT+S/R]-(2p’-1)S/R
8
Hunt: send the images without waiting for the formal request; the last window of
the initial objects is full
c. Because the server must wait for a request for the images before sending the
images
the latency due to slow-start = P’[RTT+S/R]-(2p’-1)S/R-[S/R+RTT-(S/R)2k-1]+
Response time = (M+1)O/R+3RTT+ latency due to slow-start
= 3RTT+(M+1)O/R+ P’[RTT+S/R]-(2p’-1)S/R-[S/R+RTT-(S/R)2k-1]+
Hunt: server must wait for a request, so it need one more RTT, then minus [S/R+RTT-(S/R)2k-1]+
9