操作系统精髓与设计原理第五版 课后题答案Word格式.docx
- 文档编号:22769306
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:17
- 大小:64.71KB
操作系统精髓与设计原理第五版 课后题答案Word格式.docx
《操作系统精髓与设计原理第五版 课后题答案Word格式.docx》由会员分享,可在线阅读,更多相关《操作系统精髓与设计原理第五版 课后题答案Word格式.docx(17页珍藏版)》请在冰豆网上搜索。
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
3.5Swappinginvolvesmovingpartorallofaprocessfrommainmemorytodisk.WhennoneoftheprocessesinmainmemoryisintheReadystate,theoperatingsystemswapsoneoftheblockedprocessesoutontodiskintoasuspendqueue,sothatanotherprocessmaybebroughtintomainmemorytoexecute.
3.10Theusermodehasrestrictionsontheinstructionsthatcanbeexecutedandthememoryareasthatcanbeaccessed.Thisistoprotecttheoperatingsystemfromdamageoralteration.Inkernelmode,theoperatingsystemdoesnothavetheserestrictions,sothatitcanperformitstasks.
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
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.
4.2Because,withULTs,thethreadstructureofaprocessisnotvisibletotheoperatingsystem,whichonlyschedulesonthebasisofprocesses.
Chapter5
Concurrency:
MutualExclusionandSynchronization
5.1Communicationamongprocesses,sharingofandcompetingforresources,synchronizationoftheactivitiesofmultipleprocesses,andallocationofprocessortimetoprocesses.
5.9Abinarysemaphoremayonlytakeonthevalues0and1.Ageneralsemaphoremaytakeonanyintegervalue.
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
DeadlockandStarvation
6.2Mutualexclusion.Onlyoneprocessmayusearesourceatatime.Holdandwait.Aprocessmayholdallocatedresourceswhileawaitingassignmentofothers.Nopreemption.Noresourcecanbeforciblyremovedfromaprocessholdingit.
6.3Theabovethreeconditions,plus:
Circularwait.Aclosedchainofprocessesexists,suchthateachprocessholdsatleastoneresourceneededbythenextprocessinthechain.
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"
canbesatisfied.Soitisnotsafetograntp3'
srequest.
6.51.W=(2100)
2.MarkP3;
W=(2100)+(0120)=(2220)
3.MarkP2;
W=(2220)+(2001)=(4221)
4.MarkP1;
nodeadlockdetected
Chapter7
MemoryManagement
7.1Relocation,protection,sharing,logicalorganization,physicalorganization.
7.7Alogicaladdressisareferencetoamemorylocationindependentofthecurrentassignmentofdatatomemory;
atranslationmustbemadetoaphysicaladdressbeforethememoryaccesscanbeachieved.Arelativeaddressisaparticularexampleoflogicaladdress,inwhichtheaddressisexpressedasalocationrelativetosomeknownpoint,usuallythebeginningoftheprogram.Aphysicaladdress,orabsoluteaddress,isanactuallocationinmainmemory.
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
8.1Simplepaging:
allthepagesofaprocessmustbeinmainmemoryforprocesstorun,unlessoverlaysareused.Virtualmemorypaging:
notallpagesofaprocessneedbeinmainmemoryframesfortheprocesstorun.;
pagesmaybereadinasneeded
8.2Aphenomenoninvirtualmemoryschemes,inwhichtheprocessorspendsmostofitstimeswappingpiecesratherthanexecutinginstructions.
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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 操作系统精髓与设计原理第五版 课后题答案 操作系统 精髓 设计 原理 第五 课后 答案