SOLUTIONS TO CHAPTER 1 PROBLEMS 1. The dog can carry 21 gigabytes, or 16 gigabits! " s#eed o$ 1 %&'ho(r e)(a*s +!++, %&'sec! The ti&e to tra-e* distance x %& is x '+!++, =2+0x sec, yie*ding a data rate o$ 168/ 2+0x .b#s or /0/x Mb#s! 0or x 1,!6 %&, the dog has a higher rate than the co&&(nication *ine! 2. The L"N &ode* can be gro2n incre&enta**y! I$ the L"N is 3(st a *ong cab*e! it cannot be bro(ght do2n by a sing*e $ai*(re 4i$ the ser-ers are re#*icated5 It is #robab*y chea#er! It #ro-ides &ore co&#(ting #o2er and better interacti-e inter$aces! 3. " transcontinenta* $iber *in% &ight ha-e &any gigabits'sec o$ band2idth, b(t the *atency 2i** a*so be high d(e to the s#eed o$ *ight #ro#agation o-er tho(sands o$ %i*o&eters! In contrast, a ,66%b#s &ode& ca**ing a co&#(ter in the sa&e b(i*ding has *o2 band2idth and *o2 *atency! 4. " (ni$or& de*i-ery ti&e is needed $or -oice, so the a&o(nt o$ 3itter in the net62or% is i&#ortant! This co(*d be e7#ressed as the standard de-iation o$ the de*i-ery ti&e! 8a-ing short de*ay b(t *arge -ariabi*ity is act(a**y 2orse than a so&e2hat *onger de*ay and *o2 -ariabi*ity! 5. No! The s#eed o$ #ro#agation is 2++,+++ %&'sec or 2++ &eters'9sec! In 1+ 9sec the signa* tra-e*s 2 %&! Th(s, each s2itch adds the e)(i-a*ent o$ 2 %& o$ e7tra cab*e! I$ the c*ient and ser-er are se#arated by ,+++ %&, tra-ersing e-en ,+ s2itches adds on*y 1++ %& to the tota* #ath, 2hich is on*y 2:! Th(s, s2itching de*ay is not a &a3or $actor (nder these circ(&stances! 6. The re)(est has to go (# and do2n, and the res#onse has to go (# and do2n! The tota* #ath *ength tra-ersed is th(s 16+,+++ %&! The s#eed o$ *ight in air and -ac((& is ;++,+++ %&'sec, so the #ro#agation de*ay a*one is 16+,+++';++,+++ sec or abo(t ,;; &sec! 7. There is ob-io(s*y no sing*e correct ans2er here, b(t the $o**o2ing #oints see& re*e-ant! The #resent syste& has a great dea* o$ inertia 4chec%s and ba*6ances5 b(i*t into it! This inertia &ay ser-e to %ee# the *ega*, econo&ic, and socia* syste&s $ro& being t(rned (#side do2n e-ery ti&e a di$$erent #arty co&es to #o2er! "*so, &any #eo#*e ho*d strong o#inions on contro-ersia* socia* iss(es, 2itho(t rea**y %no2ing the $acts o$ the &atter! "**o2ing #oor*y reasoned o#inions be to 2ritten into *a2 &ay be (ndesirab*e! The #otentia* e$$ects o$ ad-ertising ca&#aigns by s#ecia* interest gro(#s o$ one %ind or another a*so ha-e to be considered! "nother &a3or iss(e is sec(rity! " *ot o$ #eo#*e &ight 2orry abo(t so&e 1/6year %id hac%ing the syste& and $a*si$ying the res(*ts!
2 PROBLEM SOLUTIONS 0OR <8"PTER 1
8. <a** the ro(ters ", B, <, =, and E. There are ten #otentia* *ines> AB, A<, A=, AE, B<, B=, BE, C=, CE, and DE! Each o$ these has $o(r #ossibi*ities 4three s#eeds or no *ine5, so the tota* n(&ber o$ to#o*ogies is / 1+ =1,+/ ,,?6. "t 1++ &s each, it ta%es 1+/, ,?!6 sec, or s*ight*y &ore than 2@ ho(rs to ins#ect the& a**! 9. The &ean ro(ter6ro(ter #ath is t2ice the &ean ro(ter6root #ath! N(&ber the *e-e*s o$ the tree 2ith the root as 1 and the dee#est *e-e* as n. The #ath $ro& the root to *e-e* n re)(ires n −1 ho#s, and +!,+ o$ the ro(ters are at this *e-e*! The #ath $ro& the root to *e-e* n −1 has +!2, o$ the ro(ters and a *ength o$ n −2 ho#s! 8ence, the &ean #ath *ength, *, is gi-en by l =+!, ×(n −15 ++!2, ×(n −25 ++!12, ×(n −;5 +!!!
or l=
i =1 8
Σ Σ
n 4+!,5i −
i =1 8
i 4+!,5i This e7#ression red(ces to l =n −2. The &ean ro(ter6ro(ter #ath is th(s 2n −4. 10. =isting(ish n +2 e-ents! E-ents 1 thro(gh n consist o$ the corres#onding host s(ccess$(**y atte&#ting to (se the channe*, i!e!, 2itho(t a co**ision! The #robabi*ity o$ each o$ these e-ents is #41 −#5n −1 . E-ent n +1 is an id*e channe*, 2ith #robabi*ity 41 −#5n . E-ent n +2 is a co**ision! Since these n +2 e-ents are e7ha(sti-e, their #robabi*ities &(st s(& to (nity! The #roba6bi*ity o$ a co**ision, 2hich is e)(a* to the $raction o$ s*ots 2asted, is then 3(st 1 −n#41 −#5n −1 −41 −#5n . 11. "&ong other reasons $or (sing *ayered #rotoco*s, (sing the& *eads to brea%6ing (# the design #rob*e& into s&a**er, &ore &anageab*e #ieces, and *ayering &eans that #rotoco*s can be changed 2itho(t a$$ecting higher or *o2er ones, 12. No! In the ISO #rotoco* &ode*, #hysica* co&&(nication ta%es #*ace on*y in the *o2est *ayer, not in e-ery *ayer! 13. <onnection6oriented co&&(nication has three #hases! In the estab*ish&ent #hase a re)(est is &ade to set (# a connection! On*y a$ter this #hase has been s(ccess$(**y co&#*eted can the data trans$er #hase be started and data trans6#orted! Then co&es the re*ease #hase! <onnection*ess co&&(nication does not ha-e these #hases! It 3(st sends the data! 14. Message and byte strea&s are di$$erent! In a &essage strea&, the net2or% %ee#s trac% o$ &essage bo(ndaries! In a byte strea&, it does not! 0or e7a&6#*e, s(##ose a #rocess 2rites 1+2/ bytes to a connection and then a *itt*e *ater 2rites another 1+2/ bytes! The recei-er then does a read $or 2+/ bytes! Aith a &essage strea&, the recei-er 2i** get t2o &essages, o$ 1+2/ bytes
PROBLEM SOLUTIONS 0OR <8"PTER 1 3
each! Aith a byte strea&, the &essage bo(ndaries do not co(nt and the recei-er 2i** get the $(** 2+/ bytes as a sing*e (nit! The $act that there 2ere origina**y t2o distinct &essages is *ost! 15. Negotiation has to do 2ith getting both sides to agree on so&e #ara&eters or -a*(es to be (sed d(ring the co&&(nication! Ma7i&(& #ac%et siBe is one e7a&#*e, b(t there are &any others! 16. The ser-ice sho2n is the ser-ice o$$ered by *ayer k to *ayer k +1! "nother ser-ice that &(st be #resent is be*o2 *ayer %, na&e*y, the ser-ice o$$ered to *ayer k by the (nder*ying *ayer k −1! 17. The #robabi*ity, P k , o$ a $ra&e re)(iring e7act*y k trans&issions is the #roba6bi*ity o$ the $irst k −1 atte&#ts $ai*ing, p k −1 , ti&es the #robabi*ity o$ the %6th trans&ission s(cceeding, 41 −#). The &ean n(&ber o$ trans&ission is then 3(st
k =1
Σ
8
kP k =
k =1 8
Σ
%41 −#5p k −1 =1 −p 1 33333 18. 4a5 =ata *in% *ayer! 4b5 Net2or% *ayer! 19. 0ra&es enca#s(*ate #ac%ets! Ahen a #ac%et arri-es at the data *in% *ayer, the entire thing, header, data, and a**, is (sed as the data $ie*d o$ a $ra&e! The entire #ac%et is #(t in an en-e*o#e 4the $ra&e5, so to s#ea% 4ass(&ing it $its5! 20. Aith n *ayers and h bytes added #er *ayer, the tota* n(&ber o$ header bytes #er &essage is hn, so the s#ace 2asted on headers is hn! The tota* &essage siBe is M +nh, so the $raction o$ band2idth 2asted on headers is hn / (M +hn5! 21. Both &ode*s are based on *ayered #rotoco*s! Both ha-e a net2or%, trans#ort, and a##*ication *ayer! In both &ode*s, the trans#ort ser-ice can #ro-ide a re*iab*e end6to6end byte strea&! On the other hand, they di$$er in se-era* 2ays! The n(&ber o$ *ayers is di$$erent, the T<P'IP does not ha-e session or #resentation *ayers, OSI does not s(##ort internet2or%ing, and OSI has both connection6oriented and connection*ess ser-ice in the net2or% *ayer! 22. T<P is connection oriented, 2hereas U=P is a connection*ess ser-ice! 23. The t2o nodes in the (##er6rPROBLEM SOLUTIONS 0OR <8"PTER 1 3 each! Aith a byte strea&, the &essage bo(ndaries do not co(nt and the recei-er 2i** get the $(** 2+/ bytes as a sing*e (nit! The $act that there 2ere origina**y t2o distinct &essages is *ost! 15. Negotiation has to do 2ith getting both sides to agree on so&e #ara&eters or -a*(es to be (sed d(ring the co&&(nication! Ma7i&(& #ac%et siBe is one e7a&#*e, b(t there are &any others! 16. The ser-ice sho2n is the ser-ice o$$ered by *ayer k to *ayer k +1! "nother ser-ice that &(st be #resent is be*o2 *ayer %, na&e*y, the ser-ice o$$ered to *ayer k by the (nder*ying *ayer k −1! 17. The #robabi*ity, P k , o$ a $ra&e re)(iring e7act*y k trans&issions is the #roba6bi*ity o$ the $irst k −1 atte&#ts $ai*ing, p k −1 , ti&es the #robabi*ity o$ the %6th trans&ission s(cceeding, 41 −#). The &ean n(&ber o$ trans&ission is then 3(st
k =1 8
Σ Σ
kP k =
k =1 8
%41 −#5p k −1 =1 −p 1 33333 18. 4a5 =ata *in% *ayer! 4b5 Net2or% *ayer! 19. 0ra&es enca#s(*ate #ac%ets! Ahen a #ac%et arri-es at the data *in% *ayer, the entire thing, header, data, and a**, is (sed as the data $ie*d o$ a $ra&e! The entire #ac%et is #(t in an en-e*o#e 4the $ra&e5, so to s#ea% 4ass(&ing it $its5! 20. Aith n *ayers and h bytes added #er *ayer, the tota* n(&ber o$ header bytes #er &essage is hn, so the s#ace 2asted on headers is hn! The tota* &essage
siBe is M +nh, so the $raction o$ band2idth 2asted on headers is hn / (M +hn5! 21. Both &ode*s are based on *ayered #rotoco*s! Both ha-e a net2or%, trans#ort, and a##*ication *ayer! In both &ode*s, the trans#ort ser-ice can #ro-ide a re*iab*e end6to6end byte strea&! On the other hand, they di$$er in se-era* 2ays! The n(&ber o$ *ayers is di$$erent, the T<P'IP does not ha-e session or #resentation *ayers, OSI does not s(##ort internet2or%ing, and OSI has both connection6oriented and connection*ess ser-ice in the net2or% *ayer! 22. T<P is connection oriented, 2hereas U=P is a connection*ess ser-ice! 23. The t2o nodes in the (##er6right corner can be disconnected $ro& the rest by three bo&bs %noc%ing o(t the three nodes to 2hich they are connected! The syste& can 2ithstand the *oss o$ any t2o nodes! 24. =o(b*ing e-ery 1 &onths &eans a $actor o$ $o(r gain in ; years! In @ years, the gain is then / ; or 6/, *eading to 6!/ bi**ion hosts! My int(ition says that is &(ch too conser-ati-e, since by then #robab*y e-ery te*e-ision in the 2or*d and #ossib*y bi**ions o$ other a##*iances 2i** be on ho&e L"Ns connected toight corner can be disconnected $ro& the rest by three bo&bs %noc%ing o(t the three nodes to 2hich they are connected! The syste& can 2ithstand the *oss o$ any t2o nodes! 24. =o(b*ing e-ery 1 &onths &eans a $actor o$ $o(r gain in ; years! In @ years, the gain is then / ; or 6/, *eading to 6!/ bi**ion hosts! My int(ition says that is &(ch too conser-ati-e, since by then #robab*y e-ery te*e-ision in the 2or*d and #ossib*y bi**ions o$ other a##*iances 2i** be on ho&e L"Ns connected to
PROBLEM SOLUTIONS 0OR <8"PTER 1 3
each! Aith a byte strea&, the &essage bo(ndaries do not co(nt and the recei-er 2i** get the $(** 2+/ bytes as a sing*e (nit! The $act that there 2ere origina**y t2o distinct &essages is *ost! 15. Negotiation has to do 2ith getting both sides to agree on so&e #ara&eters or -a*(es to be (sed d(ring the co&&(nication! Ma7i&(& #ac%et siBe is one e7a&#*e, b(t there are &any others! 16. The ser-ice sho2n is the ser-ice o$$ered by *ayer k to *ayer k +1! "nother ser-ice that &(st be #resent is be*o2 *ayer %, na&e*y, the ser-ice o$$ered to *ayer k by the (nder*ying *ayer k −1! 17. The #robabi*ity, P k , o$ a $ra&e re)(iring e7act*y k trans&issions is the #roba6bi*ity o$ the $irst k −1 atte&#ts $ai*ing, p k −1 , ti&es the #robabi*ity o$ the %6th trans&ission s(cceeding, 41 −#). The &ean n(&ber o$ trans&ission is then 3(st
k =1 8
Σ Σ
kP k =
k =1 8
%41 −#5p k −1 =1 −p 1 33333 18. 4a5 =ata *in% *ayer! 4b5 Net2or% *ayer! 19. 0ra&es enca#s(*ate #ac%ets! Ahen a #ac%et arri-es at the data *in% *ayer, the entire thing, header, data, and a**, is (sed as the data $ie*d o$ a $ra&e! The entire #ac%et is #(t in an en-e*o#e 4the $ra&e5, so to s#ea% 4ass(&ing it $its5! 20. Aith n *ayers and h bytes added #er *ayer, the tota* n(&ber o$ header bytes
#er &essage is hn, so the s#ace 2asted on headers is hn! The tota* &essage siBe is M +nh, so the $raction o$ band2idth 2asted on headers is hn / (M +hn5! 21. Both &ode*s are based on *ayered #rotoco*s! Both ha-e a net2or%, trans#ort, and a##*ication *ayer! In both &ode*s, the trans#ort ser-ice can #ro-ide a re*iab*e end6to6end byte strea&! On the other hand, they di$$er in se-era* 2ays! The n(&ber o$ *ayers is di$$erent, the T<P'IP does not ha-e session or #resentation *ayers, OSI does not s(##ort internet2or%ing, and OSI has both connection6oriented and connection*ess ser-ice in the net2or% *ayer! 22. T<P is connection oriented, 2hereas U=P is a connection*ess ser-ice! 23. The t2o nodes in the (##er6right corner can be disconnected $ro& the rest by three bo&bs %noc%ing o(t the three nodes to 2hich they are connected! The syste& can 2ithstand the *oss o$ any t2o nodes! 24. =o(b*ing e-ery 1 &onths &eans a $actor o$ $o(r gain in ; years! In @ years, the gain is then / ; or 6/, *eading to 6!/ bi**ion hosts! My int(ition says that is &(ch too conser-ati-e, since by then #robab*y e-ery te*e-ision in the 2or*d and #ossib*y bi**ions o$ other a##*iances 2i** be on ho&e L"Ns connected to
4 PROBLEM SOLUTIONS 0OR <8"PTER 1
the Internet! The a-erage #erson in the de-e*o#ed 2or*d &ay ha-e doBens o$ Internet hosts by then! 25. I$ the net2or% tends to *ose #ac%ets, it is better to ac%no2*edge each one se#arate*y, so the *ost #ac%ets can be retrans&itted! On the other hand, i$ the net2or% is high*y re*iab*e, sending one ac%no2*edge&ent at the end o$ the entire trans$er sa-es band2idth in the nor&a* case 4b(t re)(ires the entire $i*e to be retrans&itted i$ e-en a sing*e #ac%et is *ost5! 26. S&a**, $i7ed6*ength ce**s can be ro(ted thro(gh s2itches )(ic%*y, and co&6#*ete*y in hard2are! S&a**, $i7ed6siBe ce**s a*so &a%e it easier to b(i*d hard2are that hand*es &any ce**s in #ara**e*! "*so, they do not b*oc% trans&ission *ines $or -ery *ong, &a%ing it easier to #ro-ide )(a*ity6o$6ser-ice g(arantees! 27. The s#eed o$ *ight in coa7 is abo(t 2++,+++ %&'sec, 2hich is 2++ &eters'9sec! "t 1+ Mb#s, it ta%es +!1 9sec to trans&it a bit! Th(s, the bit *asts +!1 9sec in ti&e, d(ring 2hich it #ro#agates 2+ &eters! Th(s, a bit is 2+ &eters *ong here! 28. The i&age is 1+2/ C?6 C; bytes or 2,;,@,2@6 bytes! This is 1 , ?/,;6 bits! "t ,6,+++ bits'sec, it ta%es abo(t ;;?!+/2 sec! "t 1,+++,+++ bits'sec, it ta%es abo(t 1 ! ?/ sec! "t 1+,+++,+++ bits'sec, it ta%es abo(t 1! ? sec! "t 1++,+++,+++ bits'sec, it ta%es abo(t +!1 @ sec! 29. Thin% abo(t the hidden ter&ina* #rob*e&! I&agine a 2ire*ess net2or% o$ $i-e stations, A thro(gh E, s(ch that each one is in range o$ on*y its i&&ediate neighbors! Then A can ta*% to B at the sa&e ti&e D is ta*%ing to E! Aire*ess net2or%s ha-e #otentia* #ara**e*is&, and in this 2ay di$$er $ro& Ethernet! 30. One disad-antage is sec(rity! E-ery rando& de*i-ery &an 2ho ha##ens to be in the b(i*ding can *isten in on the net2or%! "nother disad-antage is re*iabi*6ity! Aire*ess net2or%s &a%e *ots o$ errors! " third #otentia* #rob*e& is bat6tery *i$e, since &ost 2ire*ess de-ices tend to be &obi*e! 31. One ad-antage is that i$ e-eryone (ses the standard, e-eryone can ta*% to e-eryone! "nother ad-antage is that 2ides#read (se o$ any standard 2i** gi-e it econo&ies o$ sca*e, as 2ith DLSI chi#s! " disad-antage is that the #o*itica* co&#ro&ises necessary to achie-e standardiBation $re)(ent*y *ead to #oor
standards! "nother disad-antage is that once a standard has been 2ide*y ado#ted, it is di$$ic(*t to change,, e-en i$ ne2 and better techni)(es or ðods are disco-ered! "*so, by the ti&e it has been acce#ted, it &ay be obso*ete! 32. There are &any e7a&#*es, o$ co(rse! So&e syste&s $or 2hich there is inter6nationa* standardiBation inc*(de co&#act disc #*ayers and their discs, Aa*%6&an ta#e #*ayers and a(dio cassettes, ca&eras and ;,&& $i*&, and a(to&ated
PROBLEM SOLUTIONS 0OR <8"PTER 1 5
te**er &achines and ban% cards! "reas 2here s(ch internationa* standardiBa6tion is *ac%ing inc*(de D<Rs and -ideota#es 4NTS< D8S in the U!S!, P"L D8S in #arts o$ E(ro#e, SE<"M D8S in other co(ntries5, #ortab*e te*e6#hones, *a&#s and *ightb(*bs 4di$$erent -o*tages in di$$erent co(ntries5, e*ectr6ica* soc%ets and a##*iance #*(gs 4e-ery co(ntry does it di$$erent*y5, #hoto6co#iers and #a#er 4 !, 7 11 inches in the U!S!, "/ e-ery2here e*se5, n(ts and bo*ts 4Eng*ish -ers(s &etric #itch5, etc! SOLUTIONS TO CHAPTER 2 PROBLEMS 1. a n = π n −1 33 3 , b n =+, c =1. 2. " noise*ess channe* can carry an arbitrari*y *arge a&o(nt o$ in$or&ation, no &atter ho2 o$ten it is sa&#*ed! E(st send a *ot o$ data #er sa&#*e! 0or the / %8B channe*, &a%e +++ sa&#*es'sec! I$ each sa&#*e is 16 bits, the channe* can send 12 %b#s! I$ each sa&#*e is 1+2/ bits, the channe* can send !2 Mb#s! The %ey 2ord here is FF noise*ess!GG Aith a nor&a* / %8B channe*, the Shannon *i&it 2o(*d not a**o2 this! 3. Using the Ny)(ist theore&, 2e can sa&#*e 12 &i**ion ti&es'sec! 0o(r6*e-e* signa*s #ro-ide 2 bits #er sa&#*e, $or a tota* data rate o$ 2/ Mb#s! 4. " signa*6to6noise ratio o$ 2+ dB &eans S/N =1++! Since *og 2 1+1 is abo(t 6!6, , the Shannon *i&it is abo(t 1@!@?, %b#s! The Ny)(ist *i&it is 6 %b#s! The bott*enec% is there$ore the Ny)(ist *i&it, gi-ing a &a7i&(& channe* ca#acity o$ 6 %b#s! 5. To send a T1 signa* 2e need 8*og 2 41 +S /N5 =1!,// C1+ 6 2ith =,+,++0. This yie*ds S /Ν 2 ;+ −1, 2hich is abo(t @; dB! 6. " #assi-e star has no e*ectronics! The *ight $ro& one $iber i**(&inates a n(&ber o$ others! "n acti-e re#eater con-erts the o#tica* signa* to an e*ectri6ca* one $or $(rther #rocessing! 7. Use .! =χ . / . 2 2ith .. =1+ −? &eters and .=1+ −6 &eters! This gi-es a band2idth ($5 o$ ;+,+++ .8B! 8. The data rate is / + C6/+ C2/ C6+ b#s, 2hich is //2 Mb#s! 0or si&#*icity, *et (s ass(&e 1 b#s #er 8B! 0ro& E)! 426;5 2e get .. =. 2 .! /c! Ae ha-e .! =/!/2 C1+ ,sο . =2!, C1+ −6 &icrons! The range o$ 2a-e*engths (sed is -ery short! 9. The Ny)(ist theore& is a #ro#erty o$ &athe&atics and has nothing to do 2ith techno*ogy! It says that i$ yo( ha-e a $(nction 2hose 0o(rier s#ectr(& does not contain any sines or cosines abo-e $, then by sa&#*ing the $(nction at a
6 PROBLEM SOLUTIONS 0OR <8"PTER 2
$re)(ency o$ 2! yo( ca#t(re a** the in$or&ation there is! Th(s, the Ny)(ist theore& is tr(e $or a** &edia! 10. In the te7t it 2as stated that the band2idths 4i!e!, the $re)(ency ranges5 o$ the three bands 2ere a##ro7i&ate*y e)(a*! 0ro& the $or&(*a .! =χ . / . 2 ,it is
c*ear that to get a constant .$, the higher the $re)(ency, the *arger .. has to be! The 76a7is in the $ig(re is . , so the higher the $re)(ency, the &ore .. yo( need! In $act, .. is )(adratic in . ! The $act that the bands are a##ro7i6&ate*y e)(a* is an accidenta* #ro#erty o$ the %ind o$ si*icon (sed! 11. Start 2ith . ! =c! Ae %no2 that c is ; C1+ &'s! 0or .=1 c&, 2e get ;+ .8B! 0or .=, &, 2e get 6+ M8B! Th(s, the band co-ered is 6+ M8B to ;+ .8B! 12. "t 1 .8B, the 2a-es are ;+ c& *ong! I$ one 2a-e tra-e*s 1, c& &ore than the other, they 2i** arri-e o(t o$ #hase! The $act that the *in% is ,+ %& *ong is irre*e-ant! 13. I$ the bea& is o$$ by 1 && at the end, it &isses the detector! This a&o(nts to a triang*e 2ith base 1++ & and height +!++1 &! The ang*e is one 2hose tangent is th(s +!++++1! This ang*e is abo(t +!+++,? degrees! 14. Aith 66'6 or 11 sate**ites #er nec%*ace, e-ery @+ &in(tes 11 sate**ites #ass o-erhead! This &eans there is a transit e-ery /@1 seconds! Th(s, there 2i** be a hando$$ abo(t e-ery &in(tes and 11 seconds! 15. The sate**ite &o-es $ro& being direct*y o-erhead to2ard the so(thern hor6iBon, 2ith a &a7i&(& e7c(rsion $ro& the -ertica* o$ 2 ! It ta%es 2/ ho(rs to go $ro& direct*y o-erhead to &a7i&(& e7c(rsion and then bac%! 16. The n(&ber o$ area codes 2as C2 C1+, 2hich is 16+! The n(&ber o$ #re$i7es 2as C C1+, or 6/+! Th(s, the n(&ber o$ end o$$ices 2as *i&ited to 1+2,/++! This *i&it is not a #rob*e&! 17. Aith a 1+6digit te*e#hone n(&ber, there co(*d be 1+ 1+ n(&bers, a*tho(gh &any o$ the area codes are i**ega*, s(ch as +++! 8o2e-er, a &(ch tighter *i&it is gi-en by the n(&ber o$ end o$$ices! There are 22,+++ end o$$ices, each 2ith a &a7i&(& o$ 1+,+++ *ines! This gi-es a &a7i&(& o$ 22+ &i**ion te*e#hones! There is si&#*y no #*ace to connect &ore o$ the&! This co(*d ne-er be achie-ed in #ractice beca(se so&e end o$$ices are not $(**! "n end o$$ice in a s&a** to2n in Ayo&ing &ay not ha-e 1+,+++ c(sto&ers near it, so those *ines are 2asted! 18. Each te*e#hone &a%es +!, ca**s'ho(r at 6 &in(tes each! Th(s, a te*e#hone occ(#ies a circ(it $or ; &in(tes'ho(r! T2enty te*e#hones can share a circ(it, a*tho(gh ha-ing the *oad be c*ose to 1++: (.... 1 in )(e(eing ter&s5 i&#*ies -ery *ong 2ait ti&es5! Since 1+: o$ the ca**s are *ong distance, it ta%es 2++ te*e#hones to occ(#y a *ong6distance circ(it $(** ti&e! The intero$$ice tr(n%
PROBLEM SOLUTIONS 0OR <8"PTER 2 7
has 1,+++,+++'/+++ H 2,+ circ(its &(*ti#*e7ed onto it! Aith 2++ te*e#hones #er circ(it, an end o$$ice can s(##ort 2++ C2,+ =,+,+++ te*e#hones! 19. The cross6section o$ each strand o$ a t2isted #air is π / / s)(are &&! " 1+6%& *ength o$ this &ateria*, 2ith t2o strands #er #air has a -o*(&e o$ 2 / / C1+ −2 & ; ! This -o*(&e is abo(t 1,,?+ c& ; ! Aith a s#eci$ic gra-ity o$ @!+, each *oca* *oo# has a &ass o$ 1/1 %g! The #hone co&#any th(s o2ns 1!/ C1+ @ %g o$ co##er! "t ; do**ars each, the co##er is 2orth abo(t /!2 bi*6*ion do**ars! 20. Li%e a sing*e rai*road trac%, it is ha*$ d(#*e7! Oi* can $*o2 in either direction, b(t not both 2ays at once! 21. Traditiona**y, bits ha-e been sent o-er the *ine 2itho(t any error correcting sche&e in the #hysica* *ayer! The #resence o$ a <PU in each &ode& &a%es it #ossib*e to inc*(de an error correcting code in *ayer 1 to great*y red(ce the
e$$ecti-e error rate seen by *ayer 2! The error hand*ing by the &ode&s can be done tota**y trans#arent*y to *ayer 2! Many &ode&s no2 ha-e b(i*t in error correction! 22. There are $o(r *ega* -a*(es #er ba(d, so the bit rate is t2ice the ba(d rate! "t 12++ ba(d, the data rate is 2/++ b#s! 23. The #hase shi$t is a*2ays +, b(t t2o a&#*it(des are (sed, so this is straight a&#*it(de &od(*ation! 24. I$ a** the #oints are e)(idistant $ro& the origin, they a** ha-e the sa&e a&#*i6t(de, so a&#*it(de &od(*ation is not being (sed! 0re)(ency &od(*ation is ne-er (sed in conste**ation diagra&s, so the encoding is #(re #hase shi$t %ey6ing! 25. T2o, one $or (#strea& and one $or do2nstrea&! The &od(*ation sche&e itse*$ 3(st (ses a&#*it(de and #hase! The $re)(ency is not &od(*ated! 26. There are 2,6 channe*s in a**, &in(s 6 $or POTS and 2 $or contro*, *ea-ing 2/ $or data! I$ ;'/ o$ these are $or do2nstrea&, that gi-es 1 6 channe*s $or do2nstrea&! "=SL &od(*ation is at /+++ ba(d, so 2ith I"M66/ 46 bits'ba(d5 2e ha-e 2/,+++ b#s in each o$ the 1 6 channe*s! The tota* band2idth is then /!/6/ Mb#s do2nstrea&! 27. " ,6JB Aeb #age has /+,+++ bits! The do2n*oad ti&e o-er a ;6 Mb#s chan6ne* is 1!1 &sec! I$ the )(e(eing de*ay is a*so 1!1 &sec, the tota* ti&e is 2!2 &sec! O-er "=SL there is no )(e(eing de*ay, so the do2n*oad ti&e at 1 Mb#s is /+ &sec! "t ,6 %b#s it is ?1/ &sec! 28. There are ten /+++ 8B signa*s! Ae need nine g(ard bands to a-oid any inter$erence! The &ini&(& band2idth re)(ired is /+++ C1+ +/++ C@ H /;,6++ 8B!
8 PROBLEM SOLUTIONS 0OR <8"PTER 2
29. " sa&#*ing ti&e o$ 12, 9sec corres#onds to +++ sa&#*es #er second! "ccording to the Ny)(ist theore&, this is the sa&#*ing $re)(ency needed to ca#t(re a** the in$or&ation in a / %8B channe*, s(ch as a te*e#hone channe*! 4"ct(a**y the no&ina* band2idth is so&e2hat *ess, b(t the c(to$$ is not shar#!5 30. The end (sers get ? C2/ =16 o$ the 1@; bits in a $ra&e! The o-erhead is there$ore 2,'1@; H 1;:! 31. In both cases +++ sa&#*es'sec are #ossib*e! Aith dibit encoding, t2o bits are sent #er sa&#*e! Aith T1, ? bits are sent #er #eriod! The res#ecti-e data rates are 16 %b#s and ,6 %b#s! 32. Ten $ra&es! The #robabi*ity o$ so&e rando& #attern being +1+1+1+1+1 4on a digita* channe*5 is 1'1+2/! 33. " coder acce#ts an arbitrary ana*og signa* and generates a digita* signa* $ro& it! " de&od(*ator acce#ts a &od(*ated sine 2a-e on*y and generates a digita* signa*! 34. 4a5 6/ %b#s! 4b5 ;2 %b#s! 4c5 %b#s! 35. The signa* &(st go $ro& + to A in one )(arter o$ a 2a-eKthat is, in a ti&e " '4. In order to trac% the signa*, ste#s &(st $it into the )(arter 2a-e, or ;2 sa&#*es #er $(** 2a-e! The ti&e #er sa&#*e is 1/x so the $(** #eriod &(st be *ong eno(gh to contain ;2 sa&#*esKthat is, " L;2/x or ! &a7 =x ';2. 36. " dri$t rate o$ 1+ −@ &eans 1 second in 1+ @ seconds or 1 nsec #er second! "t O<61 s#eed, say, ,+ Mb#s, $or si&#*icity, a bit *asts $or 2+ nsec! This &eans it ta%es on*y 2+ seconds $or the c*oc% to dri$t o$$ by one bit! <onse)(ent*y, the c*oc%s &(st be contin(o(s*y synchroniBed to %ee# the& $ro& getting too $ar a#art! <ertain*y e-ery 1+ sec, #re$erab*y &(ch &ore o$ten!
37. O$ the @+ co*(&ns, 6 are a-ai*ab*e $or (ser data in O<61! Th(s, the (ser ca#acity is 6 C@ =??/ bytes'$ra&e! Aith bits'byte, +++ $ra&es'sec, and ; O<61 carriers &(*ti#*e7ed together, the tota* (ser ca#acity is ; C??/ C C +++, or 1/ !6+ Mb#s! 38. DT1!, can acco&&odate +++ $ra&es'sec C; co*(&ns C@ ro2s C bits H 1!?2 Mb#s! It can be (sed to acco&&odate =S61! DT2 can acco&&odate +++ $ra&es'sec C/ co*(&ns C@ ro2s C bits H 2!;+/ Mb#s! It can be (sed to acco&&odate E(ro#ean <EPT61 ser-ice! DT6 can acco&&odate +++ $ra&es'sec C12 co*(&ns C@ ro2s C bits H 6!@12 Mb#s! It can be (sed to acco&&odate =S62 ser-ice! 39. Message s2itching sends data (nits that can be arbitrari*y *ong! Pac%et s2itching has a &a7i&(& #ac%et siBe! "ny &essage *onger than that is s#*it (# into &(*ti#*e #ac%ets!
PROBLEM SOLUTIONS 0OR <8"PTER 2 9
40. The O<612c $ra&es are 12 C@+ =1+ + co*(&ns o$ @ ro2s! O$ these, 12 C; =;6 co*(&ns are ta%en (# by *ine and section o-erhead! This *ea-es an SPE o$ 1+// co*(&ns! One SPE co*(&n is ta%en (# by #ath o-erhead, *ea-ing 1+/; co*(&ns $or (ser data! Since each co*(&n ho*ds @ bytes o$ bits, an O<612c $ra&e ho*ds ?,,+@6 (ser data bits! Aith +++ $ra&es'sec, the (ser data rate is 6++!?6 Mb#s! 41. The three net2or%s ha-e the $o**o2ing #ro#erties> star> best case H 2, a-erage case H 2, 2orst case H 2 ring> best case H 1, a-erage case H n//, 2orst case H n/2 $(** interconnect> best case H 1, a-erage case H 1, 2orst case H 1 42. Aith circ(it s2itching, at # =$ the circ(it is set (#M at # =$ +x /bthe *ast bit is sentM at # =$ +x /β k% the &essage arri-es! Aith #ac%et s2itching, the *ast bit is sent at # =x /b. To get to the $ina* destination, the *ast #ac%et &(st be retrans&itted k −1 ti&es by inter&ediate ro(ters, each retrans&ission ta%6ing p /b sec, so the tota* de*ay is x /β (k −1)p /b +k%. Pac%et s2itching is $aster i$ $ L4k −1)p /b. 43. The tota* n(&ber o$ #ac%ets needed is x /#, so the tota* data N header tra$$ic is (p +h)x /p bits! The so(rce re)(ires (p +h)x /pb sec to trans&it these bits! The retrans&issions o$ the *ast #ac%et by the inter&ediate ro(ters ta%e (# a tota* o$ (k −154p +h5 /b sec! "dding (# the ti&e $or the so(rce to send a** the bits, #*(s the ti&e $or the ro(ters to carry the *ast #ac%et to the destination, th(s c*earing the #i#e*ine, 2e get a tota* ti&e o$ (p +h)x /pb N (p +h54k −1)/b sec! Mini&iBing this )(antity 2ith res#ect to #,2e$ind p =77777777 hx / (k −15 . 44. Each ce** has si7 neighbors! I$ the centra* ce** (ses $re)(ency gro(# ", its si7 neighbors can (se B, <, B, <, B, and C res#ecti-e*y! In other 2ords, on*y ; (ni)(e ce**s are needed! <onse)(ent*y, each ce** can ha-e 2 + $re)(encies! 45. 0irst, initia* de#*oy&ent si&#*y #*aced ce**s in regions 2here there 2as high density o$ h(&an or -ehic*e #o#(*ation! Once they 2ere there, the o#erator o$ten did not 2ant to go to the tro(b*e o$ &o-ing the&! Second, antennas are ty#ica**y #*aced on ta** b(i*dings or &o(ntains! =e#ending on the e7act *oca6tion o$ s(ch str(ct(res, the area co-ered by a ce** &ay be irreg(*ar d(e to obs6tac*es near the trans&itter! Third, so&e co&&(nities or #ro#erty o2ners do not a**o2 b(i*ding a to2er at a *ocation 2here the center o$ a ce** $a**s! In s(ch cases, directiona* antennas are #*aced at a *ocation not at the ce** center!
46. I$ 2e ass(&e that each &icroce** is a circ*e 1++ & in dia&eter, then each ce** has an area o$ 2,+0 ! I$ 2e ta%e the area o$ San 0rancisco, 1!2 C1+ & 2 and di-ide it by the area o$ 1 &icroce**, 2e get 1,,2?@ &icroce**s! O$ co(rse, it is i&#ossib*e to ti*e the #*ane 2ith circ*es 4and San 0rancisco is decided*y three6di&ensiona*5, b(t 2ith 2+,+++ &icroce**s 2e co(*d #robab*y do the 3ob!
10 PROBLEM SOLUTIONS 0OR <8"PTER 2
47. 0re)(encies cannot be re(sed in ad3acent ce**s, so 2hen a (ser &o-es $ro& one ce** to another, a ne2 $re)(ency &(st be a**ocated $or the ca**! I$ a (ser &o-es into a ce**, a** o$ 2hose $re)(encies are c(rrent*y in (se, the (serGs ca** &(st be ter&inated! 48. It is not ca(sed direct*y by the need $or bac%2ard co&#atibi*ity! The ;+ %8B channe* 2as indeed a re)(ire&ent, b(t the designers o$ =6"MPS did not ha-e to st($$ three (sers into it! They co(*d ha-e #(t t2o (sers in each channe*, increasing the #ay*oad be$ore error correction $ro& 26+ C,+ =1; %b#s to 26+ C?, =1@!, %b#s! Th(s, the )(a*ity *oss 2as an intentiona* trade6o$$ to #(t &ore (sers #er ce** and th(s get a2ay 2ith bigger ce**s! 49. =6"MPS (ses ;2 channe*s 4in each direction5 2ith three (sers sharing a sin6g*e channe*! This a**o2s =6"MPS to s(##ort (# to 2/@6 (sers si&(*tane6o(s*y #er ce**! .SM (ses 12/ channe*s 2ith eight (sers sharing a sing*e channe*! This a**o2s .SM to s(##ort (# to @@2 (sers si&(*taneo(s*y! Both syste&s (se abo(t the sa&e a&o(nt o$ s#ectr(& 42, M8B in each direction5! =6"MPS (ses ;+ J8B C @2 H 26!?6 M8B! .SM (ses 2++ J8B C12/ H 2/! + M8B! The di$$erence can be &ain*y attrib(ted to the better s#eech )(a*ity #ro-ided by .SM 41; Jb#s #er (ser5 o-er =6"MPS 4 Jb#s #er (ser5! 50. The res(*t is obtained by negating each o$ ", B, and C and then adding the three chi# se)(ences! "*ternati-e*y the three can be added and then negated! The res(*t is 4N; N1 N1 −1 −; −1 −1 N15! 51. By de$inition S d T =& 1 333
i =1 &
Σ
S i" i I$ " sends a + bit instead o$ 1 bit, its chi# se)(ence is negated, 2ith the i6th e*e&ent beco&ing −" i ! Th(s, S d T =& 1 333
i =1 &
Σ Σ
S i (" i 5 =−& 1 333
i =1 &
S i " i =+ 52. Ahen t2o e*e&ents &atch, their #rod(ct is N1! Ahen they do not &atch, their #rod(ct is −1! To &a%e the s(& +, there &(st be as &any &atches as &is&atches! Th(s, t2o chi# se)(ences are orthogona* i$ e7act*y ha*$ o$ the
corres#onding e*e&ents &atch and e7act*y ha*$ do not &atch! 53. E(st co&#(te the $o(r nor&a*iBed inner #rod(cts> (1 N1 ; N1 1 −; N1 N15 d (1 −1 −1 N1N1 1 N1 N15' H 1 (1 N1 ; N1 1 −; N1 N15 d (1 −1 N1 1 N1N1N1 15' H −1
PROBLEM SOLUTIONS 0OR <8"PTER 2 11
(1 N1 ; N1 1 −; N1 N15 d (1 N1 1 N1N1N1 1 −15' H + (1 N1 ; N1 1 −; N1 N15 d (1 N1 1 −1 −1 −1 N1 15' H 1 The res(*t is that A and D sent 1 bits, B sent a + bit, and C 2as si*ent! 54. Ignoring s#eech co&#ression, a digita* P<M te*e#hone needs 6/ %b#s! I$ 2e di-ide 1+ .b#s by 6/ %b#s 2e get 1,6,2,+ ho(ses #er cab*e! <(rrent syste&s ha-e h(ndreds o$ ho(ses #er cab*e! 55. It is both! Each o$ the 1++ channe*s is assigned its o2n $re)(ency band 40=M5, and on each channe* the t2o *ogica* strea&s are inter&i7ed by T=M! This e7a&#*e is the sa&e as the "M radio e7a&#*e gi-en in the te7t, b(t nei6ther is a $antastic e7a&#*e o$ T=M beca(se the a*ternation is irreg(*ar! 56. " 26Mb#s do2nstrea& band2idth g(arantee to each ho(se i&#*ies at &ost ,+ ho(ses #er coa7ia* cab*e! Th(s, the cab*e co&#any 2i** need to s#*it (# the e7isting cab*e into 1++ coa7ia* cab*es and connect each o$ the& direct*y to a $iber node! 57. The (#strea& band2idth is ;? M8B! Using IPSJ 2ith 2 bits'8B, 2e get ?/ Mb#s (#strea&! =o2nstrea& 2e ha-e 2++ M8B! Using I"M66/, this is 12++ Mb#s! Using I"M62,6, this is 16++ Mb#s! 58. E-en i$ the do2nstrea& channe* 2or%s at 2? Mb#s, the (ser inter$ace is near*y a*2ays 1+6Mb#s Ethernet! There is no 2ay to get bits to the co&#(ter any $aster than 1+6Mb#s (nder these circ(&stances! I$ the connection bet2een the P< and cab*e &ode& is $ast Ethernet, then the $(** 2? Mb#s &ay be a-ai*ab*e! Us(a**y, cab*e o#erators s#eci$y 1+ Mb#s Ethernet beca(se they do not 2ant one (ser s(c%ing (# the entire band2idth! SOLUTIONS TO CHAPTER 3 PROBLEMS 1. Since each $ra&e has a chance o$ +! o$ getting thro(gh, the chance o$ the 2ho*e &essage getting thro(gh is +! 1+ , 2hich is abo(t +!1+?! <a** this -a*(e #! The e7#ected n(&ber o$ trans&issions $or an entire &essage is then E=
i =1 8
Σ Σ
i#41 −#5i −1 =p
i =1 8
i41 −#5i −1 To red(ce this, (se the 2e**6%no2n $or&(*a $or the s(& o$ an in$inite geo&etric series, S=
1.... 1 8
Σ
α i =1 −α 1 33333 =i$$erentiate both sides 2ith res#ect to α to get Σ=
i =1 8
Σ
ια i −1 = 41 −α 5 2 1 33333333
12 PROBLEM SOLUTIONS 0OR <8"PTER ;
No2 (se α=1 −p to get E =1/#! Th(s, it ta%es an a-erage o$ 1'+!1+?, or abo(t @!; trans&issions! 2. The so*(tion is 4a5 +++++1++ +1+++111 111+++11 111+++++ +111111+ 4b5 +111111+ +1+++111 111+++11 111+++++ 111+++++ 111+++++ +111111+ +111111+ 4c5 +111111+ +1+++111 11+1+++11 111++++++ +11111+1+ +111111+ 3. "$ter st($$ing, 2e get " B ES< ES< < ES< ES< ES< 0L". ES< 0L". =! 4. I$ yo( co(*d a*2ays co(nt on an end*ess strea& o$ $ra&es, one $*ag byte &ight be eno(gh! B(t 2hat i$ a $ra&e ends 42ith a $*ag byte5 and there are no ne2 $ra&es $or 1, &in(tes! 8o2 2i** the recei-er %no2 that the ne7t byte is act(6a**y the start o$ a ne2 $ra&e and not 3(st noise on the *ineO The #rotoco* is &(ch si&#*er 2ith starting and ending $*ag bytes! 5. The o(t#(t is +1111+11111++11111+1+! 6. It is #ossib*e! S(##ose that the origina* te7t contains the bit se)(ence +111111+ as data! "$ter bit st($$ing, this se)(ence 2i** be rendered as +11111+1+! I$ the second + is *ost d(e to a trans&ission error, 2hat is recei-ed is +111111+, 2hich the recei-er sees as end o$ $ra&e! It then *oo%s 3(st be$ore the end o$ the $ra&e $or the chec%s(& and -eri$ies it! I$ the chec%6s(& is 16 bits, there is 1 chance in 2 16 that it 2i** accidenta**y be correct, *eading to an incorrect $ra&e being acce#ted! The *onger the chec%s(&, the *o2er the #robabi*ity o$ an error getting thro(gh (ndetected, b(t the #robabi*6ity is ne-er Bero! 7. I$ the #ro#agation de*ay is -ery *ong, as in the case o$ a s#ace #robe on or near Mars or Den(s, $or2ard error correction is indicated! It is a*so a##ro#ri6ate, in a &i*itary sit(ation in 2hich the recei-er does not 2ant to disc*ose his *ocation by trans&itting! I$ the error rate is *o2 eno(gh that an error6correcting code is good eno(gh, it &ay a*so be si&#*er! 0ina**y, rea*6ti&e syste&s cannot to*erate 2aiting $or retrans&issions! 8. Ma%ing one change to any -a*id character cannot generate another -a*id char6acter d(e to the nat(re o$ #arity bits! Ma%ing t2o changes to e-en bits or t2o changes to odd bits 2i** gi-e another -a*id character, so the distance is 2! 9. Parity bits are needed at #ositions 1, 2, /, , and 16, so &essages that do not e7tend beyond bit ;1 4inc*(ding the #arity bits5 $it! Th(s, $i-e #arity bits are s($$icient! The bit #attern trans&itted is +11+1+11++11++111+1+1 10. The encoded -a*(e is 1+1++1++1111!
PROBLEM SOLUTIONS 0OR <8"PTER ; 13
11. I$ 2e n(&ber the bits $ro& *e$t to right starting at bit 1, in this e7a&#*e, bit 2 4a #arity bit5 is incorrect! The 126bit -a*(e trans&itted 4a$ter 8a&&ing encoding5 2as +7"/0! The origina* 6bit data -a*(e 2as +7"0! 12. " sing*e error 2i** ca(se both the horiBonta* and -ertica* #arity chec%s to be 2rong! T2o errors 2i** a*so be easi*y detected! I$ they are in di$$erent ro2s, the ro2 #arity 2i** catch the&! I$ they are in the sa&e ro2, the co*(&n #arity 2i** catch the&! Three errors &ight s*i# by (ndetected, $or e7a&#*e, i$ so&e bit is in-erted a*ong 2ith its ro2 and co*(&n #arity bits! E-en the corner bit
2i** not catch this! 13. =escribe an error #attern as a &atri7 o$ n ro2s by k co*(&ns! Each o$ the correct bits is a +, and each o$ the incorrect bits is a 1! Aith $o(r errors #er b*oc%, each b*oc% 2i** ha-e e7act*y $o(r 1s! 8o2 &any s(ch b*oc%s are thereO There are nk 2ays to choose 2here to #(t the $irst 1 bit, nk −1 2ays to choose the second, and so on, so the n(&ber o$ b*oc%s is n%4nκ 154nκ 254nκ ;5! Undetected errors on*y occ(r 2hen the $o(r 1 bits are at the -ertices o$ a rectang*e! Using <artesian coordinates, e-ery 1 bit is at a coordinate (7, y5, 2here + =x '%and + =( 'n! S(##ose that the bit c*osest to the origin 4the *o2er6*e$t -erte75 is at (#, )5! The n(&ber o$ *ega* rectang*es is (k −p −154n −) −15! Then the tota* n(&ber o$ rectang*es can be $o(nd by s(&&ing this $or&(*a $or a** #ossib*e p and )! The #robabi*ity o$ an (ndetected error is then the n(&ber o$ s(ch rectang*es di-ided by the n(&ber o$ 2ays to distrib(te the $o(r bits> n%4nk −154nk −254nk −;5
p =+ k −2 ) =+ n −2
Σ Σ
(k −p −154n −) −15 333333333333333333333333 14. The re&ainder is x 2 +x +1. 15. The $ra&e is 1++111+1! The generator is 1++1! The &essage a$ter a##ending three Beros is 1++111+1+++! The re&ainder on di-iding 1++111+1+++ by 1++1 is 1++! So, the act(a* bit string trans&itted is 1++111+11++! The recei-ed bit strea& 2ith an error in the third bit $ro& the *e$t is 1+1111+11++! =i-iding this by 1++1 #rod(ces a re&ainder 1++, 2hich is di$$erent $ro& Bero! Th(s, the recei-er detects the error and can as% $or a retrans&ission! 16. The <R< is co&#(ted d(ring trans&ission and a##ended to the o(t#(t strea& as soon as the *ast bit goes o(t onto the 2ire! I$ the <R< 2ere in the header, it 2o(*d be necessary to &a%e a #ass o-er the $ra&e to co&#(te the <R< be$ore trans&itting! This 2o(*d re)(ire each byte to be hand*ed t2iceKonce $or chec%s(&&ing and once $or trans&itting! Using the trai*er c(ts the 2or% in ha*$!
14 PROBLEM SOLUTIONS 0OR <8"PTER ;
17. E$$iciency 2i** be ,+: 2hen the ti&e to trans&it the $ra&e e)(a*s the ro(nd6tri# #ro#agation de*ay! "t a trans&ission rate o$ / bits'&s, 16+ bits ta%es /+ &s! 0or $ra&e siBes abo-e 16+ bits, sto#6and62ait is reasonab*y e$$icient! 18. To o#erate e$$icient*y, the se)(ence s#ace 4act(a**y, the send 2indo2 siBe5 &(st be *arge eno(gh to a**o2 the trans&itter to %ee# trans&itting (nti* the $irst ac%no2*edge&ent has been recei-ed! The #ro#agation ti&e is 1 &s! "t T1 s#eed, 2hich is 1!,;6 Mb#s 4e7c*(ding the 1 header bit5, a 6/6byte $ra&e ta%es +!;++ &sec! There$ore, the $irst $ra&e $(**y arri-es 1 !; &sec a$ter its trans&ission 2as started! The ac%no2*edge&ent ta%es another 1 &sec to get bac%, #*(s a s&a** 4neg*igib*e5 ti&e $or the ac%no2*edge&ent to arri-e $(**y! In a**, this ti&e is ;6!; &sec! The trans&itter &(st ha-e eno(gh 2indo2 s#ace to %ee# going $or ;6!; &sec! " $ra&e ta%es +!; &s, so it ta%es 121 $ra&es to $i** the #i#e! Se-en6bit se)(ence n(&bers are needed! 19. It can ha##en! S(##ose that the sender trans&its a $ra&e and a garb*ed
ac%no2*edge&ent co&es bac% )(ic%*y! The &ain *oo# 2i** be e7ec(ted a second ti&e and a $ra&e 2i** be sent 2hi*e the ti&er is sti** r(nning! 20. Let the senderGs 2indo2 be (S l , S * 5 and the recei-erGs be (+ l , + * ). Let the 2indo2 siBe be ,. The re*ations that &(st ho*d are> + =S * −S l +1 =A1 + * −+ l +1 =, S l =+ l =S * +1 21. The #rotoco* 2o(*d be incorrect! S(##ose that ;6bit se)(ence n(&bers are in (se! <onsider the $o**o2ing scenario> A 3(st sent $ra&e ?! B gets the $ra&e and sends a #iggybac%ed "<J! A gets the "<J and sends $ra&es +P6, a** o$ 2hich get *ost! B ti&es o(t and retrans&its its c(rrent $ra&e, 2ith the "<J ?! Loo% at the sit(ation at A 2hen the $ra&e 2ith -.ack =? arri-es! The %ey -ariab*es are AckExp.c#.% =+, -.ack =?, and N.x#/-a&."0S.n% =1. The &odi$ied b.#2..n 2o(*d ret(rn #-*e, ca(sing A to thin% the *ost $ra&es 2ere being ac%no2*edged! 22. Qes! It &ight *ead to dead*oc%! S(##ose that a batch o$ $ra&es arri-ed correct*y and 2ere acce#ted! Then the recei-er 2o(*d ad-ance its 2indo2! No2 s(##ose that a** the ac%no2*edge&ents 2ere *ost! The sender 2o(*d e-ent(a**y ti&e o(t and send the $irst $ra&e again! The recei-er 2o(*d send a N"J! S(##ose that this 2ere *ost! 0ro& that #oint on, the sender 2o(*d %ee# ti&ing o(t and sending a $ra&e that had a*ready been acce#ted, b(t the recei-er 2o(*d 3(st ignore it! Setting the a(7i*iary ti&er res(*ts in a correct ac%no2*edge&ent being sent bac% e-ent(a**y instead, 2hich resynchroniBes!
PROBLEM SOLUTIONS 0OR <8"PTER ; 15
23. It 2o(*d *ead to dead*oc% beca(se this is the on*y #*ace that inco&ing ac%no2*edge&ents are #rocessed! Aitho(t this code, the sender 2o(*d %ee# ti&ing o(t and ne-er &a%e any #rogress! 24. It 2o(*d de$eat the #(r#ose o$ ha-ing N"Js, so 2e 2o(*d ha-e to $a** bac% to ti&eo(ts! "*tho(gh the #er$or&ance 2o(*d degrade, the correctness 2o(*d not be a$$ected! The N"Js are not essentia*! 25. <onsider the $o**o2ing scenario! A sends + to B! B gets it and sends an "<J, b(t the "<J gets *ost! A ti&es o(t and re#eats +, b(t no2 B e7#ects 1, so it sends a N"J!I!A &ere*y re6sent r!ac%N1, it 2o(*d be sending $ra&e 1, 2hich it has not got yet! 26. No! The &a7i&(& recei-e 2indo2 siBe is 1! S(##ose that it 2ere 2! Ini6tia**y, the sender trans&its $ra&es +P6! "** are recei-ed and ac%no2*edged, b(t the ac%no2*edge&ent is *ost! The recei-er is no2 #re#ared to acce#t ? and +! Ahen the retrans&ission o$ + arri-es at the recei-er, it 2i** be b($6$ered and 6 ac%no2*edged! Ahen ? co&es in, ? and + 2i** be #assed to the host, *eading to a #rotoco* $ai*(re! 27. S(##ose A sent B a $ra&e that arri-ed correct*y, b(t there 2as no re-erse tra$$ic! "$ter a 2hi*e A 2o(*d ti&e o(t and retrans&it! B 2o(*d notice that the se)(ence n(&ber 2as incorrect, since the se)(ence n(&ber is be*o2 /-a&.Exp.c#.d! <onse)(ent*y, it 2o(*d send a N"J, 2hich carries an ac%no2*edge&ent n(&ber! Each $ra&e 2o(*d be sent e7act*y t2o ti&es! 28. No! This i&#*e&entation $ai*s! Aith MaxS.) =/, 2e get N-B*!$ =2. The e-en se)(ence n(&bers (se b($$er + and the odd ones (se b($$er 1! This &a##ing &eans that $ra&es / and + both (se the sa&e b($$er! S(##ose that
$ra&es +P; are recei-ed and ac%no2*edged! The recei-erGs 2indo2 no2 con6tains / and +! I$ / is *ost and + arri-es, it 2i** be #(t in b($$er + and a--i3.% R+S set to #-*e! The *oo# in the code $or /-a&.A--i3al 2i** be e7e6c(ted once, and an o(t6o$6order &essage de*i-ered to the host! This #rotoco* re)(ires MaxS.) to be odd to 2or% #ro#er*y! 8o2e-er, other i&#*e&enta6tions o$ s*iding 2indo2 #rotoco*s do not a** ha-e this #ro#erty 29. Let # =+ denote the start o$ trans&ission! "t # =1 &sec, the $irst $ra&e has been $(**y trans&itted! "t # =2?1 &sec, the $irst $ra&e has $(**y arri-ed! "t # =2?2 &sec, the $ra&e ac%no2*edging the $irst one has been $(**y sent! "t # =,/2 &sec, the ac%no2*edge&ent6bearing $ra&e has $(**y arri-ed! Th(s, the cyc*e is ,/2 &sec! " tota* o$ k $ra&es are sent in ,/2 &sec, $or an e$$iciency o$ k/,/2! 8ence 4a5 k H1,e$$iciency H 1',/2 H +!1 : 4b5 k H?,e$$iciency H ?',/2 H 1!2@: 4c5 k H/,e$$iciency H /',/2 H +!?/:
16 PROBLEM SOLUTIONS 0OR <8"PTER ;
30. Aith a ,+6%b#s channe* and 6bit se)(ence n(&bers, the #i#e is a*2ays $(**! The n(&ber o$ retrans&issions #er $ra&e is abo(t +!+1! Each good $ra&e 2astes /+ header bits, #*(s 1: o$ /+++ bits 4retrans&ission5, #*(s a /+6bit N"J once e-ery 1++ $ra&es! The tota* o-erhead is +!/ bits #er ;@6+ data bits, $or a $raction +!4/ 4;@6+ + +!/5 =1!@@ #ercent! 31. The trans&ission starts at # =+! "t # =/+@6/ 6/+++ sec H 6/ &sec, the *ast bit is sent! "t # =;;/ &sec, the *ast bit arri-es at the sate**ite and the -ery short "<J is sent! "t # =6+/ &sec, the "<J arri-es at the earth! The data rate here is /+@6 bits in 6+/ &sec or abo(t 6? 1 b#s! Aith a 2indo2 siBe o$ ? $ra&es, trans&ission ti&e is // &sec $or the $(** 2indo2, at 2hich ti&e the sender has to sto#! "t 6+/ &sec, the $irst "<J arri-es and the cyc*e can start again! 8ere 2e ha-e ? C/+@6 =2 ,6?2 bits in 6+/ &sec! The data rate is /?,/?+!2 b#s! <ontin(o(s trans&ission can on*y occ(r i$ the trans&itter is sti** sending 2hen the $irst "<J gets bac% at # =6+/ &sec! In other 2ords, i$ the 2indo2 siBe is greater than 6+/ &sec 2orth o$ trans&ission, it can r(n at $(** s#eed! 0or a 2indo2 siBe o$ 1+ or greater, this condition is &et, so $or any 2indo2 siBe o$ 1+ or greater 4e!g!, 1, or 12?5, the data rate is 6/ %b#s! 32. The #ro#agation s#eed in the cab*e is 2++,+++ %&'sec, or 2++ %&'&sec, so a 1++6%& cab*e 2i** be $i**ed in ,++ 9sec! Each T1 $ra&e is 1@; bits sent in 12, 9sec! This corres#onds to $o(r $ra&es, or ??2 bits on the cab*e! 33. Each &achine has t2o %ey -ariab*es> n.x# 3 !-a&. 3 #0 3 $.n% and !-a&. 3 .xp.c#.d, each o$ 2hich can ta%e on the -a*(es + or 1! Th(s, each &achine can be in one o$ $o(r #ossib*e states! " &essage on the channe* con6tains the se)(ence n(&ber o$ the $ra&e being sent and the se)(ence n(&ber o$ the $ra&e being "<Jed! Th(s, $o(r ty#es o$ &essages e7ist! The channe* &ay contain + or 1 &essage in either direction! So, the n(&ber o$ states the channe* can be in is 1 2ith Bero &essages on it, 2ith one &essage on it, and 16 2ith t2o &essages on it 4one &essage in each direction5! In tota* there are 1 N N 16 H 2, #ossib*e channe* states! This i&#*ies / C/ C2, =/++ #ossi6b*e states $or the co&#*ete syste&! 34. The $iring se)(ence is 1+, 6, 2, ! It corres#onds to acce#tance o$ an e-en $ra&e, *oss o$ the ac%no2*edge&ent, ti&eo(t by the sender, and regeneration o$ the ac%no2*edge&ent by the recei-er!
PROBLEM SOLUTIONS 0OR <8"PTER ; 17
35. The Petri net and state gra#h are as $o**o2s>
BD AE ACD A C B D E 1 2 3 4
The syste& &ode*ed is &(t(a* e7c*(sion! B and E are critica* sections that &ay not be acti-e si&(*taneo(s*y, i!e!, state BE is not #er&itted! P*ace C re#resents a se&a#hore that can be seiBed by either A or D b(t not by both together! 36. PPP 2as c*ear*y designed to be i&#*e&ented in so$t2are, not in hard2are as 8=L< near*y a*2ays is! Aith a so$t2are i&#*e&entation, 2or%ing entire*y 2ith bytes is &(ch si&#*er than 2or%ing 2ith indi-id(a* bits! In addition, PPP 2as designed to be (sed 2ith &ode&s, and &ode&s acce#t and trans&it data in (nits o$ 1 byte, not 1 bit! 37. "t its s&a**est, each $ra&e has t2o $*ag bytes, one #rotoco* byte, and t2o chec%s(& bytes, $or a tota* o$ $i-e o-erhead bytes #er $ra&e! SOLUTIONS TO CHAPTER 4 PROBLEMS 1. The $or&(*a is the standard $or&(*a $or Mar%o- )(e(eing gi-en in section /!1!1, na&e*y, " =1/ (..C −. 5! 8ere C =1+ and ?1+ −/ ,so " =1/ 41++++ −la&b%a5 sec! 0or the three arri-a* rates, 2e get 4a5 +!1 &sec, 4b5 +!11 &sec, 4c5 1 &sec! 0or case 4c5 2e are o#erating a )(e(eing syste& 2ith . =. / 4C =+!@, 2hich gi-es the 10de*ay! 2. Aith #(re "LO8" the (sab*e band2idth is +!1 / C,6 %b#s H 1+!; %b#s! Each station re)(ires 1+ b#s, so N =1+;+0/ 1+ =1+;+ stations!
18 PROBLEM SOLUTIONS 0OR <8"PTER /
3. Aith #(re "LO8", trans&ission can start instant*y! "t *o2 *oad, no co**i6sions are e7#ected so the trans&ission is *i%e*y to be s(ccess$(*! Aith s*otted "LO8", it has to 2ait $or the ne7t s*ot! This introd(ces ha*$ a s*ot ti&e o$ de*ay! 4. Each ter&ina* &a%es one re)(est e-ery 2++ sec, $or a tota* *oad o$ ,+ re)(ests'sec! 8ence 5 =,0/ +++ =1/ 160. 5. 4a5 Aith 5 =2 the Poisson *a2 gi-es a #robabi*ity o$ . −2 . 4b5 41 −. −5 5 k . −5 =+!1;, C+! 6, k . 4c5 The e7#ected n(&ber o$ trans&issions is . 5 =?!4. 6. 4a5 0ro& the Poisson *a2 again, P + =. −5 ,s05 =−*nP + =−*n +!1 =2!6. 4b5 Using S =5. −5 2ith 5 =2!; and . −5 =+!1, S =+!26. 4c5 Ahene-er 5 L1 the channe* is o-er*oaded, so it is o-er*oaded! 7. The n(&ber o$ trans&issions is E =. 5 . The E e-ents are se#arated by E −1 inter-a*s o$ $o(r s*ots each, so the de*ay is /4 . 5 −1). The thro(gh#(t is gi-en by S =5. −5 . Th(s, 2e ha-e t2o #ara&etric e)(ations, one $or de*ay and one $or thro(gh#(t, both in ter&s o$ 5. 0or each 5 -a*(e it is #ossib*e to $ind the corres#onding de*ay and thro(gh#(t, yie*ding one #oint on the c(r-e! 8. 4a5 The 2orst case is> a** stations 2ant to send and $ is the *o2est n(&bered
station! Aait ti&e N bit contention #eriod N (N −15 ×% bit $or trans&ission o$ $ra&es! The tota* is N +(N −15% bit ti&es! 4b5 The 2orst case is> a** sta6tions ha-e $ra&es to trans&it and $ has the *o2est -irt(a* station n(&ber! <onse)(ent*y, $ 2i** get its t(rn to trans&it a$ter the other N −1 stations ha-e trans&itted one $ra&e each, and N contention #eriods o$ siBe *og 2 N each! Aait ti&e is th(s (N −15 ×% +N C*og 2 bits! 9. Ahen station / sends, it beco&es +, and 1, 2, and ; are increased by 1! Ahen station ; sends, it beco&es +, and +, 1, and 2 are increased by 1! 0ina**y, 2hen station @ sends, it beco&es + and a** the other stations are incre&ented by 1! The res(*t is @, 1, 2, 6, /, , ,, ?, +, and ;! 10. Stations 2, ;, ,, ?, 11, and 1; 2ant to send! E*e-en s*ots are needed, 2ith the contents o$ each s*ot being as $o**o2s> s*ot 1> 2, ;, ,, ?, 11, 1; s*ot 2> 2, ;, ,, ? s*ot ;> 2, ; s*ot /> 2 s*ot ,> ; s*ot 6> ,, ? s*ot ?> , s*ot > ? s*ot @> 11, 1;
PROBLEM SOLUTIONS 0OR <8"PTER / 19
s*ot 1+> 11 s*ot 11> 1; 11. The n(&ber o$ s*ots re)(ired de#ends on ho2 $ar bac% in the tree one &(st go to $ind a co&&on ancestor o$ the t2o stations! I$ they ha-e the sa&e #arent 4i!e!, one *e-e* bac%5, 2hich ha##ens 2ith #robabi*ity 2 −n , it ta%es 2n +1 s*ots to 2a*% the tree! I$ the stations ha-e a co&&on grand#arent, 2hich ha##ens 2ith #robabi*ity 2 −n +1 , the tree 2a*% ta%es 2n −1 s*ots, etc! The 2orst case is 2n +1 4co&&on #arent5, and the best case is three s*ots 4stations in di$6$erent ha*-es o$ the tree5! The &ean, &, is gi-en by &=
i =+ n −1
Σ
2 −(n −i 5 42n +1 −2i 5 This e7#ression can be si&#*i$ied to & =41 −2 −n 542n +15 −2 −(n −15
i =+ n −1
Σ
i2i 12. Radios cannot recei-e and trans&it on the sa&e $re)(ency at the sa&e ti&e, so <SM"'<= cannot be (sed! I$ this #rob*e& co(*d be so*-ed 4e!g!, by e)(i##ing each station 2ith t2o radios5, there is sti** the #rob*e& o$ not a** stations being 2ithin radio range o$ each other! On*y i$ both o$ these #rob6*e&s can be so*-ed, is <SM"'<= a candidate! 13. Both o$ the& (se a co&bination o$ 0=M and T=M! In both cases dedicated $re)(ency 4i!e!, 2a-e*ength5 bands are a-ai*ab*e, and in both cases these bands are s*otted $or T=M!
14. Qes! I&agine that they are in a straight *ine and that each station can reach on*y its nearest neighbors! Then A can send to B 2hi*e E is sending to 0! 15. 4a5 N(&ber the $*oors 16?! In the star con$ig(ration, the ro(ter is in the &id6d*e o$ $*oor /! <ab*es are needed to each o$ the ? C1, −1 =1+/ sites! The tota* *ength o$ these cab*es is /
i =1 ? 7 =1 1,
Σ Σ
777777777777 (i −/52 +4 7 −
52 The tota* *ength is abo(t 1 ;2 &eters! 4b5 0or +2!;, ? horiBonta* cab*es ,6 & *ong are needed, #*(s one -ertica* cab*e 2/ & *ong, $or a tota* o$ /16 &! 16. The Ethernet (ses Manchester encoding, 2hich &eans it has t2o signa* #eriods #er bit sent! The data rate o$ the standard Ethernet is 1+ Mb#s, so the ba(d rate is t2ice that, or 2+ &egaba(d!
20 PROBLEM SOLUTIONS 0OR <8"PTER /
17. The signa* is a s)(are 2a-e 2ith t2o -a*(es, high 485 and *o2 4L5! The #at6tern is L8L8L88L8L8LL88LL88L! 18. The #attern this ti&e is 8L8L8LL88LL8L88L8LL8! 19. The ro(nd6tri# #ro#agation ti&e o$ the cab*e is 1+ 9sec! " co&#*ete trans&ission has si7 #hases> trans&itter seiBes cab*e 41+ 9sec5 trans&it data 42,!6 9sec5 =e*ay $or *ast bit to get to the end 4,!+ 9sec5 recei-er seiBes cab*e 41+ 9sec5 ac%no2*edge&ent sent 4;!2 9sec5 =e*ay $or *ast bit to get to the end 4,!+ 9sec5 The s(& o$ these is , ! 9sec. In this #eriod, 22/ data bits are sent, $or a rate o$ abo(t ;! Mb#s! 20. N(&ber the ac)(isition atte&#ts starting at 1! "tte&#t i is distrib(ted a&ong 2 i −1 s*ots! Th(s, the #robabi*ity o$ a co**ision on atte&#t i is 2 −(i −15 . The #robabi*ity that the $irst k −1 atte&#ts $ai*, $o**o2ed by a s(ccess on ro(nd k is P k =41 −2 −(k −15 5
i =1 k −1
.
2 −(i −15 2hich can be si&#*i$ied to P k =41 −2 −(k −15 52 −(k −154k −2)/ 2 The e7#ected n(&ber o$ ro(nds is then 3(st Σ kP k . 21. 0or a 16%& cab*e, the one62ay #ro#agation ti&e is , 9sec, so 2.... 1+ 9sec! To &a%e <SM"'<= 2or%, it &(st be i&#ossib*e to trans&it an entire $ra&e in this inter-a*! "t 1 .b#s, a** $ra&es shorter than 1+,+++ bits can be co&6#*ete*y trans&itted in (nder 1+ 9sec, so the &ini&(& $ra&e is 1+,+++ bits or 12,+ bytes! 22. The &ini&(& Ethernet $ra&e is 6/ bytes, inc*(ding both addresses in the Eth6ernet
$ra&e header, the ty#e'*ength $ie*d, and the chec%s(&! Since the header $ie*ds occ(#y 1 bytes and the #ac%et is 6+ bytes, the tota* $ra&e siBe is ? bytes, 2hich e7ceeds the 6/6byte &ini&(&! There$ore, no #adding is (sed! 23. The &a7i&(& 2ire *ength in $ast Ethernet is 1'1+ as *ong as in Ethernet! 24. The #ay*oad is 1,++ bytes, b(t 2hen the destination address, so(rce address, ty#e'*ength, and chec%s(& $ie*ds are co(nted too, the tota* is indeed 1,1 !
PROBLEM SOLUTIONS 0OR <8"PTER / 21
25. The encoding is on*y +: e$$icient! It ta%es 1+ bits o$ trans&itted data to re#resent bits o$ act(a* data! In one second, 12,+ &egabits are trans&itted, 2hich &eans 12, &i**ion code2ords! Each code2ord re#resents data bits, so the tr(e data rate is indeed 1+++ &egabits'sec! 26. The s&a**est Ethernet $ra&e is ,12 bits, so at 1 .b#s 2e get 1,@,;,12, or a*&ost 2 &i**ion $ra&es'sec! 8o2e-er, this on*y 2or%s 2hen $ra&e b(rsting is o#erating! Aitho(t $ra&e b(rsting, short $ra&es are #added to /+@6 bits, in 2hich case the &a7i&(& n(&ber is 2//,1/+! 0or the *argest $ra&e 412,1// bits5, there can be as &any as 2,;/, $ra&es'sec! 27. .igabit Ethernet has it and so does +2!16! It is (se$(* $or band2idth e$$iciency 4one #rea&b*e, etc!5 b(t a*so 2hen there is a *o2er *i&it on $ra&e siBe! 28. Station C is the c*osest to A since it heard the RTS and res#onded to it by asserting its N"D signa*! D did not res#ond so it &(st be o(tside "Gs radio range! 29. " $ra&e contains ,12 bits! The bit error rate is p =1+ −? ! The #robabi*ity o$ a** ,12 o$ the& s(r-i-ing correct*y is 41 −#5,12 , 2hich is abo(t +!@@@@/ ! The $raction da&aged is th(s abo(t , C1+ −, ! The n(&ber o$ $ra&es'sec is 11 C1+ 6 / ,12 or abo(t 21,/ /! M(*ti#*ying these t2o n(&bers together, 2e get abo(t 1 da&aged $ra&e #er second! 30. It de#ends ho2 $ar a2ay the s(bscriber is! I$ the s(bscriber is c*ose in, I"M66/ is (sed $or 12+ Mb#s! 0or &edi(& distances, I"M616 is (sed $or + Mb#s! 0or distant stations, IPSJ is (sed $or /+ Mb#s! 31. Unco&#ressed -ideo has a constant bit rate! Each $ra&e has the sa&e n(&ber o$ #i7e*s as the #re-io(s $ra&e! Th(s, it is #ossib*e to co&#(te -ery acc(rate*y ho2 &(ch band2idth 2i** be needed and 2hen! <onse)(ent*y, constant bit rate ser-ice is the best choice! 32. One reason is the need $or rea*6ti&e )(a*ity o$ ser-ice! I$ an error is disco-ered, there is no ti&e to get a retrans&ission! The sho2 &(st go on! 0or2ard error correction can be (sed here! "nother reason is that on -ery *o2 )(a*ity *ines 4e!g!, 2ire*ess channe*s5, the error rate can be so high that #ractica**y a** $ra&es 2o(*d ha-e to be retrans&itted, and the retrans&ission 2o(*d #robab*y da&aged as 2e**! To a-oid this, $or2ard error correction is (sed to increase the $raction o$ $ra&es that arri-e correct*y! 33. It is i&#ossib*e $or a de-ice to be &aster in t2o #iconets at the sa&e ti&e! There are t2o #rob*e&s! 0irst, on*y ; address bits are a-ai*ab*e in the header 2hi*e as &any as se-en s*a-es co(*d be in each #iconet! Th(s, there 2o(*d be no 2ay to (ni)(e*y address each s*a-e! Second, the access code at the start o$ the $ra&e is deri-ed $ro& the &asterGs identity! This is ho2 s*a-es te** 2hich
22 PROBLEM SOLUTIONS 0OR <8"PTER /
&essage be*ongs to 2hich #iconet! I$ t2o o-er*a##ing #iconets (sed the sa&e access code, there 2o(*d be no 2ay to te** 2hich $ra&e be*onged to 2hich #iconet! In e$$ect, the t2o #iconets 2o(*d be &erged into one big #iconet
instead o$ t2o se#arate ones! 34. B*(etooth (ses 08SS, 3(st as +2!11 does! The biggest di$$erence is that B*(etooth ho#s at a rate o$ 16++ ho#s'sec, $ar $aster than +2!11! 35. "n "<L channe* is asynchrono(s, 2ith $ra&es arri-ing irreg(*ar*y as data are #rod(ced! "n S<O channe* is synchrono(s, 2ith $ra&es arri-ing #eriodica**y at a 2e**6de$ined rate! 36. They do not! The d2e** ti&e in +2!11 is not standardiBed, so it has to be anno(nced to ne2 stations that arri-e! In B*(etooth this is a*2ays 62, 9sec! There is no need to anno(nce this! "** B*(etooth de-ices ha-e this hard2ired into the chi#! B*(etooth 2as designed to be chea#, and $i7ing the ho# rate and d2e** ti&e *eads to a si&#*er chi#! 37. The $irst $ra&e 2i** be $or2arded by e-ery bridge! "$ter this trans&ission, each bridge 2i** ha-e an entry $or destination a 2ith a##ro#riate #ort in its hash tab*e! 0or e7a&#*e, =Gs hash tab*e 2i** no2 ha-e an entry to $or2ard $ra&es destined to a on L"N 2! The second &essage 2i** be seen by bridges B, =, and "! These bridges 2i** a##end a ne2 entry in their hash tab*e $or $ra&es destined $or c! 0or e7a&#*e bridge =Gs hash tab*e 2i** no2 ha-e another entry to $or2ard $ra&es destined to c on L"N 2! The third &essage 2i** be seen by bridges 8, =, ", and B! These bridges 2i** a##end a ne2 entry in their hash tab*e $or $ra&es destined $or d! The $i$th &essage 2i** be seen by bridges E, <, B, =, and "! Bridges E and C 2i** a##end a ne2 entry in their hash tab*e $or $ra&es destined $or d, 2hi*e bridges =, B, and A 2i** (#date their hash tab*e entry $or destination d! 38. Bridges ., 8 and 9 are not (sed $or $or2arding any $ra&es! The &ain reason $or ha-ing *oo#s in an e7tended L"N is to increase re*iabi*ity! I$ any bridge in the c(rrent s#anning tree $ai*s, the 4dyna&ic5 s#anning tree a*gorith& recon$ig(res the s#anning tree into a ne2 one that &ay inc*(de one or &ore o$ these bridges that 2ere not a #art o$ the #re-io(s s#anning tree! 39. The si&#*est choice is to do nothing s#ecia*! E-ery inco&ing $ra&e is #(t onto the bac%#*ane and sent to the destination card, 2hich &ight be the so(rce card! In this case, intracard tra$$ic goes o-er the s2itch bac%#*ane! The other choice is to recogniBe this case and treat it s#ecia**y, sending the $ra&e o(t direct*y and not going o-er the bac%#*ane! 40. The 2orst case is an end*ess strea& o$ 6/6byte 4,126bit5 $ra&es! I$ the bac%6#*ane can hand*e 1+ @ b#s, the n(&ber o$ $ra&es it can hand*e is 1+ @ / ,12! This is 1,@,;,12, $ra&es'sec!
PROBLEM SOLUTIONS 0OR <8"PTER / 23
41. The #ort on B1 to L"N ; 2o(*d need to be re*abe*ed as .A! 42. " store6and6$or2ard s2itch stores each inco&ing $ra&e in its entirety, then e7a&ines it and $or2ards it! " c(t6thro(gh s2itch starts to $or2ard inco&ing $ra&es be$ore they ha-e arri-ed co&#*ete*y! "s soon as the destination address is in, the $or2arding can begin! 43. Store6and6$or2ard s2itches store entire $ra&es be$ore $or2arding the&! "$ter a $ra&e co&es in, the chec%s(& can be -eri$ied! I$ the $ra&e is da&6aged, it is discarded i&&ediate*y! Aith c(tHthro(gh, da&aged $ra&es cannot be discarded by the s2itch beca(se by the ti&e the error is detected, the $ra&e is a*ready gone! Trying to dea* 2ith the #rob*e& is *i%e *oc%ing the barn door a$ter the horse has esca#ed! 44. No! 8(bs 3(st connect a** the inco&ing *ines together e*ectrica**y! There is nothing to con$ig(re! No ro(ting is done in a h(b! E-ery $ra&e co&ing into the h(b goes o(t on a** the other *ines!
45. It 2o(*d 2or%! 0ra&es entering the core do&ain 2o(*d a** be *egacy $ra&es, so it 2o(*d be (# to the $irst core s2itch to tag the&! It co(*d do this by (sing M"< addresses or IP addresses! Si&i*ar*y, on the 2ay o(t, that s2itch 2o(*d ha-e to (ntag o(tgoing $ra&es! SOLUTIONS TO CHAPTER 5 PROBLEMS 1. 0i*e trans$er, re&ote *ogin, and -ideo on de&and need connection6oriented ser-ice! On the other hand, credit card -eri$ication and other #oint6o$6sa*e ter&ina*s, e*ectronic $(nds trans$er, and &any $or&s o$ re&ote database access are inherent*y connection*ess, 2ith a )(ery going one 2ay and the re#*y co&ing bac% the other 2ay! 2. Qes! Interr(#t signa*s sho(*d s%i# ahead o$ data and be de*i-ered o(t o$ se)(ence! " ty#ica* e7a&#*e occ(rs 2hen a ter&ina* (ser hits the )(it 4%i**5 %ey! The #ac%et generated $ro& the )(it signa* sho(*d be sent i&&ediate*y and sho(*d s%i# ahead o$ any data c(rrent*y )(e(ed (# $or the #rogra&, i!e!, data a*ready ty#ed in b(t not yet read! 3. Dirt(a* circ(it net2or%s &ost certain*y need this ca#abi*ity in order to ro(te connection set(# #ac%ets $ro& an arbitrary so(rce to an arbitrary destination! 4. The negotiation co(*d set the 2indo2 siBe, &a7i&(& #ac%et siBe, data rate, and ti&er -a*(es! 5. 0o(r ho#s &eans that $i-e ro(ters are in-o*-ed! The -irt(a*6circ(it i&#*e&en6tation re)(ires tying (# , C =/+ bytes o$ &e&ory $or 1+++ sec! The datagra& i&#*e&entation re)(ires trans&itting 12 C/ C2++ H @6++ bytes o$ header o-er and abo-e 2hat the -irt(a*6circ(it i&#*e&entation needs! Th(s,
24 PROBLEM SOLUTIONS 0OR <8"PTER ,
the )(estion co&es do2n to the re*ati-e cost o$ /+,+++ byte6sec o$ &e&ory -ers(s @6++ byte6ho#s o$ circ(it ca#acity! I$ &e&ory is de#reciated o-er 2 C,2 C/+ C;6++ H 1!, C1+ ? sec, a byte6sec costs 6!? C1+ − cents, and /+,+++ o$ the& cost 3(st o-er 2 &i**icents! I$ a byte6ho# costs 1+ −6 cents, @6++ o$ the& cost @!6 &i**icents! Dirt(a* circ(its are chea#er $or this set o$ #ara&eters! 6. Qes! " *arge noise b(rst co(*d garb*e a #ac%et bad*y! Aith a %6bit chec%s(&, there is a #robabi*ity o$ 2 −k that the error is (ndetected! I$ the destination $ie*d or, e)(i-a*ent*y, -irt(a*6circ(it n(&ber, is changed, the #ac%et 2i** be de*i-ered to the 2rong destination and acce#ted as gen(ine! P(t in other 2ords, an occasiona* noise b(rst co(*d change a #er$ect*y *ega* #ac%et $or one destination into a #er$ect*y *ega* #ac%et $or another destination! 7. It 2i** $o**o2 a** o$ the $o**o2ing ro(tes> ABC=, ABC0, ABE0, ABE., A5 =, A5 0, A5EB, and A5E0! The n(&ber o$ ho#s (sed is 2/! 8. Pic% a ro(te (sing the shortest #ath! No2 re&o-e a** the arcs (sed in the #ath 3(st $o(nd, and r(n the shortest #ath a*gorith& again! The second #ath 2i** be ab*e to s(r-i-e the $ai*(re o$ any *ine in the $irst #ath, and -ice -ersa! It is concei-ab*e, tho(gh, that this he(ristic &ay $ai* e-en tho(gh t2o *ine6dis3oint #aths e7ist! To so*-e it correct*y, a &a76$*o2 a*gorith& sho(*d be (sed! 9. .oing -ia B gi-es 411, 6, 1/, 1 , 12, 5! .oing -ia D gi-es 41@, 1,, @, ;, @, 1+5! .oing -ia E gi-es 412, 11, , 1/, ,, @5! Ta%ing the &ini&(& $or each destination e7ce#t C gi-es 411, 6, +, ;, ,, 5! The o(tgoing *ines are (B, B, P, =, E, B5! 10. The ro(ting tab*e is /++ bits! T2ice a second this tab*e is 2ritten onto each *ine, so ++ b#s are needed on each *ine in each direction! 11. It a*2ays ho*ds! I$ a #ac%et has arri-ed on a *ine, it &(st be ac%no2*edged! I$
no #ac%et has arri-ed on a *ine, it &(st be sent there! The cases ++ 4has not arri-ed and 2i** not be sent5 and 11 4has arri-ed and 2i** be sent bac%5 are *ogica**y incorrect and th(s do not e7ist! 12. The &ini&(& occ(rs at 1, c*(sters, each 2ith 16 regions, each region ha-ing 2+ ro(ters, or one o$ the e)(i-a*ent $or&s, e!g!, 2+ c*(sters o$ 16 regions o$ 1, ro(ters! In a** cases the tab*e siBe is 1, N 16 N 2+ H ,1! 13. <oncei-ab*y it &ight go into #ro&isc(o(s &ode, reading a** $ra&es dro##ed onto the L"N, b(t this is -ery ine$$icient! Instead, 2hat is nor&a**y done is that the ho&e agent tric%s the ro(ter into thin%ing it is the &obi*e host by res#onding to "RP re)(ests! Ahen the ro(ter gets an IP #ac%et destined $or the &obi*e host, it broadcasts an "RP )(ery as%ing $or the +2!; M"<6*e-e* address o$ the &achine 2ith that IP address! Ahen the &obi*e host is not
PROBLEM SOLUTIONS 0OR <8"PTER , 25
aro(nd, the ho&e agent res#onds to the "RP, so the ro(ter associates the &obi*e (serGs IP address 2ith the ho&e agentGs +2!; M"<6*e-e* address! 14. 4a5 The re-erse #ath $or2arding a*gorith& ta%es $i-e ro(nds to $inish! The #ac%et reci#ients on these ro(nds are A<, D/8E, DE5 89:N, 5 :N, and ;MO, res#ecti-e*y! " tota* o$ 21 #ac%ets are generated! 4b5 The sin% tree needs $o(r ro(nds and 1/ #ac%ets! 15. Node / c(rrent*y has t2o descendants, A and =! It no2 ac)(ires a third one, ., not circ*ed beca(se the #ac%et that $o**o2s 8/5 is not on the sin% tree! Node 5 ac)(ires a second descendant, in addition to =, *abe*ed 0! This, too, is not circ*ed as it does not co&e in on the sin% tree! 16. M(*ti#*e s#anning trees are #ossib*e! One o$ the& is>
A B C E FD K J I
17. Ahen gets the #ac%et, it broadcasts it! 8o2e-er, 8 %no2s ho2 to get to I, so it does not broadcast! 18. Node is three ho#s $ro& B, so it ta%es three ro(nds to $ind the ro(te! 19. It can do it a##ro7i&ate*y, b(t not e7act*y! S(##ose that there are 1+2/ node identi$iers! I$ node ;++ is *oo%ing $or node ++, it is #robab*y better to go c*oc%2ise, b(t it co(*d ha##en that there are 2+ act(a* nodes bet2een ;++ and ++ going c*oc%2ise and on*y 16 act(a* nodes bet2een the& going co(nter6 c*oc%2ise! The #(r#ose o$ the cry#togra#hic hashing $(nction S8"61 is to #rod(ce a -ery s&ooth distrib(tion so that the node density is abo(t the sa&e a** a*ong the circ*e! B(t there 2i** a*2ays be statistica* $*(ct(ations, so the straight$or2ard choice &ay be 2rong! 20. The node in entry ; s2itches $ro& 12 to 1+! 21. The #rotoco* is terrib*e! Let ti&e be s*otted in (nits o$ " sec! In s*ot 1 the so(rce ro(ter sends the $irst #ac%et! "t the start o$ s*ot 2, the second ro(ter has recei-ed the #ac%et b(t cannot ac%no2*edge it yet! "t the start o$ s*ot ;, the third ro(ter has recei-ed the #ac%et, b(t it cannot ac%no2*edge it either, so a** the ro(ters behind it are sti** hanging! The $irst ac%no2*edge&ent can
26 PROBLEM SOLUTIONS 0OR <8"PTER ,
on*y be sent 2hen the destination host ta%es the #ac%et $ro& the destination ro(ter! No2 the ac%no2*edge&ent begins #ro#agating bac%! It ta%es t2o $(** transits o$ the s(bnet, 24n −15" sec, be$ore the so(rce ro(ter can send the
second #ac%et! Th(s, the thro(gh#(t is one #ac%et e-ery 24 n −15" sec! 22. Each #ac%et e&itted by the so(rce host &a%es either 1, 2, or ; ho#s! The #ro6babi*ity that it &a%es one ho# is #! The #robabi*ity that it &a%es t2o ho#s is #41 −#). The #robabi*ity that it &a%es ; ho#s is 41 −#52 . The &ean #ath *ength a #ac%et can e7#ect to tra-e* is then the 2eighted s(& o$ these three #robabi*ities, or p 2 −6p +6. Notice that $or p =+ the &ean is ; ho#s and $or p =1 the &ean is 1 ho#! Aith + 'p'1, &(*ti#*e trans&issions &ay be needed! The &ean n(&ber o$ trans&issions can be $o(nd by rea*iBing that the #robabi*ity o$ a s(ccess$(* trans&ission a** the 2ay is 41 −#52 , 2hich 2e 2i** ca** α . The e7#ected n(&ber o$ trans&issions is 3(st α+2 41 −α 5 +3 41 −α 5 2 +!!! = α 1 33 = 41 −#52 1 33333333 0ina**y, the tota* ho#s (sed is 3(st (p 2 −6p +;5'41 −#52 . 23. 0irst, the 2arning bit ðod e7#*icit*y sends a congestion noti$ication to the so(rce by setting a bit, 2hereas RE= i&#*icit*y noti$ies the so(rce by si&#*y dro##ing one o$ its #ac%ets! Second, the 2arning bit ðod dro#s a #ac%et on*y 2hen there is no b($$er s#ace *e$t, 2hereas RE= dro#s #ac%ets be$ore a** the b($$er are e7ha(sted! 24. The ro(ter has to do a##ro7i&ate*y the sa&e a&o(nt o$ 2or% )(e(eing a #ac%et, no &atter ho2 big it is! There is *itt*e do(bt that #rocessing 1+ #ac%6 ets o$ 1++ bytes each is &(ch &ore 2or% than #rocessing 1 #ac%et o$ 1+++ bytes! 25. It is not #ossib*e to send any #ac%ets greater than 1+2/ bytes, e-er! 26. Aith a to%en e-ery , 9sec, 2++,+++ ce**s'sec can be sent! Each ce** ho*ds / data bytes or ; / bits! The net data rate is then ?6! Mb#s! 27. The nai-e ans2er says that at 6 Mb#s it ta%es /'; sec to drain an &egabit b(c%et! 8o2e-er, this ans2er is 2rong, beca(se d(ring that inter-a*, &ore to%ens arri-e! The correct ans2er can be obtained by (sing the $or&(*a S =C'4M −. 5! S(bstit(ting, 2e get S = '46 −15 or 1!6 sec! 28. <a** the *ength o$ the &a7i&(& b(rst inter-a* .t! In the e7tre&e case, the b(c%et is $(** at the start o$ the inter-a* 41 Mbyte5 and another 1 0 # Mbytes co&e in d(ring the inter-a*! The o(t#(t d(ring the trans&ission b(rst con6 tains ,0 # Mbytes! E)(ating these t2o )(antities, 2e get 1 +10 # =,0 t! So*-ing this e)(ation, 2e get .# is 2, &sec!
PROBLEM SOLUTIONS 0OR <8"PTER , 27
29. The band2idths in MB'sec are as $o**o2s> ">2,B>+,<>1,E>;,8>;,E>;,J> 2, and L>1! 30. 8ere 9is 2 &i**ion and . is 1!, &i**ion, so . =. / 9is +!?,, and $ro& )(e(e6ing theory, each #ac%et e7#eriences a de*ay $o(r ti&es 2hat it 2o(*d in an id*e syste&! The ti&e in an id*e syste& is ,++ nsec, here it is 2 9sec! Aith 1+ ro(ters a*ong a #ath, the )(e(eing #*(s ser-ice ti&e is 2+ 9sec! 31. There is no g(arantee! I$ too &any #ac%ets are e7#edited, their channe* &ay ha-e e-en 2orse #er$or&ance than the reg(*ar channe*! 32. It is needed in both! E-en in a concatenated -irt(a*6circ(it net2or%, so&e net2or%s a*ong the #ath &ight acce#t 1+2/6byte #ac%ets, and others &ight on*y acce#t / 6byte #ac%ets! 0rag&entation is sti** needed! 33. No #rob*e&! E(st enca#s(*ate the #ac%et in the #ay*oad $ie*d o$ a datagra& be*onging to the s(bnet being #assed thro(gh and send it!
34. The initia* IP datagra& 2i** be $rag&ented into t2o IP datagra&s at I1! No other $rag&entation 2i** occ(r! Lin% A<+1> ;.n=#h H @/+M 8D H7MD/ H+MM/ H+M>!!$.# H+ Lin% +1<+2> 415 ;.n=#h H ,++M 8D H7MD/ H+MM/ H1M>!!$.# H+ 425 ;.n=#h H /6+M 8D H7MD/ H+MM/ H+M>!!$.# H6+ Lin% +2<B> 415 ;.n=#h H ,++M 8D H7MD/ H+MM/ H1M>!!$.# H+ 425 ;.n=#h H /6+M 8D H7MD/ H+MM/ H+M>!!$.# H6+ 35. I$ the bit rate o$ the *ine is b, the n(&ber o$ #ac%ets'sec that the ro(ter can e&it is b/ 1@2, so the n(&ber o$ seconds it ta%es to e&it a #ac%et is 1@ 2/b! To #(t o(t 6,,,;6 #ac%ets ta%es 2 2@ /b sec! E)(ating this to the &a7i&(& #ac%et *i$eti&e, 2e get 2 2@ /b =1+! Then, b is abo(t ,;,6 ?,+@1 b#s! 36. Since the in$or&ation is needed to ro(te e-ery $rag&ent, the o#tion &(st a##ear in e-ery $rag&ent! 37. Aith a 26bit #re$i7, there 2o(*d ha-e been 1 bits *e$t o-er to indicate the net62or%! <onse)(ent*y, the n(&ber o$ net2or%s 2o(*d ha-e been 2 1 or 262,1//! 8o2e-er, a** +s and a** 1s are s#ecia*, so on*y 262,1/2 are a-ai*6ab*e! 38. The address is 1@/!/?!21!1;+! 39. The &as% is 2+ bits *ong, so the net2or% #art is 2+ bits! The re&aining 12 bits are $or the host, so /+@6 host addresses e7ist!
28 PROBLEM SOLUTIONS 0OR <8"PTER ,
40. To start 2ith, a** the re)(ests are ro(nded (# to a #o2er o$ t2o! The starting address, ending address, and &as% are as $o**o2s> A? 1@ !16!+!+ P 1@ !16!1,!2,, 2ritten as 1@ !16!+!+'2+ B? 1@ !16!16!+ P 1@ !2;!1,!2,, 2ritten as 1@ !16!16!+'21 C? 1@ !16!;2!+ P 1@ !/?!1,!2,, 2ritten as 1@ !16!;2!+'2+ D? 1@ !16!6/!+ P 1@ !@,!1,!2,, 2ritten as 1@ !16!6/!+'1@ 41. They can be aggregated to ,?!6!@6'1@! 42. It is s($$icient to add one ne2 tab*e entry> 2@!1 !+!+'22 $or the ne2 b*oc%! I$ an inco&ing #ac%et &atches both 2@!1 !+!+'1? and 2@!1 !+!+!'22, the *ongest one 2ins! This r(*e &a%es it #ossib*e to assign a *arge b*oc% to one o(tgoing *ine b(t &a%e an e7ce#tion $or one or &ore s&a** b*oc%s 2ithin its range! 43. The #ac%ets are ro(ted as $o**o2s> 4a5 Inter$ace 1 4b5 Inter$ace + 4c5 Ro(ter 2 4d5 Ro(ter 1 4e5 Ro(ter 2 44. "$ter N"T is insta**ed, it is cr(cia* that a** the #ac%ets #ertaining to a sing*e connection #ass in and o(t o$ the co&#any -ia the sa&e ro(ter, since that is 2here the &a##ing is %e#t! I$ each ro(ter has its o2n IP address and a** tra$$ic be*onging to a gi-en connection can be sent to the sa&e ro(ter, the &a##ing can be done correct*y and &(*tiho&ing 2ith N"T can be &ade to 2or%! 45. Qo( say that "RP does not #ro-ide a ser-ice to the net2or% *ayer, it is #art o$ the net2or% *ayer and he*#s #ro-ide a ser-ice to the trans#ort *ayer! The iss(e o$ IP addressing does not occ(r in the data *in% *ayer! =ata *in% *ayer #roto6co*s are *i%e #rotoco*s 1 thro(gh 6 in <ha#! ;, 8=L<, PPP, etc! They &o-e bits $ro& one end o$ a *ine to the other!
46. R"RP has a R"RP ser-er that ans2ers re)(ests! "RP does not ha-e this! The hosts the&se*-es ans2er "RP )(eries! 47. In the genera* case, the #rob*e& is nontri-ia*! 0rag&ents &ay arri-e o(t o$ order and so&e &ay be &issing! On a retrans&ission, the datagra& &ay be $rag&ented in di$$erent6siBed ch(n%s! 0(rther&ore, the tota* siBe is not %no2n (nti* the *ast $rag&ent arri-es! Probab*y the on*y 2ay to hand*e reasse&b*y is to b($$er a** the #ieces (nti* the *ast $rag&ent arri-es and the siBe is %no2n! Then b(i*d a b($$er o$ the right siBe, and #(t the $rag&ents into the b($$er, &aintaining a bit &a# 2ith 1 bit #er bytes to %ee# trac% o$ 2hich bytes are #resent in the b($$er! Ahen a** the bits in the bit &a# are 1, the datagra& is co&#*ete!
PROBLEM SOLUTIONS 0OR <8"PTER , 29
48. "s $ar as the recei-er is concerned, this is a #art o$ ne2 datagra&, since no other #arts o$ it are %no2n! It 2i** there$ore be )(e(ed (nti* the rest sho2 (#! I$ they do not, this one 2i** ti&e o(t too! 49. "n error in the header is &(ch &ore serio(s than an error in the data! " bad address, $or e7a&#*e, co(*d res(*t in a #ac%et being de*i-ered to the 2rong host! Many hosts do not chec% to see i$ a #ac%et de*i-ered to the& is in $act rea**y $or the&! They ass(&e the net2or% 2i** ne-er gi-e the& #ac%ets intended $or another host! =ata is so&eti&es not chec%s(&&ed beca(se doing so is e7#ensi-e, and (##er *ayers o$ten do it any2ay, &a%ing it red(n6dant here! 50. Qes! The $act that the Minnea#o*is L"N is 2ire*ess does not ca(se the #ac%6ets that arri-e $or her in Boston to s(dden*y 3(&# to Minnea#o*is! The ho&e agent in Boston &(st t(nne* the& to the $oreign agent on the 2ire*ess L"N in Minnea#o*is! The best 2ay to thin% o$ this sit(ation is that the (ser has #*(gged into the Minnea#o*is L"N, the sa&e 2ay a** the other Minnea#o*is (sers ha-e! That the connection (ses radio instead o$ a 2ire is irre*e-ant! 51. Aith 16 bytes there are 2 12 or ;!/ C1+ ; addresses! I$ 2e a**ocate the& at a rate o$ 1+ 1 #er second, they 2i** *ast $or 1+ 1; years! This n(&ber is 1+++ ti&es the age o$ the (ni-erse! O$ co(rse, the address s#ace is not $*at, so they are not a**ocated *inear*y, b(t this ca*c(*ation sho2s that e-en 2ith an a**oca6tion sche&e that has an e$$iciency o$ 1'1+++ 4+!1 #ercent5, one 2i** ne-er r(n o(t! 52. The P-0#0c0l $ie*d te**s the destination host 2hich #rotoco* hand*er to gi-e the IP #ac%et to! Inter&ediate ro(ters do not need this in$or&ation, so it is not needed in the &ain header! "ct(a**y, it is there, b(t disg(ised! The N.x# h.a%.- $ie*d o$ the *ast 4e7tension5 header is (sed $or this #(r#ose! 53. <once#t(a**y, there are no changes! Technica**y, the IP addresses re)(ested are no2 bigger, so bigger $ie*ds are needed! SOLUTIONS TO CHAPTER 6 PROBLEMS 1. The LISTEN ca** co(*d indicate a 2i**ingness to estab*ish ne2 connections b(t not b*oc%! Ahen an atte&#t to connect 2as &ade, the ca**er co(*d be gi-en a signa*! It 2o(*d then e7ec(te, say, OJ or REEE<T to acce#t or re3ect the con6nection! In o(r origina* sche&e, this $*e7ibi*ity is *ac%ing! 2. The dashed *ine $ro& PASS8@E ES"AB;8S MEN" PEND8N5 to ES"A<B;8S ED is no *onger contingent on an ac%no2*edge&ent arri-ing! The tran6sition can ha##en i&&ediate*y! In essence, the PASS8@E ES"AB;8S MEN" PEND8N5 state disa##ears, since it is ne-er -isib*e at any *e-e*!
30 PROBLEM SOLUTIONS 0OR <8"PTER 6
3. I$ the c*ient sends a #ac%et to SE+@E+ 3 P>+" and the ser-er is not *istening
to that #ort, the #ac%et 2i** not be de*i-ered to the ser-er! 4. 4a5 The c*oc% ta%es ;2?6 tic%s, i!e!, ;2?6! sec to cyc*e aro(nd! "t Bero gen6eration rate, the sender 2o(*d enter the $orbidden Bone at ;2?6! −6+ H ;216! sec! 4b5 "t 2/+ se)(ence n(&bers'&in, the act(a* se)(ence n(&ber is 4t, 2here # is in sec! The *e$t edge o$ the $orbidden region is 1+4 # −;216! ). E)(ating these t2o $or&(*as, 2e $ind that they intersect at # =,;61!; sec! 5. Loo% at the second d(#*icate #ac%et in 0ig! 66114b5! Ahen that #ac%et arri-es, it 2o(*d be a disaster i$ ac%no2*edge&ents to ( 2ere sti** $*oating aro(nd! 6. =ead*oc%s are #ossib*e! 0or e7a&#*e, a #ac%et arri-es at A o(t o$ the b*(e, and A ac%no2*edges it! The ac%no2*edge&ent gets *ost, b(t A is no2 o#en 2hi*e B %no2s nothing at a** abo(t 2hat has ha##ened! No2 the sa&e thing ha##ens to B, and both are o#en, b(t e7#ecting di$$erent se)(ence n(&bers! Ti&eo(ts ha-e to be introd(ced to a-oid the dead*oc%s! 7. No! The #rob*e& is essentia**y the sa&e 2ith &ore than t2o ar&ies! 8. I$ the "A or A" ti&e is s&a**, the e-ents "<4A5 and A<4"5 are (n*i%e*y e-ents! The sender sho(*d retrans&it in state S1M the recei-erGs order does not &atter! 9. Qes! Both sides co(*d si&(*taneo(s*y e7ec(te RE<EIDE! 10. Qes, n 2 +n ; +n 6 +n ? =1. The states li$#.ning, 2ai#ing, $.n%ing, and -.c.i3in= a** i&#*y that the (ser is b*oc%ed and hence cannot a*so be in another state! 11. " Bero6*ength &essage is recei-ed by the other side! It co(*d be (sed $or sig6na*ing end o$ $i*e! 12. None o$ the #ri&iti-es can be e7ec(ted, beca(se the (ser is b*oc%ed! Th(s, on*y #ac%et arri-a* e-ents are #ossib*e, and not a** o$ these, either! Call+.), Cl.a-+.), Da#aPkt, and C-.%i# are the on*y *ega* ones! 13. The s*iding 2indo2 is si&#*er, ha-ing on*y one set o$ #ara&eters 4the 2in6do2 edges5 to &anage! 0(rther&ore, the #rob*e& o$ a 2indo2 being increased and then decreased, 2ith the TP=Us arri-ing in the 2rong order, does not occ(r! 8o2e-er, the credit sche&e is &ore $*e7ib*e, a**o2ing a dyna&ic &anage&ent o$ the b($$ering, se#arate $ro& the ac%no2*edge&ents! 14. No! IP #ac%ets contain IP addresses, 2hich s#eci$y a destination &achine! Once s(ch a #ac%et arri-ed, ho2 2o(*d the net2or% hand*er %no2 2hich #ro6cess to gi-e it toO U=P #ac%ets contain a destination #ort! This in$or&ation is essentia* so they can be de*i-ered to the correct #rocess!
PROBLEM SOLUTIONS 0OR <8"PTER 6 31
15. It is #ossib*e that a c*ient &ay get the 2rong $i*e! S(##ose c*ient A sends a re)(est $or $i*e !1 and then crashes! "nother c*ient B then (ses the sa&e #ro6toco* to re)(est another $i*e !2! S(##ose c*ient B, r(nning on the sa&e &achine as A 42ith sa&e IP address5, binds its U=P soc%et to the sa&e #ort that A 2as (sing ear*ier! 0(rther&ore, s(##ose BGs re)(est is *ost! Ahen the ser-erGs re#*y 4to "Gs re)(est5 arri-es, c*ient B 2i** recei-e it and ass(&e that it is a re#*y its o2n re)(est! 16. Sending 1+++ bits o-er a 1 .b#s *ine ta%es 1 9sec! The s#eed o$ *ight in $iber o#tics is 2++ %&'&sec, so it ta%es +!, &sec $or the re)(est to arri-e and another +!, &sec $or the re#*y to get bac%! In a**, 1+++ bits ha-e been trans&itted in 1 &sec! This is e)(i-a*ent to 1 &egabit'sec, or 1'1+ o$ 1: e$$iciency!
17. "t 1 .b#s, the res#onse ti&e is deter&ined by the s#eed o$ *ight! The best that can be achie-ed is 1 &sec! "t 1 Mb#s, it ta%es abo(t 1 &sec to #(&# o(t the 1+2/ bits, +!, &sec $or the *ast one to get to the ser-er, and +!, &sec $or the re#*y to get bac% in the best case! The best #ossib*e RP< ti&e is then 2 &sec! The conc*(sion is that i&#ro-ing the *ine s#eed by a $actor o$ 1+++ on*y 2ins a $actor o$ t2o in #er$or&ance! Un*ess the gigabit *ine is a&aB6ing*y chea#, it is #robab*y not 2orth ha-ing $or this a##*ication! 18. 8ere are three reasons! 0irst, #rocess I=s are OS6s#eci$ic! Using #rocess I=s 2o(*d ha-e &ade these #rotoco*s OS6de#endent! Second, a sing*e #rocess &ay estab*ish &(*ti#*e channe*s o$ co&&(nications! " sing*e #rocess I= 4#er #rocess5 as the destination identi$ier cannot be (sed to disting(ish bet2een these channe*s! Third, ha-ing #rocesses *isten on 2e**6%no2n #orts is easy, b(t 2e**6%no2n #rocess I=s are i&#ossib*e! 19. The de$a(*t seg&ent is ,;6 bytes! T<P adds 2+ bytes and so does IP, &a%ing the de$a(*t ,?6 bytes in tota*! 20. E-en tho(gh each datagra& arri-es intact, it is #ossib*e that datagra&s arri-e in the 2rong order, so T<P has to be #re#ared to reasse&b*e the #arts o$ a &essage #ro#er*y! 21. Each sa&#*e occ(#ies / bytes! This gi-es a tota* o$ 2,6 sa&#*es #er #ac%et! There are //,1++ sa&#*es'sec, so 2ith 2,6 sa&#*es'#ac%et, it ta%es //1++'2,6 or 1?2 #ac%ets to trans&it one secondGs 2orth o$ &(sic! 22. S(re! The ca**er 2o(*d ha-e to #ro-ide a** the needed in$or&ation, b(t there is no reason RTP co(*d not be in the %erne*, 3(st as U=P is! 23. No! " connection is identi$ied on*y by its soc%ets! Th(s, 41, #5 P 42, )5 is the on*y #ossib*e connection bet2een those t2o #orts!
32 PROBLEM SOLUTIONS 0OR <8"PTER 6
24. The AC: bit is (sed to te** 2hether the ;26bit $ie*d is (sed! B(t i$ it 2ere not there, the ;26bit $ie*d 2o(*d a*2ays ha-e to be (sed, i$ necessary ac%no2*edg6ing a byte that had a*ready ac%no2*edged! In short, it is not abso*(te*y essen6tia* $or nor&a* data tra$$ic! 8o2e-er, it #*ays a cr(cia* ro*e d(ring connection estab*ish&ent, 2here it is (sed in the second and third &essages o$ the three62ay handsha%e! 25. The entire T<P seg&ent &(st $it in the 6,,,1,6byte #ay*oad $ie*d o$ an IP #ac%et! Since the T<P header is a &ini&(& o$ 2+ bytes, on*y 6,,/@, bytes are *e$t $or T<P data! 26. One 2ay starts o(t 2ith a LISTEN!I$aSAN is recei-ed, the #rotoco* enters the SAN +ECD state! The other 2ay starts 2hen a #rocess tries to do an acti-e o#en and sends a SAN! I$ the other side 2as o#ening too, and a SAN is recei-ed, the SAN +ECD state is a*so entered! 27. E-en tho(gh the (ser is ty#ing at a (ni$or& s#eed, the characters 2i** be echoed in b(rsts! The (ser &ay hit se-era* %eys 2ith nothing a##earing on the screen, and then a** o$ a s(dden, the screen catches (# 2ith the ty#ing! Peo#*e &ay $ind this annoying! 28. The $irst b(rsts contain 2J, /J, J, and 16J bytes, res#ecti-e*y! The ne7t one is 2/ JB and occ(rs a$ter /+ &sec! 29. The ne7t trans&ission 2i** be 1 &a7i&(& seg&ent siBe! Then 2, /, and ! So a$ter $o(r s(ccesses, it 2i** be JB! 30. The s(ccessi-e esti&ates are 2@!6, 2@! /, 2@!2,6! 31. One 2indo2 can be sent e-ery 2+ &sec! This gi-es ,+ 2indo2s'sec, $or a &a7i&(& data rate o$ abo(t ;!; &i**ion bytes'sec! The *ine e$$iciency is then 26!/ Mb#s'1+++ Mb#s or 2!6 #ercent!
32. The goa* is to send 2 ;2 bytes in 12+ sec or ;,,?@1,;@/ #ay*oad bytes'sec! This is 2;, 6+ 1,++6byte $ra&es'sec! The T<P o-erhead is 2+ bytes! The IP o-erhead is 2+ bytes! The Ethernet o-erhead is 26 bytes! This &eans that $or 1,++ bytes o$ #ay*oad, 1,66 bytes &(st be sent! I$ 2e are to send 2;, 6+ $ra&es o$ 1,66 bytes e-ery second, 2e need a *ine o$ 2@@ Mb#s! Aith any6thing $aster than this 2e r(n the ris% o$ t2o di$$erent T<P seg&ents ha-ing the sa&e se)(ence n(&ber at the sa&e ti&e! 33. " sender &ay not send &ore than 2,, TP=Us, i!e!, 2,, C12 C bits, in ;+ sec! The data rate is th(s no &ore than !?+/ %b#s! 34. <o&#(te the a-erage> 42?+,+++ C+ N ?;+,+++ C1 &sec5'1,+++,+++! It ta%es ?;+ 9sec!
PROBLEM SOLUTIONS 0OR <8"PTER 6 33
35. It ta%es / C1+ =/+ instr(ctions to co#y bytes! 0orty instr(ctions ta%es /+ nsec! Th(s, each byte re)(ires , nsec o$ <PU ti&e $or co#ying! The syste& is th(s ca#ab*e o$ hand*e 2++ MB'sec or 16++ Mb#s! It can hand*e a 16.b#s *ine i$ no other bott*enec% is #resent! 36. The siBe o$ the se)(ence s#ace is 2 6/ bytes, 2hich is abo(t 2 C1+ 1@ bytes! " ?, Tb#s trans&itter (ses (# se)(ence s#ace at a rate o$ @!;?, C1+ 12 se)(ence n(&bers #er second! It ta%es 2 &i**ion seconds to 2ra# aro(nd! Since there are 6,/++ seconds in a day, it 2i** ta%e o-er ; 2ee%s to 2ra# aro(nd, e-en at ?, Tb#s! " &a7i&(& #ac%et *i$eti&e o$ *ess than ; 2ee%s 2i** #re-ent the #rob*e&! In short, going to 6/ bits is *i%e*y to 2or% $or )(ite a 2hi*e! 37. RP< o-er U=P ta%es on*y t2o #ac%ets instead o$ three! 8o2e-er, RP< has a #rob*e& i$ the re#*y does not $it in one #ac%et! 38. Qes! Pac%et 6 ac%no2*edges both the re)(est and the 0IN! I$ each one 2ere ac%no2*edged se#arate*y, 2e 2o(*d ha-e 1+ #ac%ets in the se)(ence! "*ter6nati-e*y, Pac%et @, 2hich ac%no2*edges the re#*y, and the 0IN co(*d a*so be s#*it into t2o se#arate #ac%ets! Th(s, the $act that there are nine #ac%ets is 3(st d(e to good *(c%! 39. Aith a #ac%et 11!?2 ti&es s&a**er, yo( get 11!?2 ti&es as &any #er second, so each #ac%et on*y gets 62,+'11!?2 or ,;; instr(ctions! 40. The s#eed o$ *ight in $iber and co##er is abo(t 2++ %&'&sec! 0or a 2+6%& *ine, the de*ay is 1++ 9sec one 2ay and 2++ 9sec ro(nd tri#! " 16JB #ac%et has 1@2 bits! I$ the ti&e to send 1@2 bits and get the ac%no2*edge&ent is 2++ 9sec, the trans&ission and #ro#agation de*ays are e)(a*! I$ B is the bit ti&e, then 2e ha-e 1@2B =2 C1+ −/ sec! The data rate, 1/B, is then abo(t /+ Mb#s! 41. The ans2er are> 415 1 !?, JB, 425 12, JB, 4;5 ,62!, JB, 4/5 1!@;? MB! " 166bit 2indo2 siBe &eans a sender can send at &ost 6/ JB be$ore ha-ing to 2ait $or an ac%no2*edge&ent! This &eans that a sender cannot trans&it con6tin(o(s*y (sing T<P and %ee# the #i#e $(** i$ the net2or% techno*ogy (sed is Ethernet, T;, or STS6;! 42. The ro(nd6tri# de*ay is abo(t ,/+ &sec, so 2ith a ,+ Mb#s channe* the band2idth6#rod(ct de*ay is 2? &egabits or ;,;?,,+++ bytes! Aith #ac%ets o$ 1,++ bytes, it ta%es 22,+ #ac%ets to $i** the #i#e, so the 2indo2 sho(*d be at *east 22,+ #ac%ets!
34 PROBLEM SOLUTIONS 0OR <8"PTER ?
SOLUTIONS TO CHAPTER 7 PROBLEMS 1. They are the =NS na&e, the IP address, and the Ethernet address! 2. Its IP address starts 2ith 1;+, so it is on a c*ass B net2or%! See <ha#! , $or
the IP address &a##ing! 3. It is not an abso*(te na&e, b(t re*ati-e to .c$.3*.n*! It is rea**y 3(st a shorthand notation $or -02b0a#.c$.3*.n*! 4. It &eans> &y *i#s are sea*ed! It is (sed in res#onse to a re)(est to %ee# a secret! 5. =NS is ide&#otent! O#erations can be re#eated 2itho(t har&! Ahen a #ro6cess &a%es a =NS re)(est, it starts a ti&er! I$ the ti&er e7#ires, it 3(st &a%es the re)(est again! No har& is done! 6. The #rob*e& does not occ(r! =NS na&es &*$# be shorter than 2,6 bytes! The standard re)(ires this! Th(s, a** =NS na&es $it in a sing*e &ini&(&6*ength #ac%et! 7. Qes! In $act, in 0ig! ?6; 2e see an e7a&#*e o$ a d(#*icate IP address! Re&e&ber that an IP address consists o$ a net2or% n(&ber and a host n(&ber! I$ a &achine has t2o Ethernet cards, it can be on t2o se#arate net62or%s, and i$ so, it needs t2o IP addresses! 8. It is #ossib*e! 222.la-=.<bank.c0& and 222.la-=.<bank.n(.*$ co(*d ha-e the sa&e IP address! Th(s, an entry (nder c0& and (nder one o$ the co(ntry do&ains is certain*y #ossib*e 4and co&&on5! 9. There are ob-io(s*y &any a##roaches! One is to t(rn the to#6*e-e* ser-er into a ser-er $ar&! "nother is to ha-e 26 se#arate ser-ers, one $or na&es begin6ning 2ith a, one $or b, and so on! 0or so&e #eriod o$ ti&e 4say, ; years5 a$ter introd(cing the ne2 ser-ers, the o*d one co(*d contin(e to o#erate to gi-e #eo#*e a chance to ada#t their so$t2are! 10. It be*ongs to the en-e*o#e beca(se the de*i-ery syste& needs to %no2 its -a*(e to hand*e e6&ai* that cannot be de*i-ered! 11. This is &(ch &ore co&#*icated than yo( &ight thin%! To start 2ith, abo(t ha*$ the 2or*d 2rites the gi-en na&es $irst, $o**o2ed by the $a&i*y na&e, and the other ha*$ 4e!g!, <hina and Ea#an5 do it the other 2ay! " na&ing syste& 2o(*d ha-e to disting(ish an arbitrary n(&ber o$ gi-en na&es, #*(s a $a&i*y na&e, a*tho(gh the *atter &ight ha-e se-era* #arts, as in Eohn -on Ne(&ann! Then there are #eo#*e 2ho ha-e a &idd*e initia*, b(t no &idd*e na&e! Dari6o(s tit*es, s(ch as Mr!, Miss, Mrs!, Ms!, =r!, Pro$!, or Lord, can #re$i7 the na&e! Peo#*e co&e in generations, so Er!, Sr!, III, ID, and so on ha-e to be inc*(ded! So&e #eo#*e (se their acade&ic tit*es in their na&es, so 2e need
PROBLEM SOLUTIONS 0OR <8"PTER ? 35
B!"!, B!Sc!, M!"!, M!Sc!, Ph!=!, and other degrees! 0ina**y, there are #eo#*e 2ho inc*(de certain a2ards and honors in their na&e! " 0e**o2 o$ the Roya* Society in Eng*and &ight a##end 0RS, $or e7a&#*e! By no2 2e sho(*d be ab*e to #*ease e-en the *earned> Pro$! =r! "bigai* Barbara <ynthia =oris E! de Dries III, Ph!=!, 0RS 12. It is doab*e and re*ati-e*y si&#*e! Ahen inco&ing e6&ai* arri-es, the SMTP dae&on that acce#ts it has to *oo% (# the *ogin na&e in the +CP" "> &es6sage! There is certain*y a $i*e or database 2here these na&es are *ocated! That $i*e co(*d be e7tended to ha-e a*iases o$ the $or& FF E**en!EohnsonGG that #oint to the #ersonGs &ai*bo7! Then e6&ai* can a*2ays be sent (sing the #ersonGs act(a* na&e! 13. The base 6/ encoding 2i** brea% the &essage into 1+2/ (nits o$ ; bytes each! Each o$ these 2i** be encoded as / bytes, $or a tota* o$ /+@6 bytes! I$ these are then bro%en (# into *ines o$ + bytes, ,2 s(ch *ines 2i** be needed, adding ,2 <Rs and ,2 L0s! The tota* *ength 2i** then be /2++ bytes! 14. I$ a se)(ence beginning 2ith an e)(a* sign and $o**o2ed by t2o he7adeci&a*
digits ha##ens to a##ear in the te7t, e!g!, H00, this se)(ence 2i** be &ista%6en*y inter#reted as an esca#e se)(ence! The so*(tion is to encode the e)(a* sign itse*$, so a** e)(a* signs a*2ays start esca#e se)(ences! 15. So&e e7a&#*es and #ossib*e he*#ers are a##*ication'&se7ce*4E7ce*5, a##*ication'##t 4Po2erPoint5, a(dio'&idi 4MI=I so(nd5, i&age'ti$$ 4any gra#hics #re-ie2er5, -ideo'76d- 4I(ic%Ti&e #*ayer5! 16. Qes, (se the &.$$a=./.x#.-nal<b0%( s(bty#e and 3(st send the URL o$ the $i*e instead o$ the act(a* $i*e! 17. The &essage sent 3(st be$ore *ogo(t 2i** generate a canned re#*y! Its arri-a* 2i** a*so generate a canned re#*y! "ss(&ing each &achine *ogs e6&ai* addresses to 2hich it has a*ready res#onded, no &ore canned re#*ies 2i** be sent! 18. 0irst one is any se)(ence o$ one or &ore s#aces and'or tabs! Second one is any se)(ence o$ one or &ore s#aces and'or tabs and'or bac%s#aces s(b3ect to the condition that the net res(*t o$ a##*ying a** the bac%s#aces sti** *ea-es at *east one s#ace or tab o-er! 19. The act(a* re#*ies ha-e to be done by the &essage trans$er agent! Ahen an SMTP connection co&es in, the &essage trans$er agent has to chec% 2hether a -acation dae&on is set (# to res#ond to the inco&ing e6&ai*, and i$ so, send an ans2er! The (ser trans$er agent cannot do this beca(se it 2i** not e-en be in-o%ed (nti* the (ser co&es bac% $ro& -acation!
PROBLEM SOLUTIONS 0OR <8"PTER ? 37
32. I$ the (ser has t(rned o$$ the a(to&atic dis#*aying o$ i&ages or i$ i&ages can6not be dis#*ayed $or so&e other reason, then the te7t gi-en in A;" is dis#*ayed instead o$ the i&age! "*so, i$ the &o(se ho-ers o-er the i&age, the te7t &ay be dis#*ayed! 33. " hy#er*in% consists o$ 1a hre$HT!!!TL and 1'aL! In bet2een the& is the c*ic%6ab*e te7t! It is a*so #ossib*e to #(t an i&age here! 0or e7a&#*e>
1a hre$HThtt#>''222!abcd!co&'$ooTL 1i&g srcHThtt#>''222!abcd!co&'i&'i&2TL 1'aL
34. It 2o(*d be 1a hre$HThtt#>''222!ac&!orgTL "<M 1aL ! 35. 8ere is one 2ay to do it!
<html> <head> <title> INTERBURGER </title> </head> <body> <h1> Interburger’s order form </h1> <form action="http://interburger.com/cgi-bin/burgerorder" method=POST> <p> Name <input name="customer" size=46> </p> <p> Street Address <input name="address" size=40> </p> <p> City <input name="city" size=20> </p> Burger size Gigantic <input name="size" type=radio value="gigantic"> Immense <input name="size" type=radio value="immense"> Cheese <input name="cheese" type=checkbox> <p> <input type=submit value="submit order"> </p> </form> </body> </html>
36. The #age that dis#*ays the $or& *oo%s *i%e this>
<html> <head> <title> Adder </title> </head> <body> <form action="action.php" method="post"> <p> Please enter first number: <input type="text" name="first"> </p> <p> Please enter second number: <input type="text" name="second"> </p> <input type="submit">
</form> </body> </html>
The P8P scri#t that does the #rocessing *oo%s *i%e this>
<html> <head> <title> Addition </title> </head> <body> The sum is <?PHP echo $first + $second; ?> </body> </html> 38 PROBLEM SOLUTIONS 0OR <8"PTER ?
37. 4a5 There are on*y 1/ ann(a* ca*endars, de#ending on the day o$ the 2ee% on 2hich 1 Ean(ary $a**s and 2hether the year is a *ea# year! Th(s, a Ea-aScri#t #rogra& co(*d easi*y contain a** 1/ ca*endars and a s&a** database o$ 2hich year gets 2hich ca*endar! " P8P scri#t co(*d a*so be (sed, b(t it 2o(*d be s*o2er! 4b5 This re)(ires a *arge database! It &(st be done on the ser-er by (sing P8P! 4c5 Both 2or%, b(t Ea-aScri#t is $aster! 38. There are ob-io(s*y &any #ossib*e so*(tions! 8ere is one!
<html> <head> <title> JavaScript test </title> </head> <script language="javascript" type="text/javascript"> function response(test 3 form) { var n = 2; var has 3 factors = 0; var number = eval(test 3 form.number.value); var limit = Math.sqrt(number); while (n++ < limit) if (number % n == 0) has 3 factors = 1; document.open(); document.writeln("<html> <body>"); if (has 3 factors > 0) document.writeln(number, " is not a prime"); if (has 3 factors == 0) document.writeln(number, " is a prime"); document.writeln("</body> </html>"); document.close(); } </script> </head> <body> <form name="myform"> Please enter a number: <input type="text" name="number"> <input type="button" value="compute primality" onclick="response(this.form)"> </form> </body> </html>
<*ear*y, this can be i&#ro-ed in -ario(s 2ays, b(t these re)(ire a bit &ore %no2*edge o$ Ea-aScri#t!
PROBLEM SOLUTIONS 0OR <8"PTER ? 39
39. The co&&ands sent are as $o**o2s>
GET /welcome.html HTTP/1.1 Host: www.info-source.com
Note the b*an% *ine at the end! It is &andatory! 40. Most *i%e*y 8TML #ages change &ore o$ten than EPE. $i*es! Lots o$ sites $idd*e 2ith their 8TML a** the ti&e, b(t do not change the i&ages &(ch! B(t
the e$$ecti-eness re*ates to not on*y the hit rate b(t a*so the #ayo$$! There is not &(ch di$$erence bet2een getting a ;+/ &essage and getting ,++ *ines o$ 8TML! The de*ay is essentia**y the sa&e in both cases beca(se 8TML $i*es are so s&a**! I&age $i*es are *arge, so not ha-ing to send one is a big 2in! 41. No! In the s#orts case, it is %no2n days in ad-ance that there 2i** be a big cro2d at the Aeb site and re#*icas can be constr(cted a** o-er the #*ace! The essence o$ a $*ash cro2d is that it is (ne7#ected! There 2as a big cro2d at the 0*orida Aeb site b(t not at the Io2a or Minnesota sites! Nobody co(*d ha-e #redicted this in ad-ance! 42. S(re! The ISP goes to a n(&ber o$ content #ro-iders and gets their #er&is6sion to re#*icate the content on the ISPGs site! The content #ro-ider &ight e-en #ay $or this! The disad-antage is that it is a *ot o$ 2or% $or the ISP to contact &any content #ro-iders! It is easier to *et a <=N do this! 43. It is a bad idea i$ the content changes ra#id*y! Pages $(** o$ (#6to6the second s#orts res(*ts or stoc% )(otes are not good candidates, $or e7a&#*e! Pages that are generated dyna&ica**y are not s(itab*e! 44. Each Ea#anese %an3i 42ord5 has been assigned a n(&ber! There are abo(t 2+,+++ o$ the& in Unicode! 0or an a**6Eng*ish syste&, it 2o(*d be #ossib*e to assign the 6,,+++ &ost co&&on 2ords a 166bit code and 3(st trans&it the code! The ter&ina* 2o(*d a(to&atica**y add a s#ace bet2een 2ords! Aords not in the *ist, 2o(*d be s#e**ed o(t in "S<II! Using this sche&e, &ost 2ords 2o(*d ta%e 2 bytes, $ar *ess than trans&itting the& character by character! Other sche&es &ight in-o*-e (sing 6bit codes $or the &ost co&&on 2ords and *onger codes $or *ess $re)(ent codes 4#ri&iti-e 8($$&an coding5! 45. "(dio needs 1!/ Mb#s, 2hich is 1?, JB'sec! On a 6,+6MB de-ice, there is roo& $or ;?1/ sec o$ a(dio, 2hich is 3(st o-er an ho(r! <=s are ne-er &ore than an ho(r *ong, so there is no need $or co&#ression and it is not (sed! 46. The tr(e -a*(es are sin42 i ';25 $or i $ro& 1 to ;! N(&erica**y, these sines are +!1@,, +!; ;, and +!,,6! They are re#resented as +!2,+, +!,++, and +!,++, res#ecti-e*y! Th(s, the #ercent errors are 2 , ;1, and 1+ #ercent, res#ec6ti-e*y!
40 PROBLEM SOLUTIONS 0OR <8"PTER ?
47. In theory it co(*d be (sed, b(t Internet te*e#hony is rea* ti&e! 0or &(sic, there is no ob3ection to s#ending , &in(tes to encode a ;6&in(te song! 0or rea*6ti&e s#eech, that 2o(*d not 2or%! Psychoaco(stic co&#ression co(*d 2or% $or te*e#hony, b(t on*y i$ a chi# e7isted that co(*d do the co&#ression on the $*y 2ith a de*ay o$ aro(nd 1 &sec! 48. It ta%es ,+ &sec to get a #a(se co&&and to the ser-er, in 2hich ti&e 62,+ bytes 2i** arri-e, so the *o262ater &ar% sho(*d be 2ay abo-e 62,+, #robab*y ,+,+++ to be sa$e! Si&i*ar*y, the high62ater &ar% sho(*d be at *east 62,+ bytes $ro& the to#, b(t, say, ,+,+++ 2o(*d be sa$er! 49. It introd(ces e7tra de*ay! In the straight$or2ard sche&e, a$ter , &sec ha-e e*a#sed, the $irst #ac%et can be sent! In this sche&e, the syste& has to 2ait (nti* 1+ &sec (nti* it can send the sa&#*es $or the $irst , &sec! 50. It de#ends! I$ the ca**er is not behind a $ire2a** and the ca**ee is at a reg(*ar te*e#hone, there are no #rob*e&s at a**! I$ the ca**er is behind a $ire2a** and the $ire2a** is not #ic%y abo(t 2hat *ea-es the site, it 2i** a*so 2or%! I$ the ca**ee is behind a $ire2a** that 2i** not *et U=P #ac%ets o(t, it 2i** not 2or%! 51. The n(&ber o$ bits'sec is 3(st ++ C6++ C/+ C or 1,;!6 Mb#s! 52. Qes! "n error in an I6$ra&e 2i** ca(se errors in the reconstr(ction o$ s(bse6)(ent P6$ra&es and B6$ra&es! In $act, the error 2i** contin(e to #ro#agate (nti* the ne7t I6$ra&e!
53. Aith 1++,+++ c(sto&ers each getting t2o &o-ies #er &onth, the ser-er o(t6#(ts 2++,+++ &o-ies #er &onth or abo(t 66++ #er day! I$ ha*$ o$ these are at P!M!, the ser-er &(st hand*e abo(t ;;++ &o-ies at once! I$ the ser-er has to trans&it ;;++ &o-ies at / Mb#s each, the re)(ired band2idth is 1;!2 .b#s! Using O<612 connections, 2ith a SPE ca#acity o$ ,@/ Mb#s each, at *east 2; connections 2i** be needed! " &achine ser-ing ;;++ &o-ies si&(*taneo(s*y o-er 2; O<612 connections is not a s&a** &achine! 54. The $raction o$ a** re$erences to the $irst - &o-ies is gi-en by C/1 +C/2 +C/; +C// +!!! +C/Th(s, the ratio o$ the $irst 1+++ to the $irst 1+,+++ is 1/ 1 +1/ 2 +1/ ; +1/ / +!!! +1/ 1++++ 1/ 1 +1/ 2 +1/ ; +1/ / +!!! +1/ 1+++ 3333333333333333333333333333333333 beca(se the <s cance* o(t! E-a*(ating this n(&erica**y, 2e get ?!/ 6'@!? ! Th(s, abo(t +!?6/ o$ a** re)(ests 2i** be to &o-ies on &agnetic dis%! Note2orthy is that Ui#$Gs *a2 i&#*ies that a s(bstantia* a&o(nt o$ the distri6b(tion is in the tai*, co&#ared, say, to e7#onentia* decay!
PROBLEM SOLUTIONS 0OR <8"PTER
41
SOLUTIONS TO CHAPTER 8 PROBLEMS 1. the ti&e has co&e the 2a*r(s said to ta*% o$ &any things o$ shoes and shi#s and sea*ing 2a7 o$ cabbages and %ings and 2hy the sea is boi*ing hot and 2hether #igs ha-e 2ings b(t 2ait a bit the oysters cried be$ore 2e ha-e o(r chat $or so&e o$ (s are o(t o$ breath and a** o$ (s are $at no h(rry said the car#enter they than%ed hi& &(ch $or that 0ro& "h-0*=h #h. ;00kin= 5la$$ 4T2eed*ed(& and T2eed*edee5! 2. The #*ainte7t is> a digita* co&#(ter is a &achine that can so*-e #rob*e&s $or #eo#*e by carrying o(t instr(ctions gi-en to it! 0ro& S#-*c#*-.% C0&p*#.- >-=aniBa#i0n by "! S! Tanenba(&! 3. It is>
1+11111 ++++1++ 111++++ 1+11+11 1++1+++ 11+++1+ +++1+11 ++1+111 1++11+1 111++++ 11+111+
4. "t 1++ .b#s, a bit ta%es 1+ −11 sec to be trans&itted! Aith the s#eed o$ *ight being 2 C1+ &eters'sec, in 1 bit ti&e, the *ight #(*se achie-es a *ength o$ 2 && or 2+++ &icrons! Since a #hoton is abo(t 1 &icron in *ength, the #(*se is 2+++ #hotons *ong! Th(s, 2e are no2here near one #hoton #er bit e-en at 1++ .b#s! On*y at 2++ Tb#s do 2e achie-e 1 bit #er #hoton! 5. 8a*$ the ti&e Tr(dy 2i** g(ess right! "** those bits 2i** be regenerated correct*y! The other ha*$ she 2i** g(ess 2rong and send rando& bits to Bob! 8a*$ o$ these 2i** be 2rong! Th(s, 2,: o$ the bits she #(ts on the $iber 2i** be 2rong! BobGs one6ti&e #ad 2i** th(s be ?,: right and 2,: 2rong! 6. I$ the intr(der had in$inite co&#(ting #o2er, they 2o(*d be the sa&e, b(t since that is not the case, the second one is better! It $orces the intr(der to do a co&#(tation to see i$ each %ey tried is correct! I$ this co&#(tation is e7#en6si-e, it 2i** s*o2 the intr(der do2n! 7. Qes! " contig(o(s se)(ence o$ P6bo7es can be re#*aced by a sing*e P6bo7! Si&i*ar*y $or S6bo7es! 8. 0or each #ossib*e ,66bit %ey, decry#t the $irst ci#herte7t b*oc%! I$ the res(*t6ing #*ainte7t is *ega*, try the ne7t b*oc%, etc! I$ the #*ainte7t is i**ega*, try the ne7t %ey! 9. The e)(ation 2 n =1+ 1, te**s (s n, the n(&ber o$ do(b*ing #eriods needed! So*-ing, 2e get n =1, *og 2 1+ or n =,+ do(b*ing #eriods, 2hich is ?, years!
E(st b(i*ding that &achine is )(ite a 2ay o$$, and MooreGs *a2 &ay not con6tin(e $or ?, &ore years!
42 PROBLEM SOLUTIONS 0OR <8"PTER
10. The e)(ation 2e need to so*-e is 2 2,6 =1+ n ! Ta%ing co&&on *ogarith&s, 2e get n =2,6 *og 2, so n =??! The n(&ber o$ %eys is th(s 1+ ?? ! The n(&ber o$ stars in o(r ga*a7y is abo(t 1+ 12 and the n(&ber o$ ga*a7ies is abo(t 1+ , so there are abo(t 1+ 2+ stars in the (ni-erse! The &ass o$ the s(n, a ty#ica* star, is 2 C1+ ;; gra&s! The s(n is &ade &ost*y o$ hydrogen and the n(&ber o$ ato&s in 1 gra& o$ hydrogen is abo(t 6 C1+ 2; 4"-ogadroGs n(&ber5! So the n(&ber o$ ato&s in the s(n is abo(t 1!2 C1+ ,? ! Aith 1+ 2+ stars, the n(&ber o$ ato&s in a** the stars in the (ni-erse is abo(t 1+ ?? ! Th(s, the n(&ber o$ 2,66bit "ES %eys is e)(a* to the n(&ber o$ ato&s in the 2ho*e (ni-erse 4ignoring the dar% &atter5! <onc*(sion> brea%ing "ES62,6 by br(te $orce is not *i%e*y to ha##en any ti&e soon! 11. =ES &i7es the bits #retty thoro(gh*y, so a sing*e bit error in b*oc% C i 2i** co&#*ete*y garb*e b*oc% P i ! In addition, one bit 2i** be 2rong in b*oc% P i +1 ! 8o2e-er, a** s(bse)(ent #*ainte7t b*oc%s 2i** be correct! " sing*e bit error th(s on*y a$$ects t2o #*ainte7t b*oc%s! 12. Un$ort(nate*y, e-ery #*ainte7t b*oc% starting at P i +1 2i** be 2rong no2, since a** the in#(ts to the VOR bo7es 2i** be 2rong! " $ra&ing error is th(s &(ch &ore serio(s than an in-erted bit! 13. <i#her b*oc% chaining #rod(ces bytes o$ o(t#(t #er encry#tion! <i#her $eedbac% &ode #rod(ces 1 byte o$ o(t#(t #er encry#tion! Th(s, ci#her b*oc% chaining is eight ti&es &ore e$$icient 4i!e!, 2ith the sa&e n(&ber o$ cyc*es yo( can encry#t eight ti&es as &(ch #*ainte7t5! 14. 4a5 0or these #ara&eters, B =6+, so 2e &(st choose % to be re*ati-e*y #ri&e to 6+! Possib*e -a*(es are> ?, 11, 1;, 1?, and 1@! 4b5 I$ . satis$ies the e)(ation 1. =1 &od ;6+, then ? . &(st be ;61, ?21, 1+ 1, 1//1, etc! =i-iding each o$ these in t(rn by ? to see 2hich is di-isib*e by ?, 2e $ind that ?21'? H 1+;, hence . =1+6. 4c5 Aith these #ara&eters, . =6. To encry#t P 2e (se the $(nction C =P ; &od ,C. 0or P H 1 to 1+, C H 1, , 2?, @, 1,, ,1, 1;, 1?, 1/, and 1+, res#ecti-e*y! 15. Maria sho(*d consider changing her %eys! This is beca(se it is re*ati-e*y easy $or 0rances to $ig(re o(t MariaGs #ri-ate %ey as $o**o2s! 0rances %no2s MariaGs #(b*ic %ey is (. 1, n 15! 0rances notices n 2 =n 1! 0rances no2 can g(ess MariaGs #ri-ate %ey4 % 1, n 15 by si&#*y en(&erating di$$erent so*(tions o$ the e)(ation % 1 ×. 1 =1 &0%n 1! 16. No! The sec(rity is based on ha-ing a strong cry#to a*gorith& and a *ong %ey! The 8@ is not rea**y essentia*! The %ey is 2hat &atters! 17. The + A s $ro& the *ast &essage &ay sti** be in R"M! I$ this is *ost, Tr(dy can try to re#*ay the &ost recent &essage to Bob, ho#ing that he 2i** not see that it is a d(#*icate! One so*(tion is $or Bob to 2rite the + A o$ e-ery inco&ing
PROBLEM SOLUTIONS 0OR <8"PTER
43
&essage to dis% b.!0-. doing the 2or%! In this case, the re#*ay attac% 2i** not 2or%! 8o2e-er, there is no2 a danger that i$ a re)(est is 2ritten to dis% $o*6*o2ed short*y by a crash, the re)(est is ne-er carried o(t! 18. I$ Tr(dy re#*aces both #arts, 2hen Bob a##*ies "*iceGs #(b*ic %ey to the sig6nat(re, he 2i** get soðing that is not the &essage digest o$ the #*ainte7t!
Tr(dy can #(t in a $a*se &essage and she can hash it, b(t she cannot sign it 2ith "*iceGs #ri-ate %ey! 19. Ahen a c(sto&er, say, Sa&, indicates that he 2ants to b(y so&e #ornogra6#hy, ga&b*e, or 2hate-er, the Ma$ia order a dia&ond on Sa&Gs credit card $ro& a 3e2e*er! Ahen the 3e2e*er sends a contract to be signed 4#res(&ab*y inc*(ding the credit card n(&ber and a Ma$ia #ost o$$ice bo7 as address5, the Ma$ia $or2ards the hash o$ the 3e2e*erGs &essage to Sa&, a*ong 2ith a con6tract signing (# Sa& as a #ornogra#hy or ga&b*ing c(sto&er! I$ Sa& 3(st signs b*ind*y 2itho(t noticing that the contract and signat(re do not &atch, the Ma$ia $or2ard the signat(re to the 3e2e*er, 2ho then shi#s the& the dia6&ond! I$ Sa& *ater c*ai&s he did not order a dia&ond, the 3e2e*er 2i** be ab*e to #rod(ce a signed contract sho2ing that he did! 20. Aith 2+ st(dents, there are 42+ C1@)/ 2 =1@+ #airs o$ st(dents! The #robabi*6ity that the st(dents in any #air ha-e the sa&e birthday is 1';6,, and the #ro6babi*ity that they ha-e di$$erent birthdays is ;6/';6,! The #robabi*ity that a** 1@+ #airs ha-e di$$erent birthdays is th(s 4;64/ ;6,51@+ ! This n(&ber is abo(t +!,@/! I$ the #robabi*ity that a** #airs are &is&atches is +!,@/, then the #ro6babi*ity that one or &ore #airs ha-e the sa&e birthday is abo(t +!/+6! 21. The secretary can #ic% so&e n(&ber 4e!g!, ;25 s#aces in the *etter, and #oten6tia**y re#*ace each one by s#ace, bac%s#ace, s#ace! Ahen -ie2ed on the ter6&ina*, a** -ariants 2i** *oo% a*i%e, b(t a** 2i** ha-e di$$erent &essage digests, so the birthday attac% sti** 2or%s! "*ternati-e*y, adding s#aces at the end o$ *ines, and interchanging s#aces and tabs can a*so be (sed! 22. It is doab*e! "*ice encry#ts a nonce 2ith the shared %ey and sends it to Bob! Bob sends bac% a &essage encry#ted 2ith the shared %ey containing the nonce, his o2n nonce, and the #(b*ic %ey! Tr(dy cannot $orge this &essage, and i$ she sends rando& 3(n%, 2hen decry#ted it 2i** not contain "*iceGs nonce! To co&#*ete the #rotoco*, "*ice sends bac% BobGs nonce encry#ted 2ith BobGs #(b*ic %ey! 23. Ste# 1 is to -eri$y the V!,+@ certi$icate (sing the root <"Gs #(b*ic %ey! I$ it is gen(ine, she no2 has BobGs #(b*ic %ey, a*tho(gh she sho(*d chec% the <RL i$ there is one! B(t to see i$ it is Bob on the other end o$ the connection, she needs to %no2 i$ Bob has the corres#onding #ri-ate %ey! She #ic%s a nonce and sends it to hi& 2ith his #(b*ic %ey! I$ Bob can send it bac% in #*ainte7t, she is con-inced that it is Bob!
PROBLEM SOLUTIONS 0OR <8"PTER
43
&essage to dis% b.!0-. doing the 2or%! In this case, the re#*ay attac% 2i** not 2or%! 8o2e-er, there is no2 a danger that i$ a re)(est is 2ritten to dis% $o*6*o2ed short*y by a crash, the re)(est is ne-er carried o(t! 18. I$ Tr(dy re#*aces both #arts, 2hen Bob a##*ies "*iceGs #(b*ic %ey to the sig6nat(re, he 2i** get soðing that is not the &essage digest o$ the #*ainte7t! Tr(dy can #(t in a $a*se &essage and she can hash it, b(t she cannot sign it 2ith "*iceGs #ri-ate %ey! 19. Ahen a c(sto&er, say, Sa&, indicates that he 2ants to b(y so&e #ornogra6#hy, ga&b*e, or 2hate-er, the Ma$ia order a dia&ond on Sa&Gs credit card $ro& a 3e2e*er! Ahen the 3e2e*er sends a contract to be signed 4#res(&ab*y inc*(ding the credit card n(&ber and a Ma$ia #ost o$$ice bo7 as address5, the Ma$ia $or2ards the hash o$ the 3e2e*erGs &essage to Sa&, a*ong 2ith a con6tract signing (# Sa& as a #ornogra#hy or ga&b*ing c(sto&er! I$ Sa& 3(st signs b*ind*y 2itho(t noticing that the contract and signat(re do not &atch, the Ma$ia $or2ard the signat(re to the 3e2e*er, 2ho then shi#s the& the dia6&ond!
I$ Sa& *ater c*ai&s he did not order a dia&ond, the 3e2e*er 2i** be ab*e to #rod(ce a signed contract sho2ing that he did! 20. Aith 2+ st(dents, there are 42+ C1@)/ 2 =1@+ #airs o$ st(dents! The #robabi*6ity that the st(dents in any #air ha-e the sa&e birthday is 1';6,, and the #ro6babi*ity that they ha-e di$$erent birthdays is ;6/';6,! The #robabi*ity that a** 1@+ #airs ha-e di$$erent birthdays is th(s 4;64/ ;6,51@+ ! This n(&ber is abo(t +!,@/! I$ the #robabi*ity that a** #airs are &is&atches is +!,@/, then the #ro6babi*ity that one or &ore #airs ha-e the sa&e birthday is abo(t +!/+6! 21. The secretary can #ic% so&e n(&ber 4e!g!, ;25 s#aces in the *etter, and #oten6tia**y re#*ace each one by s#ace, bac%s#ace, s#ace! Ahen -ie2ed on the ter6&ina*, a** -ariants 2i** *oo% a*i%e, b(t a** 2i** ha-e di$$erent &essage digests, so the birthday attac% sti** 2or%s! "*ternati-e*y, adding s#aces at the end o$ *ines, and interchanging s#aces and tabs can a*so be (sed! 22. It is doab*e! "*ice encry#ts a nonce 2ith the shared %ey and sends it to Bob! Bob sends bac% a &essage encry#ted 2ith the shared %ey containing the nonce, his o2n nonce, and the #(b*ic %ey! Tr(dy cannot $orge this &essage, and i$ she sends rando& 3(n%, 2hen decry#ted it 2i** not contain "*iceGs nonce! To co&#*ete the #rotoco*, "*ice sends bac% BobGs nonce encry#ted 2ith BobGs #(b*ic %ey! 23. Ste# 1 is to -eri$y the V!,+@ certi$icate (sing the root <"Gs #(b*ic %ey! I$ it is gen(ine, she no2 has BobGs #(b*ic %ey, a*tho(gh she sho(*d chec% the <RL i$ there is one! B(t to see i$ it is Bob on the other end o$ the connection, she needs to %no2 i$ Bob has the corres#onding #ri-ate %ey! She #ic%s a nonce and sends it to hi& 2ith his #(b*ic %ey! I$ Bob can send it bac% in #*ainte7t, she is con-inced that it is Bob!
44 PROBLEM SOLUTIONS 0OR <8"PTER
24. 0irst "*ice estab*ishes a co&&(nication channe* 2ith D and as%s D $or a certi$icate to -eri$y his #(b*ic %ey! S(##ose D #ro-ides a certi$icate signed by another <" Q! I$ "*ice does not %no2 Q, she re#eats the abo-e ste# 2ith Q! "*ice contin(es to do this, (nti* she recei-es a certi$icate -eri$ying the #(b*ic %ey o$ a <" E signed by A and "*ice %no2s "Gs #(b*ic %ey! Note that this &ay contin(e (nti* a root is reached, that is, A is the root! "$ter this "*ice -eri$ies the #(b*ic %eys in re-erse order starting $ro& the certi$icate that E #ro-ided! In each ste# d(ring -eri$ication, she a*so chec%s the <RL to &a%e s(re that the certi$icate #ro-ided ha-e not been re-o%ed! 0ina**y, a$ter -eri$y6ing BobGs #(b*ic %ey, "*ice ens(res that she is indeed to ta*%ing to Bob (sing the sa&e ðod as in the #re-io(s #rob*e&! 25. No! "8 in trans#ort &ode inc*(des the IP header in the chec%s(&! The N"T bo7 changes the so(rce address, r(ining the chec%s(&! "** #ac%ets 2i** be #ercei-ed as ha-ing errors! 26. 8M"<s are &(ch $aster co&#(tationa**y! 27. Inco&ing tra$$ic &ight be ins#ected $or the #resence o$ -ir(ses! O(tgoing tra$$ic &ight be ins#ected to see i$ co&#any con$identia* in$or&ation is *ea%6ing o(t! <hec%ing $or -ir(ses &ight 2or% i$ a good anti-ir(s #rogra& is (sed! <hec%ing o(tgoing tra$$ic, 2hich &ight be encry#ted, is near*y ho#e*ess against a serio(s atte&#t to *ea% in$or&ation! 28. I$ Ei& does not 2ant to re-ea* 2ho he is co&&(nicating 2ith to anyone 4inc*(ding his o2n syste& ad&inistrator, then Ei& needs to (se additiona* sec(rity &echanis&s! Re&e&ber that DPN #ro-ides sec(rity $or co&&(nica6tion on*y o-er the Internet 4o(tside the organiBation5! It does not #ro-ide any sec(rity $or co&&(nication inside the organiBation! I$ Ei& on*y 2ants to %ee#
his co&&(nication sec(re $ro& #eo#*e o(tside the co&#any, a DPN is s($$icient! 29. Qes! S(##ose that Tr(dy VORs a rando& 2ord 2ith the start o$ the #ay*oad and then VORs the sa&e 2ord 2ith the chec%s(&! The chec%s(& 2i** sti** be correct! Th(s, Tr(dy is ab*e to garb*e &essages and not ha-e the& be detected beca(se she can &ani#(*ate the chec%s(& thro(gh the encry#tion! 30. In &essage 2, #(t + B inside the encry#ted &essage instead o$ o(tside it! In this 2ay, Tr(dy 2i** not be ab*e to disco-er + B and the re$*ection attac% 2i** not 2or%! 31. Bob %no2s that = x &od n =1@1! 8e co&#(tes 1@1 1, &od ?1@ =/+! "*ice %no2s that = ( &od n =,/;! She co&#(tes ,/; 16 &od n =/+! The %ey is /+! The si&#*est 2ay to do the abo-e ca*c(*ations is to (se the UNIV bc #rogra&!
PROBLEM SOLUTIONS 0OR <8"PTER
45
32. There is nothing Bob %no2s that Tr(dy does not %no2! "ny res#onse Bob can gi-e, Tr(dy can a*so gi-e! Under these circ(&stances, it is i&#ossib*e $or "*ice to te** i$ she is ta*%ing to Bob or to Tr(dy! 33. The J=< needs so&e 2ay o$ te**ing 2ho sent the &essage, hence 2hich decry#tion %ey to a##*y to it! 34. No! "** Tr(dy has to do is ca#t(re t2o &essages $ro& or to the sa&e (ser! She can then try decry#ting both o$ those 2ith the sa&e %ey! I$ the rando& n(&ber $ie*d in both o$ the& is the sa&e, bingo, she has the right %ey! "** this sche&e does is increase her 2or%*oad by a $actor o$ t2o! 35. The t2o rando& n(&bers are (sed $or di$$erent #(r#oses! + A is (sed to con6-ince "*ice she is ta*%ing to the J=<! + A 2 is (sed to con-ince "*ice she is ta*%ing to Bob *ater! Both are needed! 36. I$ "S goes do2n, ne2 *egiti&ate (sers 2i** not be ab*e to a(thenticate the&6se*-es, that is, get a T.S tic%et! So, they 2i** not be ab*e to access any ser-ers in the organiBation! Users that a*ready ha-e a T.S tic%et 4obtained $ro& "S be$ore it 2ent do2n5 can contin(e to access the ser-ers (nti* their T.S tic%et *i$eti&e e7#ires! I$ T.S goes do2n, on*y those (sers that a*ready ha-e a ser-er tic%et 4obtained $ro& T.S be$ore it 2ent do2n5 $or a ser-er S 2i** be ab*e to access S (nti* their ser-er tic%et *i$eti&e e7#ires! In both cases, no sec(rity -io*ation 2i** occ(r! 37. It is not essentia* to send + B encry#ted! Tr(dy has no 2ay o$ %no2ing it, and it 2i** not be (sed again, so it is not rea**y secret! On the other hand, doing it this 2ay a**o2s a tryo(t o$ : S to &a%e do(b*y s(re that it is a** right be$ore sending data! "*so, 2hy gi-e Tr(dy $ree in$or&ation abo(t BobGs rando& n(&ber generatorO In genera*, the *ess sent in #*ainte7t, the better, and since the cost is so *o2 here, "*ice &ight as 2e** encry#t + B ! 38. The ban% sends a cha**enge 4a *ong rando& n(&ber5 to the &erchantGs co&6#(ter, 2hich then gi-es it to the card! The <PU on the card then trans$or&s it in a co&#*e7 2ay that de#ends on the PIN code ty#ed direct*y into the card! The res(*t o$ this trans$or&ation is gi-en to the &erchantGs co&#(ter $or trans&ission to the ban%! I$ the &erchant ca**s (# the ban% again to r(n another transaction, the ban% 2i** send a ne2 cha**enge, so $(** %no2*edge o$ the o*d one is 2orth*ess! E-en i$ the &erchant %no2s the a*gorith& (sed by the s&art cards, he does not %no2 the c(sto&erGs PIN code, since it is ty#ed direct*y into the card! The on6card dis#*ay is needed to #re-ent the &erchant $ro& dis#*aying> FF P(rchase #rice is /@!@,GG b(t te**ing the ban% it is /@@!@,! 39. <o&#ression sa-es band2idth, b(t &ore i&#ortant, it a*so 2i#es o(t the $re6)(ency
in$or&ation containined in the #*ainte7t 4e!g!, that FF eGG is the &ost co&&on *etter in Eng*ish te7t5! In e$$ect, it con-erts the #*ainte7t into 3(n%, increasing the a&o(nt o$ 2or% the cry#tana*yst &(st do to brea% the &essage!
46 PROBLEM SOLUTIONS 0OR <8"PTER
40. No! S(##ose the address 2as a &ai*ing *ist! Each #erson 2o(*d ha-e his or her o2n #(b*ic %ey! Encry#ting the I=E" %ey 2ith 3(st one #(b*ic %ey 2o(*d not 2or%! It 2o(*d ha-e to be encry#ted 2ith &(*ti#*e #(b*ic %eys! 41. In ste# ;, the ISP as%s $or 222.#-*%(<#h.<in#-*%.-.c0& and it is ne-er s(#6#*ied! It 2o(*d be better to s(##*y the IP address to be *ess cons#ic(o(s! The res(*t sho(*d be &ar%ed as (ncacheab*e so the tric% can be (sed *ater i$ neces6sary! 42. The =NS code is #(b*ic, so the a*gorith& (sed $or I= generation is #(b*ic! I$ it is a rando& n(&ber generator, (sing rando& I=s hard*y he*#s at a**! By (sing the sa&e s#oo$ing attac% as sho2n in the te7t, Tr(dy can *earn the c(rrent 4rando&5 I=! Since rando& n(&ber generators are co&#*ete*y deter6&inistic, i$ Tr(dy %no2s one I=, she can easi*y ca*c(*ate the ne7t one! I$ the rando& n(&ber generated by the a*gorith& is VORed 2ith the ti&e, that &a%es it *ess #redictab*e, e7ce#t that Tr(dy a*so %no2s the ti&e! VORing the rando& n(&ber 2ith the ti&e and a*so 2ith the n(&ber o$ *oo%(#s the ser-er has done in the #ast &in(te 4soðing Tr(dy does not %no25 and then ta%ing the S8"61 hash o$ this is &(ch better! The tro(b*e here is that S8"61 ta%es a nontri-ia* a&o(nt o$ ti&e and =NS has to be $ast! 43. The nonces g(ard against re#*ay attac%s! Since each #arty contrib(tes to the %ey, i$ an intr(der tries to re#*ay o*d &essages, the ne2 %ey generated 2i** not &atch the o*d one! 44. Easy! M(sic is 3(st a $i*e! It does not &atter 2hat is in the $i*e! There is roo& $or 2@/,@12 bytes in the *o26order bits! MP;s re)(ire ro(gh*y 1 MB #er &in(te, so abo(t 1 sec o$ &(sic co(*d $it! 45. "*ice co(*d hash each &essage and sign it 2ith her #ri-ate %ey! Then she co(*d a##end the signed hash and her #(b*ic %ey to the &essage! Peo#*e co(*d co&#are -eri$y the signat(re and co&#are the #(b*ic %ey to the one "*ice (sed *ast ti&e! I$ Tr(dy tried to i&#ersonate "*ice and a##ended "*iceGs #(b*ic %ey, she 2o(*d not be ab*e to get the hash right! I$ she (sed her o2n #(b*ic %ey, #eo#*e 2o(*d see it 2as not the sa&e as *ast ti&e!