计算机操作系统OperatingSystemOverview_第1页
计算机操作系统OperatingSystemOverview_第2页
计算机操作系统OperatingSystemOverview_第3页
计算机操作系统OperatingSystemOverview_第4页
计算机操作系统OperatingSystemOverview_第5页
已阅读5页,还剩46页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

计算机操作系统OperatingSystemOverviewContentsOperatingSystemObjectivesandFunctionsTheEvolutionofOperatingSystemMajorAchievementsCharacteristicsofModernOSExamples(NT、UNIX)1.1ObjectivesandFunctions(p45)1.1.1Overview1.1.2TheOperatingSystemasaUser/ComputerInterface1.1.3TheOperatingSystemasResourceManager1.1.4EaseofEvolutionofanOperatingSystemAnoperatingsystemisaprogramthatmanagesthecomputer,controlstheexecutionofapplicationprogramsandactsasaninterface(接口)betweentheuserofacomputerandthecomputerhardware.ObjectivesConvenience(方便)Efficiency(有效)Abilitytoevolve(易扩展)1.1.1Overview1.1.2OSasaUser/ComputerInterface(I)Figure2.1LayersandViewsofaComputerSystemComputerHardwareOperatingSystemUtilities(Compiler,Database…)ApplicationsProgramsOperatingSystemDesignerProgrammersEndUserTheoperatingsystemmasks(隐藏)thedetailsofthehardwarefromtheprogrammer,andprovidestheprogrammerwithaconvenientinterfaceforusingthesystem.ThetypesofsysteminterfaceCommandinterface:systemcommand(internal、external)Graphicsinterface:windowsProgrammerinterface:systemcall,c-libOSasaUser/ComputerInterface(II)ServicesoftheOperatingSystem(I)ProgramcreationSuchas:fork(unix)、CreateProcess(win)ProgramexecutionSuchas:execl,execpAccesstoI/OdevicesSuchas:read/writeControlledaccesstofilesSuchas:read/writeServicesoftheOperatingSystem(II)SystemaccessProvideprotectionandauthorizedErrordetectionandresponseSuchas:errorAccounting1.1.3OSasResourceManager(I)(p47)TypesofResource:CPU、Memory、DevicesOSasResourceManager(II)AsacontrolmechanismisunusualintworespectsTheOSfunctionsinthesamewayasordinarycomputersoftware;thatis,itisaprogramexecutedbytheprocessor.TheOSfrequentlyrelinquishescontrol(释放控制)andmustdependontheprocessortoallowittoregaincontrol(获取控制).OSasResourceManager(IIIFigure2.2)ManagementofCPUManagementofI/ODeviceManagementofMemoryManagementofFilesConcept:Kernel、Nucleus(内核):Alwaysinmainmemory,containsthemost-frequently-usedfunctions1.1.4EaseofEvolution(p49)ReasonsforevolutionhardwareupgradesExp:supportpagingnewservicesfixesImplementssoftwareengineering:modules、layer、objectdesign1.2TheEvolutionofOperatingSystems1.2.1SerialProcessing1.2.2SimpleBatchSystems1.2.3Multiprogrammed(多道)BatchSystems1.2.4Time-SharingSystems1.2.1SerialProcessing(p50串行处理)ExampleInputCalculatePrintProblemsScheduling:TheestimatedtimeisnotaccurateSetuptime:Betweenthesetupprocedure,ifanerroroccurred,thenmustgobacktothebeginningofthesetupsequenceContradictionbetweenhumanandmachine1.2.2SimpleBatchSystemObjectives:SolutioncontradictionbetweenhumanandmachineUsersubmitsthejoboncardsortapetoacomputeroperator(useJCL(jobcontrollanguage))Implement:MonitorFromthePointofViewoftheMonitor(p51)MonitorisresponsiblefortherunningofeveryjobControlsaretransferredbetweenmonitorandotheruserprogramsInterruptprocessingDeviceDriversJobSequencingControlLanguageInterpreterUserProgramAreamonitorMemorylayoutforaresident(驻留)monitorFromthePointofViewoftheProcessorWhenCPUrunscommandofmonitor,themonitorgainsthecontrol.WhenCPUrunscommandofuserprogram,theuserprogramgainsthecontrol.Transferthecontrol:Firstmonitorgainsthecontrol,whenuserprogramloadin,itgainsthecontrol,whentheuserprogramfinishorerror,themonitorregains(重获)thecontrol.JCL(JobControlLanguage)$JOB//begin$FTN//usingFortrancompileandlink…Fortran//instructions$LOAD//loadinrunablemodules$RUN//running.$END//finishdothejobOtherHardwareFeatureDesirable(p53)Memoryprotection(内存保护):Userspaceandsystemspaceareindependent.E.g.Hardwarecandetectoutsideaccessingerror.Timerinterrupt(时钟中断):Whenthetimerexpires,aninterruptoccurs.Privilegedinstructions(特权指令):Canbeexecutedonlybythemonitor.Interrupts:ImprovementefficiencyEasyforrelinquishing(释放)andregainingcontrol1.2.3MultiprogrammedBatchSystemsReadonerecord 0.0015secondsExecute100instructions 0.0001secondsWriteonerecord 0.0015secondsTOTAL 0.0031secondsFigure2.4SystemUtilizationExampleUniprogramming(单道)haslowefficiency(效率):CPUI/OcontradictionMultiprogramming/MultitaskingTherearemanyuserprogramsinthememory.HardwareneedforMultiprogramming.InterruptionExampleofMultiprogramming256kavailablememoryNotes:notconsidertheresourcecompetitionJOB1JOB2JOB3TypeofJOBHeavyComputerHeavyI/OHeavyI/ODuration5min15min10minMemoryrequired50k100k80kNeeddiskNoNoYesNeedterminalNoYesNoNeedprinterNoNoYesTable2.1SampleProgramExecutionAttributesAnalysisAnalysisSingleProcessoruse=5/(5+15+10)=17%Memoryuse=[(50*5+100*15+80*10)/256/30]=33%Diskuse=10/30=33%Printeruse=10/30=33%Totaltime=5+15+10=30Throughput=6job/hourMeanresponsetime=(5+20+30)/3=18AnalysisMultiprogrammingProcessoruse=5/15=33%Memoryuse=[(50+100+80)*5+(100+80)*5+100*5]/256/15=65%Diskuse=10/15=67%Printeruse=10/15=67%Totaltime=15Throughout=12job/hourMeanresponsetime=(5+10+15)/3=10Sophisticated(复杂性)ofMultiprogramming(p57)MemorymanagementSchedulingAlgorithm(算法):Theprocessor(处理器)mustdecidewhichonetorun.1.2.4Time-SharingSystemsMultipleuserssimultaneously(同时)accessthesystemthroughterminals(终端)Concepts:timeslice(时间片):qusernum(用户数):nresponsetime(响应时间):tt=n×qMode:multi-terminals、multi-windowsBatchMultiprogrammingvsTimerSharingBatchMultiprogramming

