版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新材料研发总经理聘用合同
- 烟草制品销售合同经济仲裁
- 舞台搭建钢管租赁合同
- 2025对我国劳动合同制度的若干思考
- 小学生环保科学课模板
- 幼儿园幼儿一日安全管理
- 山西财贸职业技术学院《应用开发专业》2023-2024学年第一学期期末试卷
- 如何管理好酒店
- 山东中医药大学《建筑设计应用》2023-2024学年第一学期期末试卷
- 山东英才学院《三维专业软件》2023-2024学年第一学期期末试卷
- 德语四级真题2023
- 入世后黑色家电的产业分析与企业对策
- 大学生朋辈心理辅导智慧树知到答案章节测试2023年浙江大学
- 2023年社保基金安全警示教育学习研讨会发言稿报告(4篇)
- 水乡歌儿多音乐课教学反思
- GB/T 35679-2017固体材料微波频段使用波导装置的电磁参数测量方法
- 与中图法22大类及二级类目对照表普通高等学校本科专业目录
- GB 17269-2003铝镁粉加工粉尘防爆安全规程
- DB31-T 1361-2022学校饮水卫生管理要求
- 安全用电课件【知识精讲+高效备课】 人教版九年级 物理教材精研课件
- 软件项目监理通用表优质资料
评论
0/150
提交评论