版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Chapter2:Computer-SystemStructures从OS的角度看计算机系统的结构,每个部件都有一个软件部分(controller)为了管理和应用计算机资源,OS自身应该包括哪些组件ComputerSystemOperationI/OStructureStorageStructureStorageHierarchyHardwareProtectionGeneralSystemArchitectureOSsystemcomponentsComputer-SystemArchitectureComputer-SystemArchitecture指令系统Computer-SystemOperationI/OdevicesandtheCPUcanexecuteconcurrently.Eachdevicecontrollerisinchargeofaparticulardevicetype.Eachdevicecontrollerhasalocalbuffer(缓存).CPUmovesdatafrom/tomainmemoryto/fromlocalbuffersI/Oisfromthedevicetolocalbufferofcontroller.DevicecontrollerinformsCPUthatithasfinisheditsoperationbycausinganinterrupt.CommonFunctionsofInterruptsInterrupt
(中断)transferscontroltotheinterruptserviceroutinegenerally,throughtheinterruptvector,whichcontainstheaddressesofalltheserviceroutines.Interruptarchitecturemustsavetheaddressoftheinterruptedinstruction.Incominginterruptsaredisabledwhileanotherinterruptisbeingprocessedtopreventalostinterrupt.A
trap
(陷阱)isasoftware-generatedinterruptcausedeitherbyanerrororauserrequest.Anoperatingsystemisinterruptdriven.(操作系统的运行是一种中断驱动机制)
OS
Application
&
user
hardwareOS启动后,设置好环境,设置好trap和interrupt。然后自顾自地运行有事call
OS有事发interruptInterruptHandlingTheoperatingsystempreservesthestateoftheCPUbystoringregistersandtheprogramcounter(PC).Determineswhichtypeofinterrupthasoccurred:polling(轮询)vectoredinterruptsystemSeparatesegmentsofcodedeterminewhatactionshouldbetakenforeachtypeofinterruptInterruptTimeLineForaSingleProcessDoingOutputInterruptTimeLineForaSingleProcessDoingOutput产生中断产生中断InterruptTimeLineForaSingleProcessDoingOutput产生中断产生中断中断处理中断处理I/OStructureAfterI/Ostarts,controlreturnstouserprogramonlyuponI/Ocompletion.–
synchronous同步WaitinstructionidlestheCPUuntilthenextinterruptWaitloop(contentionformemoryaccess).AtmostoneI/Orequestisoutstandingatatime,nosimultaneousI/Oprocessing.AfterI/Ostarts,controlreturnstouserprogramwithoutwaitingforI/Ocompletion.–
asynchronous异步Systemcall
–requesttotheoperatingsystemtoallowusertowaitforI/Ocompletion.Device-statustablecontainsentryforeachI/Odeviceindicatingitstype,address,andstate.OperatingsystemindexesintoI/Odevicetabletodeterminedevicestatusandtomodifytableentrytoincludeinterrupt.TwoI/OMethodsSynchronousAsynchronousDevice-StatusTableThetablecontaininganentryforeachI/Odevice,eachentryindicatesthedevice’stype,address,stateDirectMemoryAccessStructureUsedforhigh-speedI/Odevicesabletotransmitinformationatclosetomemoryspeeds.DevicecontrollertransfersblocksofdatafrombufferstoragedirectlytomainmemorywithoutCPUintervention.Onlyoninterruptisgeneratedperblock,ratherthantheoneinterruptperbyte.StorageStructureMainmemory–onlylargestoragemediathattheCPUcanaccessdirectly.Secondarystorage–extensionofmainmemorythatprovideslargenonvolatilestoragecapacity.Magneticdisks–rigidmetalorglassplatterscoveredwithmagneticrecordingmaterialDisksurfaceislogicallydividedintotracks,whicharesubdividedintosectors.Thediskcontrollerdeterminesthelogicalinteractionbetweenthedeviceandthecomputer.Moving-HeadDiskMechanismMoving-HeadDiskMechanism存储容量=磁头数×磁道(柱面)数×每道扇区数×每扇区字节数
要点:(1)硬盘有数个盘片,每盘片两个面,每个面一个磁头
(2)盘片被划分为多个扇形区域即扇区
(3)同一盘片不同半径的同心圆为磁道
(4)不同盘片相同半径构成的圆柱面即柱面
(5)信息记录可表示为:××磁道(柱面),××磁头,××扇区StorageHierarchy希望速度越快越好、价格越低越好、信息不要丢失Storagesystemsorganizedinhierarchy.SpeedCostVolatilityCaching
–copyinginformationintofasterstoragesystem;mainmemorycanbeviewedasalastcacheforsecondarystorage.Storage-DeviceHierarchy最贵CPU级几十个易失纳秒级M易失微秒级M、G毫秒级G不易失秒级T不易失CachingUseofhigh-speedmemorytoholdrecently-accesseddata.Requiresacachemanagementpolicy.Cachingintroducesanotherlevelinstoragehierarchy.Thisrequiresdatathatissimultaneouslystoredinmorethanoneleveltobeconsistent(一致性).MigrationofAFromDisktoRegisterCachecoherencyandconsistencyHardwareProtection为什么要保护?-保护的目的是让硬件公平、高效地为当前所有用户服务,不是保护起来不让用户使用保护哪些?-硬件资源怎么保护?-依赖于硬件Dual-ModeOperationI/OProtectionMemoryProtectionCPUProtectionDual-ModeOperation特权与普权Sharingsystemresourcesrequiresoperatingsystemtoensurethatanincorrectprogramcannotcauseotherprogramstoexecuteincorrectly.Providehardwaresupporttodifferentiatebetweenatleasttwomodesofoperations.1. Usermode(用户态、目态)
–executiondoneonbehalfofauser.2.
Monitormode(管态、内核态)
(alsokernelmodeorsystemmode)–executiondoneonbehalfofoperatingsystem.Dual-ModeOperation(Cont.)Modebitaddedtocomputerhardwaretoindicatethecurrentmode:monitor(0)oruser(1).Whenaninterruptorfaultoccurshardwareswitchestomonitormode.Privilegedinstructions
canbeissuedonlyinmonitormode.monitoruserInterrupt/faultsetusermodeI/OProtection-由OS掌控AllI/Oinstructionsareprivilegedinstructions.Mustensurethatauserprogramcouldnevergaincontrolofthecomputerinmonitormode(I.e.,auserprogramthat,aspartofitsexecution,storesanewaddressintheinterruptvector).UseofASystemCalltoPerformI/OMemoryProtection-OS确定私人空间Mustprovidememoryprotectionatleastfortheinterruptvectorandtheinterruptserviceroutines.Inordertohavememoryprotection,addtworegistersthatdeterminetherangeoflegaladdressesaprogrammayaccess:Baseregister
–holdsthesmallestlegalphysicalmemoryaddress.Limitregister
–containsthesizeoftherangeMemoryoutsidethedefinedrangeisprotected.UseofABaseandLimitRegisterHardwareAddressProtectionHardwareProtectionWhenexecutinginmonitormode,theoperatingsystemhasunrestrictedaccesstobothmonitoranduser’smemory.Theloadinstructionsforthebaseandlimitregistersareprivilegedinstructions.CPUProtection-工作与休息Timer(定时器)
–interruptscomputerafterspecifiedperiodtoensureoperatingsystemmaintainscontrol.Timerisdecrementedeveryclocktick.Whentimerreachesthevalue0,aninterruptoccurs.Timercommonlyusedtoimplementtimesharing.Timealsousedtocomputethecurrenttime.Load-timerisaprivilegedinstruction.NetworkStructureLocalAreaNetworks(LAN)WideAreaNetworks(WAN)LocalAreaNetworkStructureWideAreaNetworkStructureOSsystemcomponentsCPU-ProcessmanagementMemory-Main-memorymanagementDisk-FilemanagementStoragesystem-Secondary-storagemanagementI/O-I/O-systemmanagement不同计算机连起来
-Networking保护和安全
-Protectionsystem计算机为人所用
-Userinterfacesystemsummary从OS角度看计算机系统硬件保护双模态、定时器OS自身的系统组件作业1.Howdoesthedistinctionbetweenmonitormodeandusermodefunctionasarudimentaryformofprotection(security)system?2.
Whatarethedifferencesbetweenatrapandaninterrupt?Whatistheuseofeachfunction?3.Whichofthefol
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中职(新能源汽车运用与维修)转向系统检测试题及答案
- 2025年中职机电一体化技术(机电工程实务)试题及答案
- 2026届四川南充市高考一诊地理试卷试题(含答案详解)
- 深度解析(2026)《GBT 18311.5-2003纤维光学互连器件和无源器件 基本试验和测量程序 第3-5部分检查和测量 衰减对波长的依赖性》
- 深度解析(2026)《GBT 17980.126-2004农药 田间药效试验准则(二) 第126部分除草剂防治花生田杂草》
- 深度解析(2026)《GBT 17980.11-2000农药 田间药效试验准则(一) 杀螨剂防治桔全爪螨》
- 深度解析(2026)GBT 17771-2010土方机械 落物保护结构 试验室试验和性能要求
- 深度解析(2026)《GBT 17626.18-2016电磁兼容 试验和测量技术 阻尼振荡波抗扰度试验》(2026年)深度解析
- 共享设施维护保养操作规程
- 江西枫林涉外经贸职业学院《微生物与寄生虫学》2025-2026学年第一学期期末试卷
- 西汉陪同口译 I知到智慧树章节测试课后答案2024年秋上海杉达学院
- 新旧《预包装食品标签通则》对比(中文简体)
- DL∕T 1053-2017 电能质量技术监督规程
- NB-T20319-2014压水堆核电厂技术规格书编制准则
- 起重机维护保养记录表
- DB4409-T 48-2023 三叉苦种植技术规范
- 10千伏及以下线损管理题库附答案
- 关于食品专业实习报告(5篇)
- 蛋糕店充值卡合同范本
- 《美国和巴西》复习课
- 模切机个人工作总结
评论
0/150
提交评论