操作系统第九版部分课后作业习题答案分析解析.docx

上传人:b****2 文档编号:11615120 上传时间:2023-06-01 格式:DOCX 页数:15 大小:21.04KB
下载 相关 举报
操作系统第九版部分课后作业习题答案分析解析.docx_第1页
第1页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第2页
第2页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第3页
第3页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第4页
第4页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第5页
第5页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第6页
第6页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第7页
第7页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第8页
第8页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第9页
第9页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第10页
第10页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第11页
第11页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第12页
第12页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第13页
第13页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第14页
第14页 / 共15页
操作系统第九版部分课后作业习题答案分析解析.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

操作系统第九版部分课后作业习题答案分析解析.docx

《操作系统第九版部分课后作业习题答案分析解析.docx》由会员分享,可在线阅读,更多相关《操作系统第九版部分课后作业习题答案分析解析.docx(15页珍藏版)》请在冰点文库上搜索。

操作系统第九版部分课后作业习题答案分析解析.docx

操作系统第九版部分课后作业习题答案分析解析

CHAPTER9VirtualMemory

PracticeExercises

9.1Underwhatcircumstancesdopagefaultsoccur?

Describetheactions

takenbytheoperatingsystemwhenapagefaultoccurs.

Answer:

Apagefaultoccurswhenanaccesstoapagethathasnotbeen

broughtintomainmemorytakesplace.Theoperatingsystemverifies

thememoryaccess,abortingtheprogramifitisinvalid.Ifitisvalid,a

freeframeislocatedandI/Oisrequestedtoreadtheneededpageinto

thefreeframe.UponcompletionofI/O,theprocesstableandpagetable

areupdatedandtheinstructionisrestarted.

9.2Assumethatyouhaveapage-referencestringforaprocesswithm

frames(initiallyallempty).Thepage-referencestringhaslengthp;

ndistinctpagenumbersoccurinit.Answerthesequestionsforany

page-replacementalgorithms:

a.Whatisalowerboundonthenumberofpagefaults?

b.Whatisanupperboundonthenumberofpagefaults?

Answer:

a.n

b.p

9.3ConsiderthepagetableshowninFigure9.30forasystemwith12-bit

virtualandphysicaladdressesandwith256-bytepages.Thelistoffree

pageframesisD,E,F(thatis,Disattheheadofthelist,Eissecond,

andFislast).

Convertthefollowingvirtualaddressestotheirequivalentphysical

addressesinhexadecimal.Allnumbersaregiveninhexadecimal.(A

dashforapageframeindicatesthatthepageisnotinmemory.)

•9EF

•111

2930Chapter9VirtualMemory

•700

•0FF

Answer:

•9EF-0EF

•111-211

•700-D00

•0FF-EFF

9.4Considerthefollowingpage-replacementalgorithms.Rankthesealgorithmsonafive-pointscalefrom“bad”to“perfect”accordingtotheir

page-faultrate.SeparatethosealgorithmsthatsufferfromBelady’s

anomalyfromthosethatdonot.

a.LRUreplacement

b.FIFOreplacement

c.Optimalreplacement

d.Second-chancereplacement

Answer:

RankAlgorithmSufferfromBelady’sanomaly

1Optimalno

2LRUno

3Second-chanceyes

4FIFOyes

9.5Discussthehardwaresupportrequiredtosupportdemandpaging.

Answer:

Foreverymemory-accessoperation,thepagetableneedstobeconsulted

tocheckwhetherthecorrespondingpageisresidentornotandwhether

theprogramhasreadorwriteprivilegesforaccessingthepage.These

checkshavetobeperformedinhardware.ATLBcouldserveasacache

andimprovetheperformanceofthelookupoperation.

9.6Anoperatingsystemsupportsapagedvirtualmemory,usingacentral

processorwithacycletimeof1microsecond.Itcostsanadditional1

microsecondtoaccessapageotherthanthecurrentone.Pageshave1000

