Spring 2016 COMP 3511 Homework Assignment #4
Spring 2016 COMP 3511 Homework Assignment #4
Handout
Handout ate ate ! ! Apri" Apri" 2 2 ue ue ate! ate! Ma$ Ma$ 1111
Name: Wu Bing Shu_____ ID: __2011
Name: Wu Bing Shu_____ ID: __20111271_______E-Mail:[email protected]___ 1271_______E-Mail:[email protected]___
P"ease read t%e &o""owing instru'tions 'are&u""$ (e&ore answering t%e )uestions! P"ease read t%e &o""owing instru'tions 'are&u""$ (e&ore answering t%e )uestions! •
• !"!"u sh"ul# u sh"ul# $inish the h"$inish the h"mew"% assignmentmew"% assignmentindi*idua""$indi*idua""$.. •
• &he%e a%e a t"tal "$&he%e a%e a t"tal "$44'uesti"ns.'uesti"ns. •
• When ("u w%ite ("u% answe%s) *lease t%( t" bWhen ("u w%ite ("u% answe%s) *lease t%( t" be *%e+ise an# +"n+ise.e *%e+ise an# +"n+ise. •
• ,ill in ("u% name) stu#ent ID) email an# Se+ti"n numbe% at the t"* "$ ea+h *age.,ill in ("u% name) stu#ent ID) email an# Se+ti"n numbe% at the t"* "$ ea+h *age. •
• lease $ill in ("u% answe%s in the s*a+e *%"i#e#) "% ("u +an t(*e ("u% answe%s in thelease $ill in ("u% answe%s in the s*a+e *%"i#e#) "% ("u +an t(*e ("u% answe%s in the
MS W"%# $ile. MS W"%# $ile.
•
• HomewoHomework Co""e'tion! t%e %ard'op$rk Co""e'tion! t%e %ard'op$ is %e'ui%e# an# the h"mew"% is +"lle+te# inis %e'ui%e# an# the h"mew"% is +"lle+te# in
+"lle+
+"lle+ti"n b"/ ti"n b"/ 1. &he 1. &he +"lle+"lle+ti"n b"/es l"+ate "utsi#e ""m +ti"n b"/es l"+ate "utsi#e ""m 210) nea% li$t 21 210) nea% li$t 21 3the%3the%ee a%e labels atta+he# "n the b"/es4.
a%e labels atta+he# "n the b"/es4. 1.
1. 32320 *0 *"i"intnts4 s4 MuMultlti*i*le le +h+h"i"i+e+ess 14
14 _____B______B___ is __ is the +the +"n+e*t "n+e*t in whiin whi+h a *%+h a *%"+ess "+ess is +"is +"*ie# i*ie# int" mant" main memin mem"%( $"%( $%"m%"m the se+"n#a%( mem"%( a++"%#ing t"
the se+"n#a%( mem"%( a++"%#ing t" the %e'ui%ement.the %e'ui%ement. 54 aging 54 aging B4 Deman# *aging B4 Deman# *aging 64 Segmentati"n 64 Segmentati"n D4 Swa**ing D4 Swa**ing 24
24 When a When a *%"g%a*%"g%am t%im t%ies t" es t" a++ess a++ess a *age a *age that ithat is ma**s ma**e# in ae# in a##%es##%ess s*a+s s*a+e but ne but n"t"t l"a#e# in *h(si+al mem"%() then ____6_____.
l"a#e# in *h(si+al mem"%() then ____6_____. 54 segmentati"n $ault "++u%s
54 segmentati"n $ault "++u%s B4 $atal e%%"% "++u%s
B4 $atal e%%"% "++u%s 64 *age $ault "++u%s 64 *age $ault "++u%s D4 n" e%%"% "++u%s D4 n" e%%"% "++u%s 4
4 5 5 *%"*%"+es+ess is s is th%th%ashashing ing i$ _i$ _______________5__5_____.___.
54 it is s*en#ing m"%e time *aging than e/e+uting 54 it is s*en#ing m"%e time *aging than e/e+uting B4 it is s*en#ing less time *aging than e/e+u B4 it is s*en#ing less time *aging than e/e+utingting 64 *age $ault "++u%s
64 *age $ault "++u%s
D4 swa**ing +an n"t tae *la+e D4 swa**ing +an n"t tae *la+e 4
4 &he abi&he abilit( tlit( t" e/e+ut" e/e+ute a *%"g%e a *%"g%am that am that is "nl( is "nl( *a%ti*a%tiall( iall( in mem"%( n mem"%( has benehas bene$its$its lie:
lie: AA
&he am"unt "$ *h(si+al mem"%( +ann"t *ut a +"nst%aint "n the *%"g%am &he am"unt "$ *h(si+al mem"%( +ann"t *ut a +"nst%aint "n the *%"g%am
① ①
%"g%ams $"% an e/t%emel( la%ge i%tual s*a+e +an be
%"g%ams $"% an e/t%emel( la%ge i%tual s*a+e +an be +%eate#+%eate#
② ② 68 utili9ati"n #e+%eases 68 utili9ati"n #e+%eases ③ ③ &h%"ugh*ut in+%eases &h%"ugh*ut in+%eases ④ ④
es*"nse time is n"t a$$e+te# es*"nse time is n"t a$$e+te#
⑤ ⑤
1 1
&u%na%"un# time in+%eases
⑥
ess I;< will be nee#e# t" l"a# "% swa* ea+h use% *%"g%am in mem"%(
⑦
54①②④⑤⑦
B4②③④⑤ 64①②④⑦ D4①②④⑥
=4 In the w"%ing set m"#el) $"%:
2 > 1 = 7 7 7 7 = 1 > 2 1 2 1 2
i$ DELTA ? 10) then the w"%ing set at time t1 3.7 = 14 is ___6________. 54 A1) 2) ) =) >
B4 A2) 1) >) 7) 64 A1) >) =) 7) 2 D4 A1) 2) ) ) =
>4 &he "*en $ile table has a;an __6_____ ass"+iate# with ea+h $ile. 54 $ile +"ntent
B4 $ile *e%missi"n 64 "*en +"unt D4 +l"se +"unt
74 Whi+h "ne "$ the $"ll"wing e/*lains the se'uential $ile a++ess meth"#C+
54 %an#"m a++ess a++"%#ing t" the gien b(te numbe% B4 %ea# b(tes "ne at a time) in "%#e%
64 %ea#;w%ite se'uentiall( b( %e+"%# D4 %ea#;w%ite %an#"ml( b( %e+"%#
4 Whi+h "$ the $"ll"wing is t%ue "$ the t%ee-st%u+tu%e# #i%e+t"%( st%u+tu%eC
54 8se%s +ann"t +%eate thei% "wn sub#i%e+t"%ies.
B4 8se%s +ann"t a+'ui%e *e%missi"n t" a++ess the $iles "$ "the% use%s. 64 Di%e+t"%ies +an sha%e sub#i%e+t"%ies an# $iles.
D4 It is the m"st +"mm"n #i%e+t"%( st%u+tu%e.
4 In whi+h t(*e "$ all"+ati"n meth"# ea+h $ile "++u*( a set "$ +"ntigu"us bl"+ "n the #isCA 54 6"ntigu"us all"+ati"n B4 D(nami+-st"%age all"+ati"n 64 ine# all"+ati"n D4 In#e/e# all"+ati"n 104 5 m"unt *"int is _D____.
54 a %""t "$ the $ile s(stem
B4 a l"+ati"n "$ a sha%e# $ile s(stem
64 "nl( a**%"*%iate $"% sha%e# $ile s(stems
D4 the l"+ati"n within the $ile st%u+tu%e whe%e the $ile s(stem is t" be atta+he#.
2. 30 *"ints4 FG5
.
14 3= *"ints4 5ssume we hae a #eman#-*age# mem"%(. &he *age table is hel# in %egiste%s. It taes millise+"n#s t" se%i+e a *age $ault i$ an em*t( *age is aailable "% the %e*la+e# *age is n"t m"#i$ie#) an# 20 millise+"n#s i$ the %e*la+e# *age is m"#i$ie#. Mem"%( a++ess time is 100 nan"se+"n#s.
5ssume that the *age t" be %e*la+e# is m"#i$ie# 70 *e%+ent "$ the time. What is the ma/imum a++e*table *age-$ault %ate $"% an e$$e+tie a++ess time "$ n" m"%e than 200 nan"se+"n#sC
24 3> *"ints4 5ssume that ("u a%e m"nit"%ing the %ate at whi+h the *"inte% in the +l"+ alg"%ithm 3whi+h in#i+ates the +an#i#ate *age $"% %e*la+ement4 m"es. What +an ("u sa( ab"ut the s(stem i$ ("u n"ti+e the $"ll"wing behai"%:
a4 *"inte% is m"ing $ast b4 *"inte% is m"ing sl"w
4 3 *"ints4 Is it *"ssible $"% a *%"+ess t" hae tw" w"%ing sets) "ne %e*%esenting #ata an# an"the% %e*%esenting +"#eC lease b%ie$l( e/*lain ("u% answe%.
4 3= *"ints4 6"nsi#e% a 8NIH $ile s(stem that uses in"#es t" %e*%esent $iles. &he l"gi+al a##%ess has 2 bits) an# #is bl"+ si9e is B. &he +"mbine# s+heme is use# $"% #is all"+ati"n) with 10 #i%e+t #is bl"+s) *lus "ne single) "ne #"uble) an# "ne t%i*le in#i%e+t #is bl"+s. What is the ma/imum $ile si9e that +an be su**"%te# in this $ile s(stemC
=4 3= *"ints4 What is the a#antage an# #isa#antage "$ using a a+(+li+ g%a*h #i%e+t"%(C
>4 3= *"ints4 Su**"se that a #is %"tates at 7200 M. What is the ae%age %"tati"nal laten+( "$ this #is #%ieC
. 30 *"ints4 6"nsi#e% the $"ll"wing *age %e$e%en+e st%ing:
2) 0) 1) =) 0) ) 2) ) 0) 2) 1) =) 2) ) 0) =) 1) 1) 2) 0
5ssuming #eman# *aging with &our $%ames all"+ate# t" a *%"+ess with l"+al all"+ati"n s+heme use#. lease illust%ate ea+h ste* that the $"ll"wing %e*la+ement alg"%ithms w"% $"% this %e$e%en+e st%ing an# +"m*ute the *age $aults in ea+h alg"%ithm.
14 ,I,< %e*la+ement 24 8 %e*la+ement 4 <*timal %e*la+ement
. 320 *"ints4 Dis s+he#uling *%"blem
Su**"se that a #is #%ie has =)000 +(lin#e%s) numbe%e# 0 t" . &he #%ie is +u%%entl( se%ing a %e'uest at +(lin#e% 2=02) an# the *%ei"us %e'uest was at +(lin#e% 10=. &he 'ueue "$ *en#ing %e'uests) in ,I,< "%#e%) is:
2>=) 27=) 00) 17=0) 201=) =0) =>) ) =07
Sta%ting $%"m the +u%%ent hea# *"siti"n 32=024) what is the t"tal #istan+e 3in +(lin#e%s4 that the #is a%m m"es t" satis$( all the *en#ing %e'uests $"% ea+h "$ the $"ll"wing #is-s+he#uling alg"%ithmsC a4 ,6,S 2=02-J2>=-J27=-J00-J17=0-J201=-J=0-J=>-J-J=07 &"tal: 1>1 b4 SS&, 2=02-J27=-J201=-J17=0-J=0-J2>=-J=07-J=>-J00-J &"tal: 7>7 +4 S65N 2=02-J27=-J=07-J=>-J00-J-J-J201=-J17=0-J=0 &"tal: 721 #4 6-S65N 2=02-J27=-J=07-J=>-J00-J-J-J0-J2=>-J=0-J17=0-J201= &"tal: =11 e4 << 2=02-J27=-J=07-J=>-J00-J-J201=-J17=0-J=0-J2>= &"tal 701 $4 6-<< 2=02-J27=-J=07-J=>-J00-J-J2=>-J=0-J17=0-J201= &"tal 7> >