操作系统精髓与设计原理第五版 课后题答案.docx

上传人:b****7 文档编号:9633279 上传时间:2023-02-05 格式:DOCX 页数:17 大小:64.71KB
下载 相关 举报
操作系统精髓与设计原理第五版 课后题答案.docx_第1页
第1页 / 共17页
操作系统精髓与设计原理第五版 课后题答案.docx_第2页
第2页 / 共17页
操作系统精髓与设计原理第五版 课后题答案.docx_第3页
第3页 / 共17页
操作系统精髓与设计原理第五版 课后题答案.docx_第4页
第4页 / 共17页
操作系统精髓与设计原理第五版 课后题答案.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

操作系统精髓与设计原理第五版 课后题答案.docx

《操作系统精髓与设计原理第五版 课后题答案.docx》由会员分享,可在线阅读,更多相关《操作系统精髓与设计原理第五版 课后题答案.docx(17页珍藏版)》请在冰豆网上搜索。

操作系统精髓与设计原理第五版 课后题答案.docx

操作系统精髓与设计原理第五版课后题答案

Chapter2

OperatingSystemOverview

ReviewQuestions

2.1Convenience:

Anoperatingsystemmakesacomputermoreconvenienttouse.Efficiency:

Anoperatingsystemallowsthecomputersystemresourcestobeusedinanefficientmanner.Abilitytoevolve:

Anoperatingsystemshouldbeconstructedinsuchawayastopermittheeffectivedevelopment,testing,andintroductionofnewsystemfunctionswithoutinterferingwithservice.

2.5Theexecutioncontext,orprocessstate,istheinternaldatabywhichtheoperatingsystemisabletosuperviseandcontroltheprocess.Thisinternalinformationisseparatedfromtheprocess,becausetheoperatingsystemhasinformationnotpermittedtotheprocess.Thecontextincludesalloftheinformationthattheoperatingsystemneedstomanagetheprocessandthattheprocessorneedstoexecutetheprocessproperly.Thecontextincludesthecontentsofthevariousprocessorregisters,suchastheprogramcounteranddataregisters.Italsoincludesinformationofusetotheoperatingsystem,suchasthepriorityoftheprocessandwhethertheprocessiswaitingforthecompletionofaparticularI/Oevent.

Problems

2.1Theanswersarethesamefor(a)and(b).Assumethatalthoughprocessoroperationscannotoverlap,I/Ooperationscan.

1Job:

TAT=NTProcessorutilization=50%

2Jobs:

TAT=NTProcessorutilization=100%

4Jobs:

TAT=(2N–1)NTProcessorutilization=100%

2.4Asystemcallisusedbyanapplicationprogramtoinvokeafunctionprovidedbytheoperatingsystem.Typically,thesystemcallresultsintransfertoasystemprogramthatrunsinkernelmode.

Chapter3

ProcessDescriptionandControl

ReviewQuestions

3.5Swappinginvolvesmovingpartorallofaprocessfrommainmemorytodisk.WhennoneoftheprocessesinmainmemoryisintheReadystate,theoperatingsystemswapsoneoftheblockedprocessesoutontodiskintoasuspendqueue,sothatanotherprocessmaybebroughtintomainmemorytoexecute.

3.10Theusermodehasrestrictionsontheinstructionsthatcanbeexecutedandthememoryareasthatcanbeaccessed.Thisistoprotecttheoperatingsystemfromdamageoralteration.Inkernelmode,theoperatingsystemdoesnothavetheserestrictions,sothatitcanperformitstasks.

Problems

3.1•Creationanddeletionofbothuserandsystemprocesses.Theprocessesinthesystemcanexecuteconcurrentlyforinformationsharing,computationspeedup,modularity,andconvenience.Concurrentexecutionrequiresamechanismforprocesscreationanddeletion.Therequiredresourcesaregiventotheprocesswhenitiscreated,orallocatedtoitwhileitisrunning.Whentheprocessterminates,theOSneedstoreclaimanyreusableresources.

