APS审核操作系统.docx
《APS审核操作系统.docx》由会员分享,可在线阅读,更多相关《APS审核操作系统.docx(14页珍藏版)》请在冰豆网上搜索。
APS审核操作系统
操作系统
OperatingSystem
WhatisanOperatingSystem?
Aprogramthatactsasanintermediarybetweenauserofacomputerandthecomputerhardware
Operatingsystemgoals:
Executeuserprogramsandmakesolvinguserproblemseasier
Makethecomputersystemconvenienttouse
Usethecomputerhardwareinanefficientmanner
ComputerSystemStructure
Computersystemcanbedividedintofourcomponents
Hardware–providesbasiccomputingresources
CPU,memory,I/Odevices
Operatingsystem
Controlsandcoordinatesuseofhardwareamongvariousapplicationsandusers
Applicationprograms–definethewaysinwhichthesystemresourcesareusedtosolvethecomputingproblemsoftheusers
Wordprocessors,compilers,webbrowsers,databasesystems,videogames
Users
People,machines,othercomputers
OperatingSystemDefinition
OSisaresourceallocator
Managesallresources
Decidesbetweenconflictingrequestsforefficientandfairresourceuse
OSisacontrolprogram
Controlsexecutionofprogramstopreventerrorsandimproperuseofthecomputer
Nouniversallyaccepteddefinition
“Theoneprogramrunningatalltimesonthecomputer”isthekernel.
Everythingelseiseitherasystemprogram(shipswiththeoperatingsystem)oranapplicationprogram
ComputerSystemOrganization
Computer-SystemArchitecture
Mostsystemsuseasinglegeneral-purposeprocessor(PDAsthroughmainframes)
Mostsystemshavespecial-purposeprocessorsaswell
Multiprocessorssystemsgrowinginuseandimportance
Alsoknownasparallelsystems,tightly-coupledsystems
Advantagesinclude
1.Increasedthroughput
2.Economyofscale
3.Increasedreliability–gracefuldegradationorfaulttolerance
Twotypes
1.AsymmetricMultiprocessing
2.SymmetricMultiprocessing
Operating-SystemOperations
Interruptdrivenbyhardware
Softwareerrororrequestcreatesexceptionortrap
Divisionbyzero,requestforoperatingsystemservice
Otherprocessproblemsincludeinfiniteloop,processesmodifyingeachotherortheoperatingsystem
Dual-modeoperationallowsOStoprotectitselfandothersystemcomponents
Usermodeandkernelmode
Modebitprovidedbyhardware
Providesabilitytodistinguishwhensystemisrunningusercodeorkernelcode
Someinstructionsdesignatedasprivileged,onlyexecutableinkernelmode
Systemcallchangesmodetokernel,returnfromcallresetsittouser
ProcessManagement
Aprocessisaprograminexecution.Itisaunitofworkwithinthesystem.Programisapassiveentity,processisanactiveentity.
Processneedsresourcestoaccomplishitstask
CPU,memory,I/O,files
Initializationdata
Processterminationrequiresreclaimofanyreusableresources
Single-threadedprocesshasoneprogramcounterspecifyinglocationofnextinstructiontoexecute
Processexecutesinstructionssequentially,oneatatime,untilcompletion
Multi-threadedprocesshasoneprogramcounterperthread
Typicallysystemhasmanyprocesses,someuser,someoperatingsystemrunningconcurrentlyononeormoreCPUs
ConcurrencybymultiplexingtheCPUsamongtheprocesses/threads
ProcessManagementActivities
Theoperatingsystemisresponsibleforthefollowingactivitiesin connectionwithprocessmanagement:
Creatinganddeletingbothuserandsystemprocesses
Suspendingandresumingprocesses
Providingmechanismsforprocesssynchronization
Providingmechanismsforprocesscommunication
Providingmechanismsfordeadlockhandling
MemoryManagement
Alldatainmemorybeforeandafterprocessing
Allinstructionsinmemoryinordertoexecute
Memorymanagementdetermineswhatisinmemorywhen
OptimizingCPUutilizationandcomputerresponsetousers
Memorymanagementactivities
Keepingtrackofwhichpartsofmemoryarecurrentlybeingusedandbywhom
Decidingwhichprocesses(orpartsthereof)anddatatomoveintoandoutofmemory
Allocatinganddeallocatingmemoryspaceasneeded
StorageManagement
OSprovidesuniform,logicalviewofinformationstorage
Abstractsphysicalpropertiestologicalstorageunit -file
Eachmediumiscontrolledbydevice(i.e.,diskdrive,tapedrive)
Varyingpropertiesincludeaccessspeed,capacity,data-transferrate,accessmethod(sequentialorrandom)
File-Systemmanagement
Filesusuallyorganizedintodirectories
Accesscontrolonmostsystemstodeterminewhocanaccesswhat
OSactivitiesinclude
Creatinganddeletingfilesanddirectories
Primitivestomanipulatefilesanddirs
Mappingfilesontosecondarystorage
Backupfilesontostable(non-volatile)storagemedia
Mass-StorageManagement
Usuallydisksusedtostoredatathatdoesnotfitinmainmemoryordatathatmustbekeptfora“long”periodoftime
Propermanagementisofcentralimportance
Entirespeedofcomputeroperationhingesondisksubsystemanditsalgorithms
OSactivities
Free-spacemanagement
Storageallocation
Diskscheduling
Somestorageneednotbefast
Tertiarystorageincludesopticalstorage,magnetictape
Stillmustbemanaged
VariesbetweenWORM(write-once,read-many-times)andRW(read-write)
I/OSubsystem
OnepurposeofOSistohidepeculiaritiesofhardwaredevicesfromtheuser
I/Osubsystemresponsiblefor
MemorymanagementofI/Oincluding
buffering(storingdatatemporarilywhileitisbeingtransferred),
caching(storingpartsofdatainfasterstorageforperformance),
spooling(theoverlappingofoutputofonejobwithinputofotherjobs)
Generaldevice-driverinterface
Driversforspecifichardwaredevices
AViewofOperatingSystemServices
Onesetofoperating-systemservicesprovidesfunctionsthatarehelpfultotheuser:
Userinterface-Almostalloperatingsystemshaveauserinterface(UI)
VariesbetweenCommand-Line(CLI),GraphicsUserInterface(GUI),Batch
Programexecution-Thesystemmustbeabletoloadaprogramintomemoryandtorunthatprogram,endexecution,eithernormallyorabnormally(indicatingerror)
I/Ooperations- ArunningprogrammayrequireI/O,whichmayinvolveafileoranI/Odevice
File-systemmanipulation- Thefilesystemisofparticularinterest.Programsneedtoreadandwritefilesanddirectories,createanddeletethem,searchthem,listfileInformation,permissionmanagement.
Communications–Processesmayexchangeinformation,onthesamecomputerorbetweencomputersoveranetwork
Communicationsmaybeviasharedmemoryorthroughmessagepassing(packetsmovedbytheOS)
Errordetection–OSneedstobeconstantlyawareofpossibleerrors
MayoccurintheCPUandmemoryhardware,inI/Odevices,inuserprogram
Foreachtypeoferror,OSshouldtaketheappropriateactiontoensurecorrectandconsistentcomputing
Debuggingfacilitiescangreatlyenhancetheuser’sandprogrammer’sabilitiestoefficientlyusethesystem
AnothersetofOSfunctionsexistsforensuringtheefficientoperationofthesystemitselfviaresourcesharing
Resourceallocation-When multipleusersormultiplejobsrunningconcurrently,resourcesmustbeallocatedtoeachofthem
Manytypesofresources- Some(suchasCPUcycles,mainmemory,andfilestorage)mayhavespecialallocationcode,others(suchasI/Odevices)mayhavegeneralrequestandreleasecode
Accounting-Tokeeptrackofwhichusersusehowmuchandwhatkindsofcomputerresources
Protectionandsecurity-Theownersofinformationstoredinamultiuserornetworkedcomputersystemmaywanttocontroluseofthatinformation,concurrentprocessesshouldnotinterferewitheachother
Protectioninvolvesensuringthatallaccesstosystemresourcesiscontrolled
Securityofthesystemfromoutsidersrequiresuserauthentication,extendstodefendingexternalI/Odevicesfrominvalidaccessattempts
Ifasystemistobeprotectedandsecure,precautionsmustbeinstitutedthroughoutit.Achainisonlyasstrongasitsweakestlink.
CommandLineInterface(CLI)orcommandinterpreterallowsdirectcommandentry
Sometimesimplementedinkernel,sometimesbysystemsprogram
Sometimesmultipleflavorsimplemented–shells
Primarilyfetchesacommandfromuserandexecutesit
●Sometimescommandsbuilt-in,sometimesjustnamesofprograms
●Ifthelatter,addingnewfeaturesdoesn’trequireshellmodification
GUI User-friendlydesktopmetaphorinterface
Usuallymouse,keyboard,andmonitor
Iconsrepresentfiles,programs,actions,etc
Variousmousebuttonsoverobjectsintheinterfacecausevariousactions(provideinformation,options,executefunction,opendirectory(knownasafolder)
InventedatXeroxPARC
ManysystemsnowincludebothCLIandGUIinterfaces
MicrosoftWindowsisGUIwithCLI“command”shell
AppleMacOSXas“Aqua”GUIinterfacewithUNIXkernelunderneathandshellsavailable
SolarisisCLIwithoptionalGUIinterfaces(JavaDesktop,KDE)
SystemCalls
ProgramminginterfacetotheservicesprovidedbytheOS
Typicallywritteninahigh-levellanguage(CorC++)
Mostlyaccessedbyprogramsviaahigh-levelApplicationProgramInterface(API)ratherthandirectsystemcalluse
ThreemostcommonAPIsare
Win32APIforWindows,
POSIXAPIforPOSIX-basedsystems(includingvirtuallyallversionsofUNIX,Linux,andMacOSX),and
JavaAPIfortheJavavirtualmachine(JVM)
TypesofSystemCalls
Processcontrol
Filemanagement
Devicemanagement
Informationmaintenance
Communications
Protection
VirtualMachines
Avirtualmachinetakesthelayeredapproachtoitslogicalconclusion.
Ittreatshardwareandtheoperatingsystemkernelasthoughtheywereallhardware
Avirtualmachineprovidesaninterfaceidenticaltotheunderlyingbarehardware
Theoperatingsystemhostcreatestheillusionthataprocesshasitsownprocessorand(virtualmemory)
Eachguestprovidedwitha(virtual)copyofunderly