版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
Whatarethethreemainpurposesofanoperatingsystem?Answer:?Toprovideanenvironmentforacomputerusertoexecuteprogramsoncomputerhardwareinaconvenientandefficientmanner.?Toallocatetheseparateresourcesofthecomputerasneededtosolvetheproblemgiven.Theallocationprocessshouldbeasfairandefficientaspossible.Asacontrolprogramitservestwomajorfunctions:(1)supervision oftheexecutionofuserprogramstopreventerrorsandimproperuseofthecomputer,and(2)managementoftheoperationandcontrolofI/Odevices.Whatarethemaindifferencesbetweenoperatingsystemsformainframe computersandpersonalcomputers?Answer:Generally,operatingsystemsforbatchsystemshavesimplerrequirementsthanforpersonalcomputers.Batchsystemsdonothavetobeconcernedwithinteractingwithauserasmuchasapersonalcomputer.Asaresult,anoperating systemforaPCmustbeconcernedwithresponsetimeforaninteractiveuser.Batchsystemsdonothavesuchrequirements.Apurebatchsystemalsomayhavenottohandletimesharing,whereasanoperatingsystemmustswitchrapidlybetweendifferentjobs.Listthefourstepsthatarenecessarytorunaprogramonacompletelydedicatedmachine.Answer:Reservemachinetime.Manuallyloadprogramintomemory.Loadstartingaddressandbeginexecution.Monitorandcontrolexecutionofprogramfromconsole.Wehavestressedtheneedforanoperatingsystemtomakeefficientuseofthecomputinghardware.Whenisitappropriatefortheoperatingsystemtoforsakethisprincipleandtowaste resources?Whyissucasystemnotreallywasteful?Answer:Single-usersystemsshouldmaximizeuseofthesystemfortheuser.AGUImightwaste”CPUcycles,butitoptimizestheuserinteractionwiththesystem.'sWhatisthemaindifficultythataprogrammermustovercomeinwritinganoperatingsystemforareal-timeenvironment?Answer:Themaindifficultyiskeepingtheoperatingsystemwithinthe fixedtimeconstraintsofareal-timesystem.Ifthesystemdoesnotcompleteataskinacertaintimeframe,itmaycauseabreakdownoftheentiresystemitisrunning.Thereforewhenwritinganoperatingsystemforareal-timesystem,thewritermustbesurethathisscheduling schemesdon 'tallowresponsetimetoexceedthetimeconstraint.Considerthevariousdefinitionsofoperatingsystem.ConsiderwhethertheoperatingsystemshouldincludeapplicationssuchasWebbrowsersAndmailprograms.Argueboththatitshouldandthatitshouldnot,andsupportyouranswer.Answer: Point.Applicationssuchaswebbrowsersandemailtoolsareperforminganincreasinglyimportantroleinmoderndesktopcomputersystems.Tofulfillthisrole,theyshouldbeincorporatedaspartoftheoperatingsystem.Bydoingso,theycanprovidebetterperformanceandbetterintegrationwiththerestofthesystem.Inaddition,theseimportantapplicationscanhavethesamelook-and-feelastheoperatingsystemsoftware.Counterpoint.ThefundamentalroleoftheoperatingsystemistomanagesystemresourcessuchastheCPU,memory,I/Odevices,etc.Inaddition,it 'rolesistorunsoftwareapplicationssuchaswebbrowsersandemailapplications.Byincorporatingsuchapplicationsintotheoperatingsystem,weburdentheoperatingsystemwithadditionalfunctionality.Suchaburdenmayresultintheoperatingsystemperformingaless-thansatisfactoryjobatmanagingsystemresources.Inaddition,weincreasethesizeoftheoperatingsystemtherebyincreasingthelikelihoodofsystemcrashesandsecurityviolations.Howdoesthedistinctionbetweenkernelmodeandusermodefunctionasarudimentaryformofprotection(security)system?Answer:Thedistinctionbetweenkernelmodeandusermodeprovidesarudimentaryformofprotectioninthefollowingmanner.CertaininstructionscouldbeexecutedonlywhentheCPUisinkernelmode.Similarly,hardwaredevicescouldbeaccessedonlywhentheprogramisexecutinginkernelmode.ControloverwheninterruptscouldbeenabledordisabledisalsopossibleonlywhentheCPUisinkernelmode.Consequently,theCPUhasverylimitedcapabilitywhenexecutinginusermode,therebyenforcingprotectionofcriticalresources.Whichofthefollowinginstructionsshouldbeprivileged?Setvalueoftimer.Readtheclock.Clearmemory.Issueatrapinstruction.Turnoffinterrupts.Modifyentriesindevice-statustable.Switchfromusertokernelmode.AccessI/Odevice.Answer:Thefollowingoperationsneedtobeprivileged:Setvalueoftimer,clearmemory,turnoffinterrupts,modifyentriesindevice-statustable,accessI/Odevice.Therestcanbeperformedinusermode.Someearlycomputersprotectedtheoperatingsystembyplacingitinamemorypartitionthatcouldnotbemodifiedbyeithertheuserjobortheoperatingsystemitself.Describetwodifficultiesthatyouthinkcouldarisewithsuchascheme.Answer:Thedatarequiredbytheoperatingsystem(passwords,accesscontrols,accountinginformation,andsoon)wouldhavetobestoredinorpassedthroughunprotectedmemoryandthusbeaccessibletounauthorizedusers.SomeCPUprovideformorethantwomodesofoperation.Whataretwopossibleusesofthesemultiplemodes?Answer:Althoughmostsystemsonlydistinguishbetweenuserandkernelmodes,someCPUshavesupportedmultiplemodes.Multiplemodescouldbeusedtoprovideafiner-grainedsecuritypolicy.Forexample,ratherthandistinguishingbetweenjustuserandkernel-mode,youcoulddistinguishbetweendifferenttypesofusermode.Perhapsusersbelongingtothesamegroupcouldexecuteeachother c'desThemachinewouldgointoaspecifiedmodewhenoneoftheseuserswasrunningcode.Whenthemachinewasinthismode,amemberofthegroupcouldruncodebelongingtoanyoneelseinthegroup.Anotherpossibilitywouldbetoprovidedifferentdistinctionswithinkernelcode.Forexample,aspecificmodecouldallowUSBdevicedriverstorun.ThiswouldmeanthatUSBdevicescouldbeservicedwithouthavingtoswitchtokernelmode,therebyessentiallyallowingUSBdevicedriverstoruninaquasi-user/kernelmode.Timerscouldbeusedtocomputethecurrenttime.Provideashortdescriptionofhowthiscouldbeaccomplished.Answer:Aprogramcouldusethefollowingapproachtocomputethecurrenttimeusingtimerinterrupts.Theprogramcouldsetatimerforsometimeinthefutureandgotosleep.Whenitisawakenedbytheinterrupt,itcouldupdateitslocalstate,whichitisusingtokeeptrackofthenumberofinterruptsithasreceivedthusfar.Itcouldthenrepeatthisprocessofcontinuallysettingtimerinterruptsandupdatingitslocalstatewhentheinterruptsareactuallyraised.IstheInternetaLANoraWAN?Answer: TheInternetisaWANasthevariouscomputersarelocatedatgeographicallydifferentplacesandareconnectedbylong-distancenetworklinks.Whatisthepurposeofsystemcalls?Answer:Systemcallsallowuser-levelprocessestorequestservicesoftheoperatingsystem.Whatarethefivemajoractivitiesofanoperatingsysteminregardtoprocessmanagement?Answer:ThecreationanddeletionofbothuserandsystemprocessesThesuspensionandresumptionofprocessesTheprovisionofmechanismsforprocesssynchronizationTheprovisionofmechanismsforprocesscommunicationTheprovisionofmechanismsfordeadlockhandlingWhatarethethreemajoractivitiesofanoperatingsysteminregardtomemorymanagement?Answer:a.Keeptrackofwhichpartsofmemoryarecurrentlybeingusedandbywhom.Decidewhichprocessesaretobeloadedintomemorywhenmemoryspacebecomesavailable.Allocateanddeallocatememoryspaceasneeded.Whatarethethreemajoractivitiesofanoperatingsysteminregardtosecondary-storagemanagement?Answer:?Free-spacemanagement.Storageallocation.Diskscheduling.Whatisthepurposeofthecommandinterpreter?Whyisitusuallyseparatefromthekernel?Answer:Itreadscommandsfromtheuserorfromafileofcommandsandexecutesthem,usuallybyturningthemintooneormoresystemcalls.Itisusuallynotpartofthekernelsincethecommandinterpreterissubjecttochanges.Whatsystemcallshavetobeexecutedbyacommandinterpreterorshellinordertostartanewprocess?Answer:InUnixsystems,aforksystemcallfollowedbyanexecsystemcallneedtobeperformedtostartanewprocess.Theforkcallclonesthecurrentlyexecutingprocess,whiletheexeccalloverlaysanewprocessbasedonadifferentexecutableoverthecallingprocess.Whatisthepurposeofsystemprograms?Answer:Systemprogramscanbethoughtofasbundlesofusefulsystemcalls.Theyprovidebasicfunctionalitytouserssothatusersdonotneedtowritetheirownprogramstosolvecommonproblems.Whatisthemainadvantageofthelayeredapproachtosystemdesign?Whatarethedisadvantagesofusingthelayeredapproach?Answer:Asinallcasesofmodulardesign,designinganoperatingsysteminamodularwayhasseveraladvantages.Thesystemiseasiertodebugandmodifybecausechangesaffectonlylimitedsectionsofthesystemratherthantouchingallsectionsoftheoperatingsystem.Informationiskeptonlywhereitisneededandisaccessibleonlywithinadefinedandrestrictedarea,soanybugsaffectingthatdatamustbelimitedtoaspecificmoduleorlayer.Listfiveservicesprovidedbyanoperatingsystem.Explainhoweachprovidesconveniencetotheusers.Explainalsoinwhichcasesitwouldbeimpossibleforuser-levelprogramstoprovidetheseservices.Answer:Programexecution.Theoperatingsystemloadsthecontents(orsections)ofafileintomemoryandbeginsitsexecution.AuserlevelprogramcouldnotbetrustedtoproperlyallocateCPUtime.I/Ooperations.Disks,tapes,seriallines,andotherdevicesmustbecommunicatedwithataverylowlevel.Theuserneedonlyspecifythedeviceandtheoperationtoperformonit,whilethesystemconvertsthatrequestintodevice-orcontroller-specificcommands.User-levelprogramscannotbetrustedtoaccessonlydevicestheyshouldhaveaccesstoandtoaccessthemonlywhentheyareotherwiseunused.File-systemmanipulation.Therearemanydetailsinfilecreation,deletion,allocation,andnamingthatusersshouldnothavetoperform.Blocksofdiskspaceareusedbyfilesandmustbetracked.Deletingafilerequiresremovingthenamefileinformationandfreeingtheallocatedblocks.Protectionsmustalsobecheckedtoassureproperfileaccess.Userprogramscouldneitherensureadherencetoprotectionmethodsnorbetrustedtoallocateonlyfreeblocksanddeallocateblocksonfiledeletion.Communications.Messagepassingbetweensystemsrequiresmessagestobeturnedintopacketsofinformation,senttothenetworkcontroller,transmittedacrossacommunicationsmedium,andreassembledbythedestinationsystem.Packetorderinganddatacorrectionmusttakeplace.Again,userprogramsmightnotcoordinateaccesstothenetworkdevice,ortheymightreceivepacketsdestinedforotherprocesses.Errordetection.Errordetectionoccursatboththehardwareandsoftwarelevels.Atthehardwarelevel,alldatatransfersmustbeinspectedtoensurethatdatahavenotbeencorruptedintransit.Alldataonmediamustbecheckedtobesuretheyhavenotchangedsincetheywerewrittentothemedia.Atthesoftwarelevel,mediamustbecheckedfordataconsistency;forinstance,whetherthenumberofallocatedandunallocatedblocksofstoragematchthetotalnumberonthedevice.There,errorsarefrequentlyprocess-independent(forinstance,thecorruptionofdataonadisk),sotheremustbeaglobalprogram(theoperatingsystem)thathandlesalltypesoferrors.Also,byhavingerrorsprocessedbytheoperatingsystem,processesneednotcontaincodetocatchandcorrectalltheerrorspossibleonasystem.Whatisthepurposeofsystemcalls?Answer:Systemcallsallowuser-levelprocessestorequestservicesoftheoperatingsystem.Whatarethemainadvantagesofthemicrokernelapproachtosystemdesign?Answer:Benefitstypicallyincludethefollowing(a)addinganewservicedoesnotrequiremodifyingthekernel,(b)itismoresecureasmoreoperationsaredoneinusermodethaninkernelmode,and(c)asimplerkerneldesignandfunctionalitytypicallyresultsinamorereliableoperatingsystem.Whydosomesystemsstoretheoperatingsysteminfirmware,andothersondisk?Answer:Forcertaindevices,suchashandheldPDAsandcellulartelephones,adiskwithafilesystemmaybenotbeavailableforthedevice.Inthissituation,theoperatingsystemmustbestoredinfirmware.Howcouldasystembedesignedtoallowachoiceofoperatingsystemstobootfrom?Whatwouldthebootstrapprogramneedtodo?Answer:ConsiderasystemthatwouldliketorunbothWindowsXPandthreedifferentdistributionsofLinux(e.g.,RedHat,Debian,andMandrake).Eachoperatingsystemwillbestoredondisk.Duringsystemboot-up,aspecialprogram(whichwewillcallthebootmanager)willdeterminewhichoperatingsystemtobootinto.Thismeansthatratherinitiallybootingtoanoperatingsystem,thebootmanagerwillfirstrunduringsystemstartup.Itisthisbootmanagerthatisresponsiblefordeterminingwhichsystemtobootinto.Typicallybootmanagersmustbestoredatcertainlocationsoftheharddisktoberecognizedduringsystemstartup.Bootmanagersoftenprovidetheuserwithaselectionofsystemstobootinto;bootmanagersarealsotypicallydesignedtobootintoadefaultoperatingsystemifnochoiceisselectedbytheuser.PalmOSprovidesnomeansofconcurrentprocessing.Discussthreemajorcomplicationsthatconcurrentprocessingaddstoanoperatingsystem.Answer:Amethodoftimesharingmustbeimplementedtoalloweachofseveralprocessestohaveaccesstothesystem.ThismethodinvolvesthepreemptionofprocessesthatdonotvoluntarilygiveuptheCPU(byusingasystemcall,forinstance)andthekernelbeingreentrant(somorethanoneprocessmaybeexecutingkernelcodeconcurrently).Processesandsystemresourcesmusthaveprotectionsandmustbeprotectedfromeachother.Anygivenprocessmustbelimitedintheamountofmemoryitcanuseandtheoperationsitcanperformondeviceslikedisks.Caremustbetakeninthekerneltopreventdeadlocksbetweenprocesses,soprocessesaren 'twaitingforeachother 'sallocatedresources.TheSunUltraSPARCprocessorhasmultipleregistersets.Describetheactionsofacontextswitchifthenewcontextisalreadyloadedintooneoftheregistersets.Whatelsemusthappenifthenewcontextisinmemoryratherthaninaregistersetandalltheregistersetsareinuse?Answer:TheCPUcurrent-register-setpointerischangedtopointtothesetcontainingthenewcontext,whichtakesverylittletime.Ifthecontextisinmemory,oneofthecontextsinaregistersetmustbechosenandbe
movedtomemory,andthenewcontextmustbeloadedfrommemoryintotheset.Thisprocesstakesalittlemoretimethanonsystemswithonesetofregisters,dependingonhowareplacementvictimisselected.Whenaprocesscreatesanewprocessusingthefork()operation,whichofthefollowingstateissharedbetweentheparentprocessandthechildprocess?StackHeapSharedmemorysegmentsAnswer:Onlythesharedmemorysegmentsaresharedbetweentheparentprocessandthenewlyforkedchildprocess.Copiesofthestackandtheheaparemadeforthenewlycreatedprocess.3.4AgainconsideringtheRPCmechanism,considertheexactlyoncesem3.4AgainconsideringtheRPCmechanism,considertheexactlyoncesemDoesthealgorithmforimplementingthissemanticexecutecorrectlyevenifthe “ACK”messagebacktotheclientislostduetoanetworkproblem?Describethesequenceofmessagesandwhether"exactlyonce"isstillpreserved.seitharbtOcBeenoreprocedureAnswer:The “exactlyoncewillbeexecutedexactlyonceandonlyonce.Thegeneralalgorithmforensuringthiscombinesanacknowledgment(ACK)schemecombinedwithtimestamps(orsomeotherincrementalcounterthatallowstheseitharbtOcBeenoreprocedureThegeneralstrategyisfortheclienttosendtheRPCtotheserveralongwithatimestamp.Theclientwillalsostartatimeoutclock.Theclientwillthenwaitforoneoftwooccurrences:(1)itwillreceiveanACKfromtheserverindicatingthattheremoteprocedurewasperformed,or(2)itwilltimeout.Iftheclienttimesout,itassumestheserverwasunabletoperformtheremoteproceduresotheclientinvokestheRPCasecondtime,sendingalatertimestamp.TheclientmaynotreceivetheACKforoneoftworeasons:(1)theoriginalRPCwasneverreceivedbytheserver,or(2)theRPCwascorrectlyreceived —andperformed—bytheserverbuttheACKwaslost.Insituation(1),theuseofACKsallowstheserverultimatelytoreceiveandperformtheRPC.Insituation(2),theserverwillreceiveaduplicateRPCanditwillusethetimestamptoidentifyitasaduplicatesoasnottoperformtheRPCasecondtime.ItisimportanttonotethattheservermustsendasecondACKbacktotheclienttoinformtheclienttheRPChasbeenperformed.3.5Assumethatadistributedsystemissusceptibletoserverfailure.Whatsemanticsmechanismswouldberequiredtoguaranteethe “exactlyonceforexecutionofRPCs?semanticsAnswer:Theservershouldkeeptrackinstablestorage(suchasadisklog)informationregardingwhatRPCoperationswerereceived,whethertheyweresuccessfullyperformed,andtheresultsassociatedwiththeoperations.WhenaservercrashtakesplaceandaRPCmessage
isreceived,theservercancheckwhethertheRPChadbeenpreviouslysemancticsfortheperformedandthereforeguarantee “exactlyonceexecutionofRPCs.semancticsfortheProvidetwoprogrammingexamplesinwhichmultithreadingprovidesbetterperformancethanasingle-threadedsolution.Answer:(1)AWebserverthatserviceseachrequestinaseparatethread.2)(Aparallelizedapplicationsuchasmatrixmultiplicationwhere(differentpartsofthematrixmaybeworkedoninparallel.(3)An(interactiveGUIprogramsuchasadebuggerwhereathreadisused(tomonitoruserinput,anotherthreadrepresentstherunning(application,andathirdthreadmonitorsperformance.Whataretwodifferencesbetweenuser-levelthreadsandkernel-levelthreads?Underwhatcircumstancesisonetypebetterthantheother?Answer:(1)User-levelthreadsareunknownbythekernel,whereasthekernelisawareofkernelthreads.(2)OnsystemsusingeitherM:1orM:Nmapping,userthreadsarescheduledbythethreadlibraryandthekernelscheduleskernelthreads.(3)Kernelthreadsneednotbeassociatedwithaprocesswhereaseveryuserthreadbelongstoaprocess.Kernelthreadsaregenerallymoreexpensivetomaintainthanuserthreadsastheymustberepresentedwithakerneldatastructure.Describetheactionstakenbyakerneltocontextswitchbetweenkernellevelthreads.Answer:ContextswitchingbetweenkernelthreadstypicallyrequiressavingthevalueoftheCPUregistersfromthethreadbeingswitchedoutandrestoringtheCPUregistersofthenewthreadbeingscheduled.Whatresourcesareusedwhenathreadiscreated?Howdotheydifferfromthoseusedwhenaprocessiscreated?Answer:Becauseathreadissmallerthanaprocess,threadcreationtypicallyusesfewerresourcesthanprocesscreation.Creatingaprocessrequiresallocatingaprocesscontrolblock(PCB),aratherlargedatastructure.ThePCBincludesamemorymap,listofopenfiles,andenvironmentvariables.Allocatingandmanagingthememorymapistypicallythemosttime-consumingactivity.Creatingeitherauserorkernelthreadinvolvesallocatingasmalldatastructuretoholdaregisterset,stack,andpriority.Assumeanoperatingsystemmapsuser-levelthreadstothekernelusingthemany-to-manymodelandthemappingisdonethroughLWPs.Furthermore,thesystemallowsdeveloperstocreatereal-timethreads.Isitnecessarytobindareal-timethreadtoanLWP?Explain.Answer:Yes.Timingiscrucialtoreal-timeapplications.Ifathreadismarkedasreal-timebutisnotboundtoanLWP,thethreadmayhavetowaittobeattachedtoanLWPbeforerunning.Considerifareal-timethreadisrunning(isattachedtoanLWP)andthenproceedstoblock(i.e.mustperformI/O,hasbeenpreemptedbyahigher-priorityreal-timethread,iswaitingforamutualexclusionlock,etc.)Whilethereal-timethreadisblocked,theLWPitwasattachedtohasbeenassignedtoanotherthread.Whenthereal-timethreadhasbeenscheduledtorunagain,itmustfirstwaittobeattachedtoanLWP.BybindinganLWPtoarealtimethreadyouareensuringthethreadwillbeabletorunwithminimaldelayonceitisscheduled.APthreadprogramthatperformsthesummationfunctionwasprovidedinSection4.3.1.RewritethisprograminJava.Answer:PleaserefertothesupportingWebsiteforsourcecodesolution.ACPUschedulingalgorithmdeterminesanorderfortheexecutionofitsscheduledprocesses.Givennprocessestobescheduledononeprocessor,howmanypossibledifferentschedulesarethere?Giveaformulaintermsofn.x1).Answer:n!(nfactorial=n -1x-n2xin...xx1).Definethedifferencebetweenpreemptiveandnonpreemptivescheduling.Answer:Preemptiveschedulingallowsaprocesstobeinterruptedinthemidstofitsexecution,takingtheCPUawayandallocatingittoanotherprocess.NonpreemptiveschedulingensuresthataprocessrelinquishescontroloftheCPUonlywhenitfinisheswithitscurrentCPUburst.Supposethatthefollowingprocessesarriveforexecutionatthetimesindicated.Eachprocesswillrunthelistedamountoftime.Inansweringthequestions,usenonpreemptiveschedulingandbasealldecisionsontheinformationyouhaveatthetimethedecisionmustbemade.ProcessArrivalTimeBurstTimeP10.08P20.44P31.01WhatistheaverageturnaroundtimefortheseprocesseswiththeFCFSschedulingalgorithm?WhatistheaverageturnaroundtimefortheseprocesseswiththeSJFschedulingalgorithm?TheSJFalgorithmissupposedtoimproveperformance,butnoticethatwechosetorunprocessP1attime0becausewedidnotknowthattwoshorterprocesseswouldarrivesoon.ComputewhattheaverageturnaroundtimewillbeiftheCPUisleftidleforthefirst1unitandthenSJFschedulingisused.RememberthatprocessesP1andP2arewaitingduringthisidletime,sotheirwaitingtimemayincrease.Thisalgorithmcouldbeknownasfuture-knowledgescheduling.Answer:10.539.536.86Rememberthatturnaroundtimeisfinishingtimeminusarrivaltime,soyouhavetosubtractthearrivaltimestocomputetheturnaroundtimes.FCFSis11ifyouforgettosubtractarrivaltime.Whatadvantageisthereinhavingdifferenttime-quantumsizesondifferentlevelsofamultilevelqueueingsystem?Answer:Processesthatneedmorefrequentservicing,forinstance,interactiveprocessessuchaseditors,canbeinaqueuewithasmalltimequantum.Processeswithnoneedforfrequentservicingcanbeinaqueuewithalargerquantum,requiringfewercontextswitchestocompletetheprocessing,andthusmakingmoreefficientuseofthecomputer.ManyCPU-schedulingalgorithmsareparameterized.Forexample,theRRalgorithmrequiresaparametertoindicatethetimeslice.Multilevelfeedbackqueuesrequireparameterstodefinethenumberofqueues,theschedulingalgorithmsforeachqueue,thecriteriausedtomoveprocessesbetweenqueues,andsoon.Thesealgorithmsarethusreallysetsofalgorithms(forexample,thesetofRRalgorithmsforalltimeslices,andsoon).Onesetofalgorithmsmayincludeanother(forexample,theFCFSalgorithmistheRRalgorithmwithaninfinitetimequantum).What(ifany)relationholdsbetweenthefollowingpairsofsetsofalgorithms?PriorityandSJFMultilevelfeedbackqueuesandFCFSPriorityandFCFSRRandSJFAnswer:Theshortestjobhasthehighestpriority.ThelowestlevelofMLFQisFCFS.FCFSgivesthehighestprioritytothejobhavingbeeninexistencethelongest.None.Supposethataschedulingalgorithm(atthelevelofshort-termCPUscheduling)favorsthoseprocessesthathaveusedtheleastprocessortimeintherecentpast.WhywillthisalgorithmfavorI/O-boundprogramsandyetnotpermanentlystarveCPU-boundprograms?Answer:ItwillfavortheI/O-boundprogramsbecauseoftherelativelyshortCPUburstrequestbythem;however,theCPU-boundprogramswillnotstarvebecausetheI/O-boundprogramswillrelinquishtheCPUrelativelyoftentodotheirI/O.DistinguishbetweenPCSandSCSscheduling.Answer:PCSschedulingisdonelocaltotheprocess.ItishowthethreadlibraryschedulesthreadsontoavailableLWPs.SCSschedulingisthesituationwheretheoperatingsystemscheduleskernelthreads.Onsystemsusingeithermany-to-oneormany-to-many,thetwoschedulingmodelsarefundamentallydifferent.Onsystemsusingone-to-one,PCSandSCSarethesame.Assumeanoperatingsystemmapsuser-levelthreadstothekernelusingthemany-to-manymodelwherethemappingisdonethroughtheuseofLWPs.Furthermore,thesystemallowsprogramdeveloperstocreatereal-timethreads.Isitnecessarytobindareal-timethreadtoanLWP?Answer:Yes,otherwiseauserthreadmayhavetocompeteforanavailableLWPpriortobeingactuallyscheduled.BybindingtheuserthreadtoanLWP,thereisnolatencywhilewaitingforanavailableLWP;thereal-timeuserthreadcanbescheduledimmediately.InSection6.4wementionedthatdisablinginterruptsfrequentlycouldaffectthesystem 'sclock.Explainwhyitcouldandhowsucheffectscouldbeminimized.Answer:Thesystemclockisupdatedateveryclockinterrupt.Ifinterruptsweredisabled——particularlyforalongperiodoftime ——itispossiblethesystemclockcouldeasilylosethecorrecttime.Thesystemclockisalsousedforschedulingpurposes.Forexample,thetimequantumforaprocessisexpressedasanumberofclockticks.Ateveryclockinterrupt,theschedulerdeterminesifthetimequantumforthecurrentlyrunningprocesshasexpired.Ifclockinterruptsweredisabled,theschedulercouldnotaccuratelyassigntimequantums.Thiseffectcanbeminimizedbydisablingclockinterruptsforonlyveryshortperiods.TheCigarette-SmokersProblem.Considerasystemwiththreesmokerprocessesandoneagentprocess.Eachsmokercontinuouslyrollsacigaretteandthensmokesit.Buttorollandsmokeacigarette,thesmokerneedsthreeingredients:tobacco,paper,andmatches.Oneofthesmokerprocesseshaspaper,anotherhas
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 粉筆板項目運營指導方案
- 人工授精用動物精液產品供應鏈分析
- 真空吸塵器用濾塵器商業(yè)機會挖掘與戰(zhàn)略布局策略研究報告
- 俯臥撐支架產業(yè)鏈招商引資的調研報告
- 書籍封面的平面設計行業(yè)相關項目經營管理報告
- 卡祖笛產品供應鏈分析
- 自行車車閘項目運營指導方案
- 裝飾用木條市場分析及投資價值研究報告
- 醫(yī)用箭毒產品供應鏈分析
- 生產加工用香精油市場發(fā)展前景分析及供需格局研究預測報告
- 《應用統(tǒng)計學》(第4版)-自測試卷及答案B卷
- 《賦能年輕一代、共筑韌性未來》國際減災日主題班會教案
- 四川省成都市2023-2024學年高一上學期語文期中考試試卷(含答案)
- 小學六年級數學計算題100道(含答案)
- 大班綜合《要是你給老鼠玩手機》課件
- 液壓管道沖洗方案
- 廚房安全生產培訓內容
- 蘋果公司崗位職責任職要求
- PON網絡組網安全問題研究
- 絲網花初級教材
- 情境7庫存管理技術
評論
0/150
提交評論