•Suspensionandresumptionofprocesses.Inprocessscheduling,theOSneedstochangetheprocess'sstatetowaitingorreadystatewhenitiswaitingforsomeresources.Whentherequiredresourcesareavailable,OSneedstochangeitsstatetorunningstatetoresumeitsexecution.

•Provisionofmechanismforprocesssynchronization.Cooperatingprocessesmaysharedata.Concurrentaccesstoshareddatamayresultindatainconsistency.OShastoprovidemechanismsforprocessessynchronizationtoensuretheorderlyexecutionofcooperatingprocesses,sothatdataconsistencyismaintained.

•Provisionofmechanismforprocesscommunication.TheprocessesexecutingundertheOSmaybeeitherindependentprocessesorcooperatingprocesses.Cooperatingprocessesmusthavethemeanstocommunicatewitheachother.

•Provisionofmechanismsfordeadlockhandling.Inamultiprogrammingenvironment,severalprocessesmaycompeteforafinitenumberofresources.Ifadeadlockoccurs,allwaitingprocesseswillneverchangetheirwaitingstatetorunningstateagain,resourcesarewastedandjobswillneverbecompleted.

3.3Figure9.3showstheresultforasingleblockedqueue.Thefigurereadilygeneralizestomultipleblockedqueues.

Chapter4

ProcessDescriptionandControl

ReviewQuestions

4.2Lessstateinformationisinvolved.

4.5Addressspace,fileresources,executionprivilegesareexamples.

4.61.Threadswitchingdoesnotrequirekernelmodeprivilegesbecauseallofthethreadmanagementdatastructuresarewithintheuseraddressspaceofasingleprocess.Therefore,theprocessdoesnotswitchtothekernelmodetodothreadmanagement.Thissavestheoverheadoftwomodeswitches(usertokernel;kernelbacktouser).2.Schedulingcanbeapplicationspecific.Oneapplicationmaybenefitmostfromasimpleround-robinschedulingalgorithm,whileanothermightbenefitfromapriority-basedschedulingalgorithm.TheschedulingalgorithmcanbetailoredtotheapplicationwithoutdisturbingtheunderlyingOSscheduler.3.ULTscanrunonanyoperatingsystem.NochangesarerequiredtotheunderlyingkerneltosupportULTs.Thethreadslibraryisasetofapplication-levelutilitiessharedbyallapplications.

4.71.Inatypicaloperatingsystem,manysystemcallsareblocking.Thus,whenaULTexecutesasystemcall,notonlyisthatthreadblocked,butalsoallofthethreadswithintheprocessareblocked.2.InapureULTstrategy,amultithreadedapplicationcannottakeadvantageofmultiprocessing.Akernelassignsoneprocesstoonlyoneprocessoratatime.Therefore,onlyasinglethreadwithinaprocesscanexecuteatatime.

Problems

4.2Because,withULTs,thethreadstructureofaprocessisnotvisibletotheoperatingsystem,whichonlyschedulesonthebasisofprocesses.

Chapter5

Concurrency:

MutualExclusionandSynchronization

ReviewQuestions

5.1Communicationamongprocesses,sharingofandcompetingforresources,synchronizationoftheactivitiesofmultipleprocesses,andallocationofprocessortimetoprocesses.

5.9Abinarysemaphoremayonlytakeonthevalues0and1.Ageneralsemaphoremaytakeonanyintegervalue.

Problems

5.2ABCDE;ABDCE;ABDEC;ADBCE;ADBEC;ADEBC;

DEABC;DAEBC;DABEC;DABCE

5.5Considerthecaseinwhichturnequals0andP

(1)setsblocked[1]totrueandthenfindsblocked[0]settofalse.P(0)willthensetblocked[0]totrue,findturn=0,andenteritscriticalsection.P

(1)willthenassign1toturnandwillalsoenteritscriticalsection.

Chapter6

Concurrency:

DeadlockandStarvation

ReviewQuestions

6.2Mutualexclusion.Onlyoneprocessmayusearesourceatatime.Holdandwait.Aprocessmayholdallocatedresourceswhileawaitingassignmentofothers.Nopreemption.Noresourcecanbeforciblyremovedfromaprocessholdingit.

6.3Theabovethreeconditions,plus:

Circularwait.Aclosedchainofprocessesexists,suchthateachprocessholdsatleastoneresourceneededbythenextprocessinthechain.

Problems

6.4a.0000

0750

6622

2002

0320

b.tod.Runningthebanker'salgorithm,weseeprocessescanfinishintheorderp1,p4,p5,p2,p3.

e.Changeavailableto(2,0,0,0)andp3'srowof"stillneeds"to(6,5,2,2).Nowp1,p4,p5canfinish,butwithavailablenow(4,6,9,8)neitherp2norp3's"stillneeds"canbesatisfied.Soitisnotsafetograntp3'srequest.

6.51.W=(2100)

2.MarkP3;W=(2100)+(0120)=(2220)

3.MarkP2;W=(2220)+(2001)=(4221)

4.MarkP1;nodeadlockdetected

Chapter7

MemoryManagement

ReviewQuestions

7.1Relocation,protection,sharing,logicalorganization,physicalorganization.

7.7Alogicaladdressisareferencetoamemorylocationindependentofthecurrentassignmentofdatatomemory;atranslationmustbemadetoaphysicaladdressbeforethememoryaccesscanbeachieved.Arelativeaddressisaparticularexampleoflogicaladdress,inwhichtheaddressisexpressedasalocationrelativetosomeknownpoint,usuallythebeginningoftheprogram.Aphysicaladdress,orabsoluteaddress,isanactuallocationinmainmemory.

Problems

7.6a.The40Mblockfitsintothesecondhole,withastartingaddressof80M.The20Mblockfitsintothefirsthole,withastartingaddressof20M.The10Mblockisplacedatlocation120M.

b.Thethreestartingaddressesare230M,20M,and160M,forthe40M,20M,and10Mblocks,respectively.

c.Thethreestartingaddressesare80M,120M,and160M,forthe40M,20M,and10Mblocks,respectively.

7.12a.Thenumberofbytesinthelogicaladdressspaceis(216pages)´(210bytes/page)=226bytes.Therefore,26bitsarerequiredforthelogicaladdress.

b.Aframeisthesamesizeasapage,210bytes.

c.Thenumberofframesinmainmemoryis(232bytesofmainmemory)/(210bytes/frame)=222frames.So22bitsisneededtospecifytheframe.

d.Thereisoneentryforeachpageinthelogicaladdressspace.Thereforethereare216entries.

e.Inadditiontothevalid/invalidbit,22bitsareneededtospecifytheframelocationinmainmemory,foratotalof23bits.

d.Thethreestartingaddressesare80M,230M,and360M,forthe40M,20M,and10Mblocks,respectively.

Chapter8

VirtualMemory

ReviewQuestions

8.1Simplepaging:

allthepagesofaprocessmustbeinmainmemoryforprocesstorun,unlessoverlaysareused.Virtualmemorypaging:

notallpagesofaprocessneedbeinmainmemoryframesfortheprocesstorun.;pagesmaybereadinasneeded

8.2Aphenomenoninvirtualmemoryschemes,inwhichtheprocessorspendsmostofitstimeswappingpiecesratherthanexecutinginstructions.

Problems

8.1a.Splitbinaryaddressintovirtualpagenumberandoffset;useVPNasindexintopagetable;extractpageframenumber;concatenateoffsettogetphysicalmemoryaddress

b.(i)1052=1024+28mapstoVPN1inPFN7,(7⨯1024+28=7196)

(ii)2221=2⨯1024+173mapstoVPN2,pagefault

(iii)5499=5⨯1024+379mapstoVPN5inPFN0

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

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1