review操作系统基础.docx
《review操作系统基础.docx》由会员分享,可在线阅读,更多相关《review操作系统基础.docx(78页珍藏版)》请在冰豆网上搜索。
review操作系统基础
“A”representemphasesorchargecontent
“B”representfamiliarwithcontent
“C”representunderstandcontent
Chapter1:
Introduction
1.WhatisanOperatingSystem?
A
Aprogramthatactsasanintermediarybetweenauserofacomputerandthecomputerhardware.
Operatingsystemgoals:
Executeuserprogramsandmakesolvinguserproblemseasier.
Makethecomputersystemconvenienttouse.
Usethecomputerhardwareinanefficientmanner.
2.OperatingSystemDefinitionA
OSisaresourceallocator
Managesallresources
Decidesbetweenconflictingrequestsforefficientandfairresourceuse
OSisacontrolprogram
Controlsexecutionofprogramstopreventerrorsandimproperuseofthecomputer
“Everythingavendorshipswhenyouorderanoperatingsystem”isgoodapproximation
“Theoneprogramrunningatalltimesonthecomputer”isthekernel.Everythingelseiseitherasystemprogram(shipswiththeoperatingsystem)oranapplicationprogram
3.ComputerSystemStructureB
Computersystemcanbedividedintofourcomponents
Hardware–providesbasiccomputingresources
Operatingsystem:
Controlsandcoordinatesuseofhardwareamongvariousapplicationsandusers
Applicationprograms–definethewaysinwhichthesystemresourcesareusedtosolvethecomputingproblemsoftheusers
Users:
People,machines,othercomputers
4.ComputerSystemOrganizationB
Computer-systemoperation
OneormoreCPUs,devicecontrollersconnectthroughcommonbusprovidingaccesstosharedmemory
ConcurrentexecutionofCPUsanddevicescompetingformemorycycles
5.ComputerStartupA
bootstrapprogramisloadedatpower-uporreboot
TypicallystoredinROMorEPROM,generallyknownasfirmware
Initializatesallaspectsofsystem
Loadsoperatingsystemkernelandstartsexecution
6.CommonFunctionsofInterruptsA
Interrupttransferscontroltotheinterruptserviceroutinegenerally,throughtheinterruptvector,whichcontainstheaddressesofalltheserviceroutines.
Interruptarchitecturemustsavetheaddressoftheinterruptedinstruction.
Incominginterruptsaredisabledwhileanotherinterruptisbeingprocessedtopreventalostinterrupt.
Atrapisasoftware-generatedinterruptcausedeitherbyanerrororauserrequest.
Anoperatingsystemisinterruptdriven.
7.InterruptHandlingA
TheoperatingsystempreservesthestateoftheCPUbystoringregistersandtheprogramcounter.
Determineswhichtypeofinterrupthasoccurred:
polling
vectoredinterruptsystem
Separatesegmentsofcodedeterminewhatactionshouldbetakenforeachtypeofinterrupt
8.StorageHierarchyB
Storagesystemsorganizedinhierarchy.
Speed
Cost
Volatility
Caching–copyinginformationintofasterstoragesystem;mainmemorycanbeviewedasalastcacheforsecondarystorage.
9.DirectMemoryAccessStructureB
Usedforhigh-speedI/Odevicesabletotransmitinformationatclosetomemoryspeeds.
DevicecontrollertransfersblocksofdatafrombufferstoragedirectlytomainmemorywithoutCPUintervention.
Onlyoneinterruptisgeneratedperblock,ratherthantheoneinterruptperbyte.
10.OperatingSystemStructure(thedifferencebetweenmultiprogrammingandtimesharingmethods)B
Multiprogrammingneededforefficiency
SingleusercannotkeepCPUandI/Odevicesbusyatalltimes
Multiprogrammingorganizesjobs(codeanddata)soCPUalwayshasonetoexecute
Asubsetoftotaljobsinsystemiskeptinmemory
Onejobselectedandrunviajobscheduling
Whenithastowait(forI/Oforexample),OSswitchestoanotherjob
Timesharing(multitasking)islogicalextensioninwhichCPUswitchesjobssofrequentlythatuserscaninteractwitheachjobwhileitisrunning,creatinginteractivecomputing
Responsetimeshouldbe<1second
Eachuserhasatleastoneprogramexecutinginmemoryprocess
IfseveraljobsreadytorunatthesametimeCPUscheduling
Ifprocessesdon’tfitinmemory,swappingmovestheminandouttorun
Virtualmemoryallowsexecutionofprocessesnotcompletelyinmemory
11.Operating-SystemOperationsA
Interruptdrivenbyhardware
Softwareerrororrequestcreatesexceptionortrap
Divisionbyzero,requestforoperatingsystemservice
Otherprocessproblemsincludeinfiniteloop,processesmodifyingeachotherortheoperatingsystem
Dual-modeoperationallowsOStoprotectitselfandothersystemcomponents
Usermodeandkernelmode
Modebitprovidedbyhardware
Providesabilitytodistinguishwhensystemisrunningusercodeorkernelcode
Someinstructionsdesignatedasprivileged,onlyexecutableinkernelmode
Systemcallchangesmodetokernel,returnfromcallresetsittouser
12.TransitionfromUsertoKernelModeA
Timertopreventinfiniteloop/processhoggingresources
Setinterruptafterspecificperiod
Operatingsystemdecrementscounter
Whencounterzerogenerateaninterrupt
Setupbeforeschedulingprocesstoregaincontrolorterminateprogramthatexceedsallottedtime
Chapter2:
Operating-SystemStructures
1.OperatingSystemServicesA
Onesetofoperating-systemservicesprovidesfunctionsthatarehelpfultotheuser:
Userinterface-Almostalloperatingsystemshaveauserinterface(UI)
VariesbetweenCommand-LineInterface(CLI),GraphicsUserInterface(GUI),andBatch
Functionsthatarehelpfultotheuserandtoprocesses:
Programexecution-Loadaprogramintomemoryandrunit
File-systemmanipulation-Move,copy,anddeletefiles,createdirectories,changepermissions,etc.
Communications–Processesmayexchangeinformation,onthesamecomputerorbetweencomputersoveranetwork
Communicationsmaybeviasharedmemoryorthroughmessagepassing(packetsmovedbytheOS)
AnothersetofOSfunctionsexistsforensuringtheefficientoperationofthesystemitselfviaresourcesharing
Resourceallocation-Whenmultipleusersormultiplejobsrunningconcurrently,resourcesmustbeallocatedtoeachofthem
Manytypesofresources-Some(suchasCPUcycles,mainmemory,andfilestorage)mayhavespecialallocationcode,others(suchasI/Odevices)mayhavegeneralrequestandreleasecode.
Accounting-Tokeeptrackofwhichusersusehowmuchandwhatkindsofcomputerresources
Protectionandsecurity-Theownersofinformationstoredinamultiuserornetworkedcomputersystemmaywanttocontroluseofthatinformation,concurrentprocessesshouldnotinterferewitheachother
2.UserOperatingSystemInterface-CLIA
CLIallowsdirectcommandentry
Sometimesimplementedinkernel,sometimesbysystemsprogram
Sometimesmultipleflavorsimplemented–shells
3.UserOperatingSystemInterface-GUIA
User-friendlydesktopinterface
Iconsrepresentfiles,programs,actions,etc.
Variousmousebuttonsoverobjectsintheinterfacecausevariousactions
4.SystemCallsA
ProgramminginterfacetotheservicesprovidedbytheOS:
Processcontrol,filemanagement,devicemanagement,informationservices,communications
Typicallywritteninahigh-levellanguage(CorC++)
Mostlyaccessedbyprogramsviaahigh-levelApplicationProgramInterface(API)ratherthandirectsystemcalluse
5.SystemCallImplementationA
Typicallyusingsoftwareinterrupt(trap)
Registerissettoanumberassociatedwiththesystemcall
System-callinterfacemaintainsatableindexedaccordingtothesenumbers(cf.interruptvector)
ThesystemcallinterfaceinvokesintendedsystemcallinOSkernelandreturnsstatusofthesystemcallandanyreturnvalues
6.OperatingSystemDesignandImplementationA
Importantprincipletoseparate
Policy:
Whatwillbedone?
Mechanism:
Howtodoit?
Mechanismsdeterminehowtodosomething,policiesdecidewhatwillbedone
Theseparationofpolicyfrommechanismisaveryimportantprinciple,itallowsmaximumflexibilityifpolicydecisionsaretobechangedlater
7.VirtualMachinesB
Avirtualmachinetakesthelayeredapproachtoitslogicalconclusion
Ittreatshardwareandtheoperatingsystemkernelasthoughtheywereallhardware
Avirtualmachineprovidesaninterfaceidenticaltotheunderlyingbarehardware
8.OperatingSystemGenerationC
Operatingsystemsaredesignedtorunonanyofaclassofmachines;thesystemmustbeconfiguredforeachspecificcomputersite
SYSGENprogramobtainsinformationconcerningthespecificconfigurationofthehardwaresystem
Booting–startingacomputerbyloadingthekernel
Bootstrapprogram–codestoredinROMthatisabletolocatethekernel,loaditintomemory,andstartitsexecution
Chapter3:
Processes
1.ProcessConceptA
Anoperatingsystemexecutesavarietyofprograms:
Batchsystem–jobs
Time-sharedsystems–userprogramsortasks
Textbookusesthetermsjobandprocessalmostinterchangeably
Process–aprograminexecution;processexecutionmustprogressinsequentialfashion
Aprocessincludes:
programcounter
stack
datasection
2.ProcessStateA
Asaprocessexecutes,itchangesstate
new:
Theprocessisbeingcreated
running:
Instructionsarebeingexecuted
waiting:
Theprocessiswaitingforsomeeventtooccur
ready:
Theprocessiswaitingtobeassignedtoaprocessor
terminated:
Theprocesshasfinishedexecution
DiagramofProcessStateA
3.ProcessControlBlock(PCB)A
Informationassociatedwitheachprocess
Processstate
Programcounter
CPUregisters
CPUschedulinginformation
Memory-managementinformation
Accountinginformation
I/Ostatusinformation
ProcessControlBlock(PCB)
4.ProcessSchedulingQueuesA
Jobqu