CSCi$4211(Spring$2015$ Homework$#2$Solution$ 1.$(10$pt)$ a)

1.$(10$pt)$
a)$
CSCi$4211(Spring$2015$
Homework$#2$Solution$
$
$
b)# 2"# − 6000 /(4×1024×1024( = (1024(-./.#
#
Attention:(
(1)$If$you$solved$b)$like$this:((2"# − 6000)(/(4×1000×1000( = (1073.74(sec,$you$
need$to$pay$attention$here.$$
In$general,$1K$is$accepted$as$2"# $or$10" .$So,$you$may$choose$either$one.$However,$
you$should$not$use$one$together$with$the$other$one.$For$instance,$if$you$choose$
2"# ,$you$have$to$choose$2#8 $or$1024×1024$for$1M,$not$109 .$Similarly,$if$you$
choose$10" $for$1K,$you$must$use$109 $for$1M.$This$rule$is$also$directly$applicable$
to$Question$2.$You$must$choose$one,$and$never$mix$them.$Many$of$students$made$
this$kind$of$mistake.$
(2)$Some$students$took$(2"# − 1 − 6000)$instead$of$(2"# − 6000).$You$should$
take$into$account$the$last$change,$which$is$from$2"# − 1$to$0.$
$
$
$
2.$(10$pt)$
$a)$Stop(and(Wait:$1$packet$transmission$time$=$1024$/$(4×1024×1024),$RTT$=$
0.04.$Therefore,$maximum$transmission$rate$=$1024$/${1024/(4×1024×1024)$+$
0.04}$=$25444.7$bps$$
$
Note$that$RTT$is$from$the$end$of$the$transmission$of$the$first$packet$to$the$
receive$of$ACK$
$
GBN$and$SR:$Without$error,$maximum$transmission$rate$of$GBN$is$equal$to$that$
of$SR.$If$a$window$size$is$big$enough$to$transmit$packets$without$waiting$for$the$
ACK$form$a$receiver,$we$can$use$the$channel$fully.$Therefore,$maximum$
transmission$rate$=$bandwidth$=$4Mbps$$
$
Note$that,$“bps”$stands$for$“bit$per$second”.$It$is$different$from$“byte$per$second”$
in$Problem$1$
$
b)$The$minimum$window$size$to$achieve$maximum$transmission$rate$=$(the$total$
time$to$get$ACK$from$a$receiver$since$the$senders$have$started$to$transmit$the$
first$packet)$/$(1$packet$transmission$time).$$
$
W$=$Ceiling$[${1024/(4×1024×1024)$+$0.04}/{1024/(4×1024×1024)}$]$=$165$
packets$(Note$that$RTT$is$from$the$end$of$first$pkt$to$the$start$of$ACK)$
$
c)$GBN:$Since$sequence$number$must$be$bigger$than$at$least$the$total$window$
size$of$sender$and$receiver$$(W$+$1),$2: $<$W+1$<$2; .$Thus$8$bits$are$required.$$
$
SR:$The$sequence$number$must$be$bigger$than$at$least$the$total$window$size$of$
sender$and$receiver$$(W$+$W).$The$#$of$sequence$number$=$window$size$×$2$=$
330$since$the$window$size$of$SR$is$equal$to$that$of$GBN.$2; $<$2W$<2< .$Thus$9$bits$
are$required.$$
$
Note$that$some$students$mistaken$GBN$seq$#$with$TCP$seq$#.$In$GBN,$every$
packet$has$a$seq$#,$while$in$TCP,$every$byte$has$a$seq$#.$
$
d)$Stop(and(Wait:$The$4th$packet$needs$to$be$retransmitted.$$
$
GBN:$Assuming$window$size$is$W,$all$packets$from$4th$to$end$of$the$window$
must$be$retransmitted.$$
$
SR:$Only$the$4th$packet$needs$to$be$retransmitted.$
$
$
$
3.(10$pt)$
$
RTT#$
1$ 2$
Congwin$ 2$ 4$
Threshold$ 32$ 32$
$
RTT#$
17! 18$
Congwin$ 4$
8$
Threshold$ 9$
9$
$
Alternative,$$
RTT#$
1$ 2$
Congwin$ 2$ 4$
Threshold$ 32$ 32$
$
RTT#$
17! 18$
Congwin$ 4$
8$
Threshold$ 17$ 17$
$
$
3$ 4$ 5! 6$ 7! 8$ 9$ 10$ 11!
8$ 16$ 32$ 33$ 34$ 1$ 2$ 4$ 8$
32$ 32$ 32$ 32$ 32$ 17$ 17$ 17$ 17$
19$ 20$ 21$ 22$ 23$
9$ 10$ 11$ 1$ 2$
9$ 9$ 9$ 6$ 6$
24$
4$
6$
25$
6$
6$
26$ 27$
7$ 8$
6$ 6$
3$ 4$ 5! 6$ 7! 8$ 9$ 10$ 11!
8$ 16$ 32$ 33$ 34$ 1$ 2$ 4$ 8$
32$ 32$ 32$ 32$ 32$ 17$ 17$ 17$ 17$
19$ 20$ 21$ 22$ 23$
16$ 32$ 33$ 1$ 2$
17$ 17$ 17$ 17$ 17$
$
24$
4$
17$
25$
8$
17$
12$ 13$ 14! 15$ 16$
16$ 17$ 18$ 1$ 2$
17$ 17$ 17$ 9$ 9$
28!
9$
6$
29$
1$
5$
30$
2$
5$
12$ 13$ 14! 15$ 16$
16$ 32$ 33$ 1$ 2$
17$ 17$ 17$ 17$ 17$
26$ 27$
16$ 32$
17$ 17$
28!
33$
17$
29$
1$
17$
30$
2$
17$
4.$
a)$$
Dijkstra$Algorithm$
Start$
A$
E$
3,!E!
AE$
$
BAE$
!
CBAE$
$
DCBAE$
$
FDCBAE$
$
$
Spanning$Tree$
B$
∞$
4,!A!
$
$
$
$
$
Routing$table$in$E$
Destination$
$
$
$
D$
5,$E$
5,$E$
5,$E$
5,!E!
$
$
F$
∞$
5,$A$
5,$A$
5,$A$
5,!A!
$
$
Routing$table$in$E$
Destination$
A$
B$
C$
D$
F$
$
$
b)$
Distance$table$in$E$
E$
A$
B$
C$
D$
F$
C$
∞$
4,$A$
4,!A!
Next$Hop$
A$
A$
A$
D$
A$
A$
3!
4!
4$
7$
5!
Cost$
3$
4$
4$
5$
5$
Cost$to$destination$via$
D$
9$
10$
9$
5$
7$
Next$Hop$
$
!
$
$
$
$
Cost$
A$
A$
B$
A$
C$
A$
D$
D$
F$
A$
E$to$A$through$D$is$9$because$we$have$path$E(D(F(A$
$
$
$
3$
4$
4$
5$
5$
5.$a)$
Option#1:##
First#apply#Dijkstra’s#algorithm#as#usual#to#obtain#the#shortest#paths#for#every#node#in#
the#network.#Now,#using#the#table#constructed,#trace#the#path#for#every#destination#
node#and#construct#a#list#of#nodes#for#each#destination#node#that#have#to#be#
traversed#along#the#path.#Next,#apply#the#Dijkstra’s#algorithm#again,#but#this#time#at#
every#update#step#check#if#the#edge#being#added#is#already#in#the#list#of#nodes#
obtained#for#that#destination#node#in#previous#step.#If#it#is#already#part#of#primary#
path,#discard#it#can#continue,#else#perform#usual#update.##
Option#2:##
First#apply#Dijkstra’s#algorithm#as#usual#to#obtain#the#shortest#paths#for#every#node#in#
the#network.#Now,#for#every#edge#in#the#graph#that#belongs#to#the#spanning#tree,#
assign#a#cost#of#infinity.#Run#the#Dijkstra’s#algorithm#on#this#modified#graph.#
#
Attention:(
Here#we#assume#the#network#is#so#large#that#the#second#always#exists#when#we#
apply#the#Dijkstra’s#algorithm#again.#In#the#other#words,#the#choice#of#the#first#path#
from#the#source#to#the#destination#doesn’t#influence#the#existence#of#the#second#
path.##
For#precise#algorithm#of#finding#two#disjoint#paths,#refer#to#Suurballe’s#algorithm:#
http://en.wikipedia.org/wiki/Suurballe%27s_algorithm#
#
b)#
In#Distance#Vector#Routing,#no#single#node#has#the#picture#of#the#entire#network.#
Topology#information#is#distributed.#Each#node#exchanges#information#only#with#its#
directly#connected#neighbors.#Hence,#it#is#impossible#to#find#disjoint#paths#given#that#
complete#path#information#is#not#available#at#a#single#point.##