TimeSharing

Principalobjective

Maximizeprocessoruse

Minimizeresponsetime

Sourceofinstructiontooperatingsystem

Jobcontrollanguagecommandsprovidedwiththejob

Commandsenteredattheterminal

ReducingtheSwappingLoadsbyPartialSwapping(p59)Reducingthespendingforaccessingdisk1.3MajorAchievements(p60)1.3.1Processes(进程)1.3.2Memorymanagement1.3.3Informationprotectionandsecurity1.3.4Schedulingandresourcemanagement1.3.5Systemstructure1.3.1ProcessesAprograminexecutionTheanimatedspirit(活动精灵)ofaprogramTheentity(实体)thatcanbeassigned(分派)toandexecutedonaprocessorThreemajortypesofcomputersystemMultiprogrammingbatchoperationTimesharingReal-timetransaction(处理)systemsErrorsMayHappeninMultiprogrammingImpropersynchronization(同步):Signalsbeinglostorduplicate(重复)signalsbeingreceived.Failedmutualexclusion(失败的互斥)Nondeterminate(不确定)programoperation:TheresultisnotuniqueDeadlocks(死锁)Tosolutetheseproblems,introduceprocessconcept

Processentity(实体)AnexecutableprogramTheassociateddataneededbytheprogramTheexecutioncontext(上下文)oftheprogramProcessImageandProcessSwitch(切换)(p63)1.3.2MemoryManagementProcessisolation(隔离)AutomaticallocationandmanagementSupportofmodular(模块化)programmingVirtuallymemoryLong-termstorageProtectionandaccesscontrol(访问控制)Fig2.10TwoViewsofaStorageSystemVirtualProcessorRealProcessorMapper(AddressTranslate)MainMemoryAuxiliaryMemoryVirtualMemoryFiles(a)User’sView(b)OperatingSystemDesigner’sViewVirtualAddressMemoryAddressSwappingRead,WriteCopyLong-termStore1.3.3InformationProtectionandSecurityAccesscontrol:forvariousresourcesinthesystemInformationflowcontrol(信息流控):toguaranteethedatatosendtodestinationCertification(认证)1.3.4SchedulingandResourceManagement(p66)ThreefactorsmustbeconsiderFairnessDifferentialresponsiveness(区分服务):e.g.IfaprocessiswaitingfortheuseofanI/Odevice,theoperatingsystemmaywishtoschedulethatprocessforexecutionassoonaspossibleinordertofreeupthedeviceforlaterdemandsfromotherprocesses.Efficiency:Maximizethroughput(吞吐量),minimizeresponsetime,accommodate(容纳)asmanyusersaspossibleShort-termqueueAlgorithmusedtouse:roundrobin(轮转)Long-termqueueAlgorithmusedtouse:FIFOInterrupthandler:themethodforgetthecontrolServicecallhandler(系统服务处理):theentrypointintotheoperatingsystemSomeConcepts(p67)Fig2.11KeyelementsofanOperatingSystemforMultiprogrammingServiceCallHandlerInterruptHandlerLong-termQueueShort-termQueueShort-TermSchedulerI/OqueueOSModules(模块化)structure:onlysuitableforsmallsystem;forcomplexsystem,difficultfordebugHierarchical(层)structureLevelnprovidesserviceforleveln+1SystemStructure(p68系统结构)Hierarchy(Table2.4)Level Name Objects ExampleOperations13 Shell Userprogramming Statementsinshelllanguage environment12 Userprocesses Userprocesses Quit,kill,suspend,resume11 Directories Directories Create,destroy,attach,detach, search,list10 Devices Externaldevices Open,close, asprinter,displays read,write

