admin 管理员组文章数量: 1087139
2024年6月7日发(作者:if和vlookup函数套用)
MODERN
OPERATING
SYSTEMS
THIRDEDITION
PROBLEMSOLUTIONS
AUM
VrijeUniversiteit
Amsterdam,TheNetherlands
PRENTICEHALL
UPPERSADDLERIVER,NJ07458
CopyrightPearsonEducation,Inc.2008
SOLUTIONSTOCHAPTER1PROBLEMS
rogrammingistherapidswitchingoftheCPUbetweenmultipleproc-
mmonlyusedtokeeptheCPUbusywhileoneor
moreprocessesaredoingI/O.
poolingisthetechniqueofreadinginjobs,forexample,fromcards,
ontothedisk,sothatwhenthecurrentlyexecutingprocessesarefinished,
spoolingconsistsoffirst
copyingprintablefilestodiskbeforeprintingthem,ratherthanprintingdi-
poolingonapersonalcomputerisnot
verylikely,butoutputspoolingis.
mereasonformultiprogrammingistogivetheCPUsomethingtodo
whilewaitingforI/eisnoDMA,theCPUisfullyoccu-
pieddoingI/O,sothereisnothingtobegained(atleastintermsofCPUutili-
zation)erhowmuchI/Oaprogramdoes,the
CPUwillbe100%courseassumesthemajordelayisthewait
ulddootherworkiftheI/Owereslowfor
otherreasons(arrivingonaserialline,forinstance).
mple,IntelmakesPentiumI,II,andIII,and4CPUs
withavarietyofdifferentpropertiesincludingspeedandpowerconsumption.
fferonlyin
priceandperformance,whichistheessenceofthefamilyidea.
5.A25×
1024×768pixel24-bitcolorbitmaprequires2,359,1980these
twooptionswouldhavecost$10and$11,520,rent
prices,checkonhowmuchRAMcurrentlycosts,probablylessthan$1/MB.
ssrequiresthateachprocessbeallo-
cateditsresourcesinafairway,withnoprocessgettingmorethanitsfair
therhand,realtimerequiresthatresourcesbeallocatedbased
-
timeprocessmaygetadisproportionateshareoftheresources.
s(a),(c),and(d)shouldberestrictedtokernelmode.
ake20,25or30msectocompletetheexecutionoftheseprograms
0andP1are
scheduledonthesameCPUandP2isscheduledontheotherCPU,itwill
0andP2arescheduledonthesameCPUandP1is
scheduledontheotherCPU,1andP2arescheduled
onthesameCPUandP0isscheduledontheotherCPU,itwilltake30msec.
IfallthreeareonthesameCPU,itwilltake35msec.
2
PROBLEMSOLUTIONSFORCHAPTER1
ansthe
notmatterat
allhowmanystagesthepipelinehas.A10-stagepipelinewith1nsecper
tmattersis
howoftenafinishedinstructionpopsouttheendofthepipeline.
eaccesstime=
0.95×2nsec(wordiscache)
+0.05×0.99×10nsec(wordisinRAM,butnotincache)
+0.05×0.01×10,000,000nsec(wordondiskonly)
=5002.395nsec
=5.002395μsec
uscriptcontains80×50×700=,of
course,impossibletofitintotheregistersofanycurrentlyavailableCPUand
istoobigfora1-MBcache,butifsuchhardwarewereavailable,the
manuscriptcouldbescannedin2.8msecfromtheregistersor5.8msecfrom
reapproximately27001024-byteblocksofdata,soscan-
ningfromthediskwouldrequireabout27seconds,andfromtape2minutes7
se,singand
rewritingthedatawouldincreasethetime.
allergetscontrolbackandimmediatelyoverwritesthedata,
whenthewritefinallyoccurs,r,ifthe
driverfirstcopiesthedatatoaprivatebufferbeforereturning,thenthecaller
rpossibilityistoallowthe
callertocontinueandgiveitasignalwhenthebuffermaybereused,butthis
istrickyanderrorprone.
nstructionswitchestheexecutionmodeofaCPUfromtheusermode
structionallowsauserprogramtoinvokefunc-
tionsintheoperatingsystemkernel.
rogramis
runagainandagain,thetrapwillalwaysoccuratexactlythesamepositionin
rruptiscausedbyanexternaleventandits
timingisnotreproducible.
cesstableisneededtostorethestateofaprocessthatiscurrently
suspended,tneededinasingleprocesssys-
tembecausethesingleprocessisneversuspended.
ngafilesystemmakesanyfilesalreadyinthemountpointdirectory
inaccessible,r,asystemadmin-
istratormightwanttocopysomeofthemostimportantfilesnormallylocated
inthemounteddirectorytothemountpointsotheycouldbefoundintheir
normalpathinanemergencywhenthemounteddevicewasbeingrepaired.
PROBLEMSOLUTIONSFORCHAPTER1
3
mcallallowsauserprocesstoaccessandexecuteoperatingsystem
ogramsusesystemcallstoinvokeoperat-
ingsystemservices.
18.
Fork
canfailiftherearenofreeslotsleftintheprocesstable(andpossiblyif
thereisnomemoryorswapspaceleft).
Exec
canfailifthefilenamegiven
doesnotexistorisnotavalidexecutablefile.
Unlink
canfailifthefiletobe
unlinkeddoesnotexistorthecallingprocessdoesnothavetheauthorityto
unlinkit.
allfails,forexamplebecausefdisincorrect,itcanreturn−
alsofailbecausethediskisfullanditisnotpossibletowritethenumberof
recttermination,italwaysreturnsnbytes.
ainsthebytes:1,5,9,2.
retrievethefile=
1*50ms(Timetomovethearmovertrack#50)
+5ms(Timeforthefirstsectortorotateunderthehead)
+10/100*1000ms(Read10MB)
=155ms
pecialfilesconsistofnumberedblocks,eachofwhichcanbereador
ssibletoseektoanyblock
notpossiblewithcharacterspecialfiles.
callsdonotreallyhavenames,otherthaninadocumentationsense.
Whenthelibraryprocedurereadtrapstothekernel,itputsthenumberofthe
mberisusedtoindexintoa
therhand,thename
ofthelibraryprocedureisveryimportant,sincethatiswhatappearsinthe
program.
an,especiallyifthekernelisamessage-passingsystem.
sprogramlogicisconcerneditdoesnotmatterwhetheracalltoali-
erformanceisanissue,ifa
taskcanbeaccomplishedwithoutasystemcalltheprogramwillrunfaster.
Everysystemcallinvolvesoverheadtimeinswitchingfromtheusercontext
rmore,onamultiusersystemtheoperatingsys-
temmayscheduleanotherprocesstorunwhenasystemcallcompletes,
furtherslowingtheprogressinrealtimeofacallingprocess.
l
UNIX
callshavenocounterpartintheWin32API:
Link:aWin32programcannotrefertoafilebyanalternativenameorseeit
,attemptingtocreatealinkisaconvenient
waytotestforandcreatealockonafile.
4
PROBLEMSOLUTIONSFORCHAPTER1
Mountandumount:aWindowsprogramcannotmakeassumptionsabout
standardpathnamesbecauseonsystemswithmultiplediskdrivesthedrive
namepartofthepathmaybedifferent.
Chmod:Windowsusesaccesscontrollists
Kill:Windowsprogrammerscannotkillamisbehavingprogramthatisnot
cooperating.
ystemarchitecturehasitsownsetofinstructionsthatitcanexecute.
ThusaPentiumcannotexecuteSPARCprogramsandaSPARCcannotexe-
,differentarchitecturesdifferinbusarchitecture
used(suchasVME,ISA,PCI,MCA,SBus,...)aswellasthewordsizeofthe
CPU(usually32or64bit).Becauseofthesedifferencesinhardware,itisnot
y
portableoperatingsystemwillconsistoftwohigh-levellayers---amachine-
hine-dependent
layeraddressesthespecificsofthehardware,andmustbeimplementedsepa-
yerprovidesauniforminterfaceonwhich
hine-independentlayerhasto
ghlyportable,thesizeofthemachine-
dependentlayermustbekeptassmallaspossible.
tionofpolicyandmechanismallowsOSdesignerstoimplementa
rimitivesaresim-
plified,nthen
beusedtoimplementmorecomplexmechanismsandpoliciesattheuser
level.
versionsarestraightforward:
(a)Amicroyearis10
−6
×365×24×3600=31.536sec.
(b)1000metersor1km.
(c)Thereare2
40
bytes,whichis1,099,511,627,776bytes.
(d)Itis6×10
24
kg.
SOLUTIONSTOCHAPTER2PROBLEMS
ethataprocess
isblockedonI/OandtheI/OfiPUisotherwiseidle,theproc-
ermissingtransition,
fromreadytoblocked,processcannotdoI/Oorany-
unningprocesscanblock.
PROBLEMSOLUTIONSFORCHAPTER2
5
ldhavearegistercontainingapointertothecurrentprocesstable
/Ocompleted,theCPUwouldstorethecurrentmachinestatein
wouldgototheinterruptvectorforthe
interruptingdeviceandfetchapointertoanotherprocesstableentry(theser-
viceprocedure).Thisprocesswouldthenbestartedup.
lly,high-levellanguagesdonotallowthekindofaccesstoCPUhard-
tance,aninterrupthandlermayberequiredto
enableanddisabletheinterruptservicingaparticulardevice,ortomanipulate
datawithinaprocess’,interruptserviceroutinesmustexe-
cuteasrapidlyaspossible.
,youdonotwanttheoperatingsystemtocrashbe-
causeapoorlywrittenuserprogramdoesnotallowforenoughstackspace.
Second,ifthekernelleavesstackdatainauserprogram’smemoryspace
uponreturnfromasystemcall,amalicioususermightbeabletousethisdata
tofindoutinformationaboutotherprocesses.
jobhas50%I/Owait,thenitwilltake20minutestocompleteinthe
equentially,thesecondonewillfinish40
minutesafterthefiojobs,theapproximateCPUutiliza-
tionis1−0.5
2
.Thuseachonegets0.375CPUminuteperminuteofreal
mulate10minutesofCPUtime,ajobmustrunfor10/0.375
minutes,nningsequentiallythejobsfinish
after40minutes,butrunninginparalleltheyfinishafter26.67minutes.
dbedifficult,ifnotimpossible,tokeepthefi-
posethataclientprocesssendsarequesttoserverprocess1toupdateafile.
ythereafter,anoth-
erclientprocesssendsarequesttoserver2toreadthatfiunately,if
thefileisalsocachedthere,server2,initsinnocence,willreturnobsolete
firstprocesswritesthefilethroughtothediskaftercachingit,
andserver2checksthediskoneveryreadtoseeifitscachedcopyisup-to-
date,thesystemcanbemadetowork,butitispreciselyallthesediskac-
cessesthatthecachingsystemistryingtoavoid.
gle-threadedprocessisblockedonthekeyboard,itcannotfork.
user-levelthreadsarebeingused,thisactionwillblocktheentireprocess,
isessentialthatkernelthreads
areusedtopermitsomethreadstoblockwithoutaffectingtheothers.
erverisentirelyCPUbound,thereisnoneedtohavemultiple
ample,consideratele-
phonedirectoryassistancenumber(like555-1212)foranareawith1million
6
PROBLEMSOLUTIONSFORCHAPTER2
(name,telephonenumber)recordis,say,64characters,the
entiredatabasetakes64megabytes,andcaneasilybekeptintheserver’s
memorytoprovidefastlookup.
hreadisstopped,stbesaved,
ro-
grammingthreadsisnodifferentthanmultiprogrammingprocesses,soeach
threadneedsitsownregistersavearea.
d-
ingisneededforthegoodoftheapplication,
all,itisusuallythesameprogrammerwhowritesthecodeforallofthem.
-levelthreadscannotbepreemptedbytheclockunlessthewholeproc-
ess’-levelthreadscanbepreemptedindivi-
attercase,ifathreadrunstoolong,theclockwillinterruptthe
nelisfreetopickadif-
ferentthreadfromthesameprocesstorunnextifitsodesires.
ingle-threadedcase,thecachehitstake15msecandcachemissestake
ghtedaverageis2/3×15+1/3×emeanre-
ltithreaded
server,allthewaitingforthediskisoverlapped,soeveryrequesttakes15
msec,andtheservercanhandle662/3requestspersecond.
gestadvantageistheeffistothekernelareneededto
gestdisadvantageisthatifonethreadblocks,theen-
tireprocessblocks.
,achcalltopthread
版权声明:本文标题:现代操作系统(第三版)答案 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1717699267a711128.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
更多相关文章
程序设计基础智慧树知到期末考试章节课后题库2024年深圳信息职业技术学
年月日发(作者:前端模板下载)程序设计基础智慧树知到期末考试答案章节题库年深圳信息职业技术学院.元组可以包含不同类型的元素。()答案:对.在中,和是布尔类型的值。()答案:对.的()函数默认以只读模式打开文件。答案:对.的异常处理语句可以捕
c语言jc的用法 -回复
年月日发(作者:建表语句例子)语言的用法-回复语言中的()用法在语言中,()是一种非常重要的控制语句,用于改变程序的控制流程。它允许程序在特定条件下跳转到指定的位置,实现循环、条件判断和异常处理等功能。本文将详细介绍的用法,从基础知识到高级
试题Python入门教程word练习
年月日发(作者:是什么键)试题入门教程练习一、选择题.小平打算用编写一个管理班上同学通讯录的程序,如果用一个变量来对应处理同学们的电话号码,这个变量定义成什么数据类型比较适合?()。.布尔型..浮点型..整型..字符串.汇编语言.下列语言中
试卷Python考试题复习知识点试卷试题
年月日发(作者:开发职业规划)试卷考试题复习知识点试卷试题一、选择题.在中,下列属于字符串常量的是()."".....算法用程序实现,以下代码中哪处语句存在语法错误().........在语言中,用来定义函数的关键字是()。.已知字符串变量
国家二级C++机试(选择题)-试卷27
年月日发(作者:正弦定理和余弦定理)国家二级机试(选择题)-试卷(总分:.,做题时间:分钟)一、选择题(总题数:,分数:.).下列关于栈叙述正确的是()。(分数:.).栈顶元素最先能被删除.栈顶元素最后才能被删除.栈底元素永远不能被删除.栈
第1章C语言概述
年月日发(作者:网络编程应用的本质是什么)第章语言概述、以下叙述中错误的是()。)使用三种基本结构构成的程序只能解决简单问题)结构化程序由顺序、分支、循环三种基本结构组成)语言是一种结构化程序设计语言)结构化程序设计提倡模块化的设计方法参考
c语言程序设计第一章试题及答案
年月日发(作者:编程实战例课程)语言程序设计第一章试题及答案一、选择题(每题分,共分).语言中,用于定义一个结构体的关键字是:....答案:.下列哪个选项不是语言中合法的变量名?._...答案:.在语言中,用于声明一个整型变量的关键字是:.
朱昌杰 C语言程序设计课本习题解答
年月日发(作者:编程步骤)习题一.选择题()以下叙述正确的是().计算机不仅能执行机器语言程序,也可以直接执行其它高级语言编写的程序.汇编语言是一种面向机器的低级语言,所以计算机可以直接执行用汇编语言编写的源程序.高级语言是与自然语言或数学
C语言第一二三章习题
年月日发(作者:文件夹)(一)判断题(用表示正确,表示错误)说明:在以下提供的若干陈述中,逐一判断其正确与否,选表示正确,选表示错误。、函数是程序的基本单位,每个程序中允许有多个函数。()、在程序中允许行有多个语句,一个语句分多行写。()、
标准c语言程序设计
年月日发(作者:字符串转对象)标准语言程序设计...标准语言程序设计。语言是一种广泛应用于系统软件和应用软件开发的高级程序设计语言,具有结构化、模块化和可移植性强的特点。本文档将介绍标准语言程序设计的基本知识和技巧,帮助读者快速入门并掌握语
Python语言程序设计基础(第2版)全答案v3-20180823
年月日发(作者:编程设计软件)语言程序设计基础(第版)全答案(..,年月)嵩天礼欣黄天羽著(本文档由该书原作者提供,有任何修改意见请反馈:黄天羽@。)目录目录.........................................
C语言-基本选择题及答案
年月日发(作者:动态网站设计毕业论文)语言-基本选择题及答案计算机程序设计基础(语言)单项选择练习题说明:带*号的对非信息学院的同学不作要求。一、基本概念.语言程序是由构成的。)一些可执行语言)函数)函数)包含文件中的第一个函数.()是构成
《C++ 程序设计语言》课程教学大纲
年月日发(作者:建筑工程个人简历模板下载)《程序设计语言》课程教学大纲一、课程名称:程序设计语言二、学分:三、先修课程:《程序设计语言》或者其他任何一门结构化程序设计语言。四、课程的性质、目的和任务:《程序设计语言》课程是网络教育考试“计算
c语言程序与设计基础知识试题及答案
年月日发(作者:前端模板)语言程序与设计基础知识试题及答案一、单项选择题(每题分,共分).语言中,用于定义结构体的关键字是:....答案:.下列哪个选项是语言中的合法整型常量?.....答案:.在语言中,用于定义数组的关键字是:....答案
C语言 程序设计基础试题四及答案
年月日发(作者:)《程序设计基础》考试试卷四班级姓名学号一、选择题(每题分,共分)题号一二得分三四五总得分评卷人审核人.以下叙述中正确的是().程序中注释部分可以出现在程序中任意合适的地方.花括号"{"和"}"只能作为函数体的定界符.构成程
程序设计试题及答案
年月日发(作者:)程序设计试题及答案一、选择题(每题分,共分).在语言中,以下哪个关键字用于定义一个函数?....答案:.下列哪个选项是合法的语言变量名?..-.#._答案:.在语言中,以下哪个语句用于结束一个循环?....答案:.以下哪个
RFdiffusion get_potential_gradients函数解读
get_potential_gradients是Denoise类中一个方法。get_potential_gradients方法的目的是计算每个 Cα 原子的势能梯度,用于指导扩散更新。这些梯度可以提供物理或几何约束,使扩散生成的坐标更加合理
C4996 ‘scanf‘: This function or variable may be unsafe. Consider using scanf_s (vs中提示错误:scanf函数)
例题:从键盘上输入两个数字,求和 #include<stdio.h>int main(){int num10;int num20;int sum0;输入sca
python考试时函数名记不到怎么办?
python考试时函数名记不到怎么办 不知道各位同学有没有在python或者机器学习、人工智能实操考试中忘记了导入的包的函数名称。同时又不允许百度查询,这时候该怎么办呢? 一招教你破解&
在Windows环境下使用fork()函数的解决方案
在windows下使用linux环境的folk会出现:‘fork’ was not declared in this scope. 下面是免装虚拟机系统,或者换LINux系统的办法。 请下载安装cygwin,安装特定的版本的G++,GC
发表评论