版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 车辆过户授权委托书
- 企业客户接入规范方案
- 受限空间乘坐电梯安全警示牌 模板
- 庭审规则考试题及答案
- 期货交易规则与风控知识测试题
- 瑞博生物-B首次覆盖:深耕siRNA研发创新管线价值亟待兑现
- 利率|5月经济增长动能延续分化
- 2025-2026学年上海市奉贤区高一(上)期末数学试卷(含解析)
- 2025-2026学年肥皂教学设计
- 河南省天立教育2025-2026学年高二上学期10月联考物理试题
- 2024年河北省中考语文真题试卷及答案
- 2024年湖北省中考数学真题试卷及答案
- 2024年河北省石家庄市中考地理试题(含答案)
- 小学四年级下册数学期末测试试卷带答案(完整版)
- 乳腺乳管镜检查手术
- 各国打招呼方式简介课件
- 起重工理论知识试卷
- 2022年重庆市巴南区辅警考试试卷真题
- 现代全口义齿学智慧树知到答案章节测试2023年浙江大学
- GB/T 16400-2015绝热用硅酸铝棉及其制品
- GB/T 12220-2015工业阀门标志
评论
0/150
提交评论