andkeyboards9 Filesystem Files Create,destroy,open,close

read,write8 Communications Pipes Create,destroy,open,close,

read,writeHierarchyLevel Name Objects ExampleOperations7 VirtualMemory Segments,pages Read,write,fetch6 Localsecondary Blocksofdata,device Read,write,allocate,free

store channels5 PrimitiveprocessesPrimitiveprocess, Suspend,resume,wait, semaphores,ready

signal list

Hierarchy(Hardware)Level Name Objects ExampleOperations4 Interrupts Interrupt-handling Invoke,mask,unmask,retry programs

Procedures Procedures,callstack, Markstack,call,return display2 InstructionSet Evaluationstack,micro- Load,store,add,subtract programinterpreter, branch scalarandarraydata1 Electroniccircuits Registers,gates,buses, Clear,transfer,activate, etc. complement1.4.1Microkernelarchitecture(微内核结构)1.4.2Multithreading(多线程)1.4.3Symmetricmultiprocess(对称多处理)1.4.4Distributedoperatingsystems(分布式系统)1.4.5Object-orienteddesign(对象设计)1.4CharacteristicsofModernOS(p71)Assignsonlyafewessential(必要的)functionstothekernel,includingaddressspaces,interprocesscommunication(IPC)(进程间通信),andbasicscheduling.Simplifiesimpl

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论