操作系统习地的题目.docx
《操作系统习地的题目.docx》由会员分享,可在线阅读,更多相关《操作系统习地的题目.docx(87页珍藏版)》请在冰豆网上搜索。
![操作系统习地的题目.docx](https://file1.bdocx.com/fileroot1/2023-2/9/c02bdfa4-7fa2-4db0-ad92-3e45956634f4/c02bdfa4-7fa2-4db0-ad92-3e45956634f41.gif)
操作系统习地的题目
1.1Whatarethethreemainpurposesofanoperatingsystem?
Answer:
•Toprovideanenvironmentforacomputerusertoexecuteprogramsoncomputerhardwareinaconvenientandefficientmanner.
•Toallocatetheseparateresourcesofthecomputerasneededtosolvetheproblemgiven.Theallocationprocessshouldbeasfairandefficientaspossible.
•Asacontrolprogramitservestwomajorfunctions:
(1)supervisionoftheexecutionofuserprogramstopreventerrorsandimproperuseofthecomputer,and
(2)managementoftheoperationandcontrolofI/Odevices.
1.2Whatarethemaindifferencesbetweenoperatingsystemsformainframecomputersandpersonalcomputers?
Answer:
Generally,operatingsystemsforbatchsystemshavesimplerrequirementsthanforpersonalcomputers.Batchsystemsdonothavetobeconcernedwithinteractingwithauserasmuchasapersonalcomputer.Asaresult,anoperatingsystemforaPCmustbeconcernedwithresponsetimeforaninteractiveuser.Batchsystemsdonothavesuchrequirements.Apurebatchsystemalsomayhavenottohandle
timesharing,whereasanoperatingsystemmustswitchrapidlybetweendifferentjobs.
1.3Listthefourstepsthatarenecessarytorunaprogramonacompletelydedicatedmachine.
Answer:
a.Reservemachinetime.
b.Manuallyloadprogramintomemory.
c.Loadstartingaddressandbeginexecution.
d.Monitorandcontrolexecutionofprogramfromconsole.
1.4Wehavestressedtheneedforanoperatingsystemtomakeefficientuseofthecomputinghardware.Whenisitappropriatefortheoperatingsystemtoforsakethisprincipleandto“waste”resources?
Whyissuchasystemnotreallywasteful?
Answer:
Single-usersystemsshouldmaximizeuseofthesystemfortheuser.AGUImight“waste”CPUcycles,butitoptimizestheuser’sinteractionwiththesystem.
1.5Whatisthemaindifficultythataprogrammermustovercomeinwritinganoperatingsystemforareal-timeenvironment?
Answer:
Themaindifficultyiskeepingtheoperatingsystemwithinthefixedtimeconstraintsofareal-timesystem.Ifthesystemdoesnotcompleteataskinacertaintimeframe,itmaycauseabreakdownoftheentiresystemitisrunning.Thereforewhenwritinganoperatingsystemforareal-timesystem,thewritermustbesurethathisschedulingschemesdon’tallowresponsetimetoexceedthetimeconstraint.
1.6Considerthevariousdefinitionsofoperatingsystem.ConsiderwhethertheoperatingsystemshouldincludeapplicationssuchasWebbrowsersAndmailprograms.Argueboththatitshouldandthatitshouldnot,andsupportyouranswer.
Answer:
Point.Applicationssuchaswebbrowsersandemailtoolsareperforminganincreasinglyimportantroleinmoderndesktopcomputersystems.Tofulfillthisrole,theyshouldbeincorporatedaspartoftheoperatingsystem.Bydoingso,theycanprovidebetterperformanceandbetterintegrationwiththerestofthesystem.Inaddition,these
importantapplicationscanhavethesamelook-and-feelastheoperatingsystemsoftware.
Counterpoint.ThefundamentalroleoftheoperatingsystemistomanagesystemresourcessuchastheCPU,memory,I/Odevices,etc.Inaddition,it’sroleistorunsoftwareapplicationssuchaswebbrowsersandemailapplications.Byincorporatingsuchapplicationsintotheoperatingsystem,weburdentheoperatingsystemwithadditionalfunctionality.Suchaburdenmayresultintheoperatingsystemperformingaless-thansatisfactoryjobatmanagingsystemresources.Inaddition,weincreasethesizeoftheoperatingsystemtherebyincreasingthelikelihoodofsystemcrashesandsecurityviolations.
1.7Howdoesthedistinctionbetweenkernelmodeandusermodefunctionasarudimentaryformofprotection(security)system?
Answer:
Thedistinctionbetweenkernelmodeandusermodeprovidesarudimentaryformofprotectioninthefollowingmanner.CertaininstructionscouldbeexecutedonlywhentheCPUisinkernelmode.Similarly,hardwaredevicescouldbeaccessedonlywhentheprogram
isexecutinginkernelmode.ControloverwheninterruptscouldbeenabledordisabledisalsopossibleonlywhentheCPUisinkernelmode.Consequently,theCPUhasverylimitedcapabilitywhenexecutinginusermode,therebyenforcingprotectionofcriticalresources.
1.8Whichofthefollowinginstructionsshouldbeprivileged?
a.Setvalueoftimer.
b.Readtheclock.
c.Clearmemory.
d.Issueatrapinstruction.
e.Turnoffinterrupts.
f.Modifyentriesindevice-statustable.
g.Switchfromusertokernelmode.
h.AccessI/Odevice.
Answer:
Thefollowingoperationsneedtobeprivileged:
Setvalueoftimer,clearmemory,turnoffinterrupts,modifyentriesindevice-statustable,accessI/Odevice.Therestcanbeperformedinusermode.
1.9Someearlycomputersprotectedtheoperatingsystembyplacingitinamemorypartitionthatcouldnotbemodifiedbyeithertheuserjobortheoperatingsystemitself.Describetwodifficultiesthatyouthinkcouldarisewithsuchascheme.
Answer:
Thedatarequiredbytheoperatingsystem(passwords,accesscontrols,accountinginformation,andsoon)wouldhavetobestoredinorpassedthroughunprotectedmemoryandthusbeaccessibletounauthorizedusers.
1.10SomeCPUprovideformorethantwomodesofoperation.Whataretwopossibleusesofthesemultiplemodes?
Answer:
Althoughmostsystemsonlydistinguishbetweenuserandkernelmodes,someCPUshavesupportedmultiplemodes.Multiplemodescouldbeusedtoprovideafiner-grainedsecuritypolicy.Forexample,ratherthandistinguishingbetweenjustuserandkernel-mode,
youcoulddistinguishbetweendifferenttypesofusermode.Perhapsusersbelongingtothesamegroupcouldexecuteeachother’scode.Themachinewouldgointoaspecifiedmodewhenoneoftheseuserswasrunningcode.Whenthemachinewasinthismode,amemberofthe
groupcouldruncodebelongingtoanyoneelseinthegroup.Anotherpossibilitywouldbetoprovidedifferentdistinctionswithinkernelcode.Forexample,aspecificmodecouldallowUSBdevicedriverstorun.ThiswouldmeanthatUSBdevicescouldbeservicedwithout
havingtoswitchtokernelmode,therebyessentiallyallowingUSBdevicedriverstoruninaquasi-user/kernelmode.
1.11Timerscouldbeusedtocomputethecurrenttime.Provideashortdescription
ofhowthiscouldbeaccomplished.
Answer:
Aprogramcouldusethefollowingapproachtocomputethecurrenttimeusingtimerinterrupts.Theprogramcouldsetatimerforsometimeinthefutureandgotosleep.Whenitisawakenedbytheinterrupt,itcouldupdateitslocalstate,whichitisusingtokeeptrackofthenumberofinterruptsithasreceivedthusfar.Itcouldthenrepeatthisprocessofcontinuallysettingtimerinterruptsandupdatingitslocalstatewhentheinterruptsareactuallyraised.
1.12IstheInternetaLANoraWAN?
Answer:
TheInternetisaWANasthevariouscomputersarelocatedatgeographicallydifferentplacesandareconnectedbylong-distancenetworklinks.
2.1Whatisthepurposeofsystemcalls?
Answer:
Systemcallsallowuser-levelprocessestorequestservicesoftheoperatingsystem.
2.2Whatarethefivemajoractivitiesofanoperatingsysteminregardtoprocessmanagement?
Answer:
a.Thecreationanddeletionofbothuserandsystemprocesses
b.Thesuspensionandresumptionofprocesses
c.Theprovisionofmechanismsforprocesssynchronization
d.Theprovisionofmechanismsforprocesscommunication
e.Theprovisionofmechanismsfordeadlockhandling
2.3Whatarethethreemajoractivitiesofanoperatingsysteminregardtomemorymanagement?
Answer:
a.Keeptrackofwhichpartsofmemoryarecurrentlybeingused
andbywhom.
b.Decidewhichprocessesaretobeloadedintomemorywhenmemory
spacebecomesavailable.
c.Allocateanddeallocatememoryspaceasneeded.
2.4Whatarethethreemajoractivitiesofanoperatingsysteminregardtosecondary-storagemanagement?
Answer:
•Free-spacemanagement.
•Storageallocation.
•Diskscheduling.
2.5Whatisthepurposeofthecommandinterpreter?
Whyisitusuallyseparatefromthekernel?
Answer:
Itreadscommandsfromtheuserorfromafileofcommandsandexecutesthem,usuallybyturningthemintooneormoresystemcalls.Itisusuallynotpartofthekernelsincethecommandinterpreterissubjecttochanges.
2.6Whatsystemcallshavetobeexecutedbyacommandinterpreterorshell
inordertostartanewprocess?
Answer:
InUnixsystems,aforksystemcallfollowedbyanexecsystem
callneedtobeperformedtostartanewprocess.Theforkcallclonesthe
currentlyexecutingprocess,whiletheexeccalloverlaysanewprocess
basedonadifferentexecutableoverthecallingprocess.
2.7Whatisthepurposeofsystemprograms?
Answer:
Systemprogramscanbethoughtofasbundlesofuseful
systemcalls.Theyprovidebasicfunctionalitytouserssothatusersdo
notneedtowritetheirownprogramstosolvecommonproblems.
2.8Whatisthemainadvantageofthelayeredapproachtosystemdesign?
Whatarethedisadvantagesofusingthelayeredapproach?
Answer:
Asinallcasesofmodulardesign,designinganoperating
systeminamodularwayhasseveraladvantages.Thesystemiseasier
todebugandmodifybecausechangesaffectonlylimitedsectionsof
thesystemratherthantouchingallsectionsoftheoperatingsystem.
Informationiskeptonlywhereitisneededandisaccessibleonlywithin
adefinedandrestrictedarea,soanybugsaffectingthatdatamustbe
limitedtoaspecificmoduleorlayer.
2.9Listfiveservicesprovidedbyanoperatingsystem.Explainhoweach
providesconveniencetotheusers.Explainalsoinwhichcasesitwould
beimpossibleforuser-levelprogramstoprovidetheseservi