words,andthepagingdeviceisadrumthatrotatesat3000revolutions

perminuteandtransfers1millionwordspersecond.Thefollowing

statisticalmeasurementswereobtainedfromthesystem:

•1percentofallinstructionsexecutedaccessedapageotherthanthe

currentpage.

Oftheinstructionsthataccessedanotherpage,80percentaccessed

apagealreadyinmemory.PracticeExercises31

Whenanewpagewasrequired,thereplacedpagewasmodified50

percentofthetime.

Calculatetheeffectiveinstructiontimeonthissystem,assumingthatthe

systemisrunningoneprocessonlyandthattheprocessorisidleduring

drumtransfers.

Answer:

effectiveaccesstime=0.99×(1sec+0.008×(2sec)

+0.002×(10,000sec+1,000sec)

+0.001×(10,000sec+1,000sec)

=(0.99+0.016+22.0+11.0)sec

=34.0sec

9.7Considerthetwo-dimensionalarrayA:

intA[][]=newint[100][100];

whereA[0][0]isatlocation200inapagedmemorysystemwithpages

ofsize200.Asmallprocessthatmanipulatesthematrixresidesinpage

0(locations0to199).Thus,everyinstructionfetchwillbefrompage0.

Forthreepageframes,howmanypagefaultsaregeneratedby

thefollowingarray-initializationloops,usingLRUreplacementand

assumingthatpageframe1containstheprocessandtheothertwo

areinitiallyempty?

a.for(intj=0;j<100;j++)

for(inti=0;i<100;i++)

A[i][j]=0;

b.for(inti=0;i<100;i++)

for(intj=0;j<100;j++)

A[i][j]=0;

Answer:

a.5,000

b.50

9.8Considerthefollowingpagereferencestring:

1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6.

Howmanypagefaultswouldoccurforthefollowingreplacement

algorithms,assumingone,two,three,four,five,six,orsevenframes?

Rememberallframesareinitiallyempty,soyourfirstuniquepageswill

allcostonefaulteach.

LRUreplacement

•FIFOreplacement

Optimalreplacement32Chapter9VirtualMemory

Answer:

NumberofframesLRUFIFOOptimal

1202020

2181815

3151611

410148

58107

67107

7777

9.9Supposethatyouwanttouseapagingalgorithmthatrequiresareference

bit(suchassecond-chancereplacementorworking-setmodel),but

thehardwaredoesnotprovideone.Sketchhowyoucouldsimulatea

referencebitevenifonewerenotprovidedbythehardware,orexplain

whyitisnotpossibletodoso.Ifitispossible,calculatewhatthecost

wouldbe.

Answer:

Youcanusethevalid/invalidbitsupportedinhardwaretosimulatethe

referencebit.Initiallysetthebittoinvalid.Onfirstreferenceatraptothe

operatingsystemisgenerated.Theoperatingsystemwillsetasoftware

bitto1andresetthevalid/invalidbittovalid.

9.10Youhavedevisedanewpage-replacementalgorithmthatyouthinkmay

beoptimal.Insomecontortedtestcases,Belady’sanomalyoccurs.Isthe

newalgorithmoptimal?

Explainyouranswer.

Answer:

No.AnoptimalalgorithmwillnotsufferfromBelady’sanomalybecause

—bydefinition—anoptimalalgorithmreplacesthepagethatwillnot

beusedforthelongesttime.Belady’sanomalyoccurswhenapagereplacementalgorithmevictsapagethatwillbeneededintheimmediate

future.Anoptimalalgorithmwouldnothaveselectedsuchapage.

9.11Segmentationissimilartopagingbutusesvariable-sized“pages.”Define

twosegment-replacementalgorithmsbasedonFIFOandLRUpagereplacementschemes.Rememberthatsincesegmentsarenotthesame

size,thesegmentthatischosentobereplacedmaynotbebigenough

toleaveenoughconsecutivelocationsfortheneededsegment.Consider

strategiesforsystemswheresegmentscannotberelocated,andthose

forsystemswheretheycan.

Answer:

a.FIFO.Findthefirstsegmentlargeenoughtoaccommodatethe

incomingsegment.Ifrelocationisnotpossibleandnoonesegment

islargeenough,selectacombinationofsegmentswhosememories

arecontiguous,whichare“closesttothefirstofthelist”and

whichcanaccommodatethenewsegment.Ifrelocationispossible,

rearrangethememorysothatthefirstNsegmentslargeenoughfor

theincomingsegmentarecontiguousinmemory.Addanyleftover

spacetothefree-spacelistinbothcases.PracticeExercises33

b.LRU.Selectthesegmentthathasnotbeenusedforthelongest

periodoftimeandthatislargeenough,addinganyleftoverspace

tothefreespacelist.Ifnoonesegmentislargeenough,select

acombinationofthe“oldest”segmentsthatarecontiguousin

memory(ifrelocationisnotavailable)andthatarelargeenough.

Ifrelocationisavailable,rearrangetheoldestNsegmentstobe

contiguousinmemoryandreplacethosewiththenewsegment.

9.12Considerademand-pagedcomputersystemwherethedegreeofmultiprogrammingiscurrentlyfixedatfour.ThesystemwasrecentlymeasuredtodetermineutilizationofCPUandthepagingdisk.Theresults

areoneofthefollowingalternatives.Foreachcase,whatishappening?

CanthedegreeofmultiprogrammingbeincreasedtoincreasetheCPU

utilization?

Isthepaginghelping?

a.CPUutilization13percent;diskutilization97percent

b.CPUutilization87percent;diskutilization3percent

c.CPUutilization13percent;diskutilization3percent

Answer:

a.Thrashingisoccurring.

b.CPUutilizationissufficientlyhightoleavethingsalone,and

increasedegreeofmultiprogramming.

c.Increasethedegreeofmultiprogramming.

9.13Wehaveanoperatingsystemforamachinethatusesbaseandlimit

registers,butwehavemodifiedthemachinetoprovideapagetable.

Canthepagetablesbesetuptosimulatebaseandlimitregisters?

How

cantheybe,orwhycantheynotbe?

Answer:

Thepagetablecanbesetuptosimulatebaseandlimitregistersprovided

thatthememoryisallocatedinfixed-sizesegments.Inthisway,thebase

ofasegmentcanbeenteredintothepagetableandthevalid/invalidbit

usedtoindicatethatportionofthesegmentasresidentinthememory.

Therewillbesomeproblemwithinternalfragmentation.

9.27.Considerademand-pagingsystemwiththefollowingtime-measuredutilizations:

CPU utilization20%

Pagingdisk97.7%

Other I/O devices5%

Which(ifany)ofthefollowingwill(probably)improveCPUutilization?

Explainyouranswer.

a.Installafaster CPU.

b.Installabiggerpagingdisk.

c.Increasethedegreeofmultiprogramming.

d.Decreasethedegreeofmultiprogramming.

e.Installmoremainmemory.

f.Installafasterharddiskormultiplecontrollerswithmultipleharddisks.

g.Addprepagingtothepagefetchalgorithms.

h.Increasethepagesize.

Answer:

 Thesystemobviouslyisspendingmostofitstimepaging,indicatingover-allocation

ofmemory.Ifthelevelofmultiprogrammingisreducedresidentprocesses

wouldpagefaultlessfrequentlyandthe CPU utilizationwouldimprove.Anotherwayto

improveperformancewouldbetogetmorephysicalmemoryorafasterpagingdrum.

a.Getafaster CPU—No.

b.Getabiggerpagingdrum—No.

c.Increasethedegreeofmultiprogramming—No.

d.Decreasethedegreeofmultiprogramming—Yes.

e.Installmoremainmemory—Likelytoimprove CPU utilizationasmorepagescan

remainresidentandnotrequirepagingtoorfromthedisks.

f.I

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2