已阅读5页,还剩40页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
OperatingSystem Chapter5 DeviceManagementGuangShunShiDepartmentofComputerScience NanKaiUniversityEmail gsshi WebSite http 202 113 15 72 osteach ArchitectureofDeviceManagementSystem OperatingSystem CITS NanKaiUniversity 2 Applicationlevel Controler CMDReg InterruptHandler DeviceDriver HardwareAbstractLevel UserProcess StatusReg DataReg CategoriesofDevices ClassifiedbyFunctionStoragedevice TemporarilyorpermanentlyI Odevice Human ComputerinteractiveCommunicationdevice DataexchangeandtransferClassifiedbyDatamanagementmethodBlockstream usingblockindifferentsizeasthebasicunitfordatamanagementBytestream usingbyteasthebasicunitforDMClassifiedbyDeviceassignmentMonopolizationdevice Low speedI OdeviceSharingdevice high speedI OdeviceVirtualdevice simulatinghardwarebysoftwareClassifiedbyworkingmodeLogicaldevice datastructuremaintainedbyOSPhysicaldevice differentkindsofhardware OperatingSystem CITS NanKaiUniversity 3 DiscussionofDevicesManagement ComplexityofDeviceDifferentdeviceshavedifferentworkingmodeDifferentdevicesusedifferentdataformatDifferentdevicessupportdifferentinterfacesImportantissuesaboutdevicesSpeed thebottleneckofcomputerHCI operationmistakecausedbyuserCompatibility device independent OS independentKeystrategyofdevicemanagementEfficientandreasonable harmonizethespeeddifferencebetweenCPU RAManddevices Controlandmanagedevicesinmoreefficientway Convenient compatible safeandstableStandardization thebasementofITindustry OperatingSystem CITS NanKaiUniversity 4 PurposeofDevicesManagement Device independentprogramminginterfaceHidethedifferencebetweenhardwarecomponentsProvidesimpleanduniversalcontrolmethodsforuserMaintainthesafetyandstabilityofuserprocessEfficientmanagementstrategyAllocationandreleasing likeprocessschedulingPerformanceenhancement improvedatatransferringspeedandmakedevicesmoreadaptiveforCPUandRAMProtection internalandexternalprotection deadlockDifficultiesofdevicesmanagementPortaddressmanagementControlmodedesigndeadlock unreasonabledevicerequestorassignment OperatingSystem CITS NanKaiUniversity 5 IntroductionofHardware ArchitecturePhysicalcomponent equipmentdrivenbyanalogsignalsElectroniccomponent controlleroradapterthatcanrespondandexecutedigitalinstructionsController adapterExtendedslotsinmainboardRegistersanddatabufferinadapterResponsibilityofadapterAddresstranslation maplogicaladdresstodeviceportDatatransfer receiveorsendneededdataCommandexecution convertdigitalinstructionstoanalogsignalstodrivephysicalcomponentsPerformanceenhancement applycacheandothermethodtoimprovetheperformanceofdevices OperatingSystem CITS NanKaiUniversity 6 Workingflowofdevices StepsofhardwareworkingcycleStartup self check running result checkanderror handleDeviceportStatusregisters storescurrentstatusofdevicesInstructionregisters storesreceivedinstructionsDatabuffer storestheneededdataCommunicationmechanismbetweenCPUanddevicesSetthecontentofstatusandinstructionregistersDevicesexecutetheinstructions oraccomplishdatacommunicationDevicesinformCPUviainterruptafterthejobisdoneSample IBMfloppydriverInstructionset read write seek format etc Parameters setbyCPU storedindeviceregistersBitstream CPUsendsdatabitbybit thefloppydriverarrangesthebitsintobyteindatabuffer andperformsnecessarycheck OperatingSystem CITS NanKaiUniversity 7 CommunicationbetweenCPUanddevices OperatingSystem CITS NanKaiUniversity 8 Howtoaccessdevices I OportIDofthedevices registersComputermaintainsaI OportlistforI OcommunicationDisadvantage separatesmemoryspaceanddevices registersMemory mappedI OAlldevices registersaremappedintomemoryspaceEachregisterisassignedauniquememoryaddressAdvantage uniformaddressformat OperatingSystem CITS NanKaiUniversity 9 Howtoaccessdevices I OportIDofthedevices registersComputermaintainsaI OportlistforI OcommunicationDisadvantage separatesmemoryspaceanddevices registersMemory mappedI OAlldevices registersaremappedintomemoryspaceEachregisterisassignedauniquememoryaddressAdvantage uniformaddressformat OperatingSystem CITS NanKaiUniversity 10 Dependentaddress I Oport AdvantagesSeparateI Oaddressfrommemoryaddress specialI OinstructionsaredesignedtoaccessI OportItisveryeasytodistinguishI Oaccessandmemoryaccess thecostofmanagementislittleDisadvantageOnlysimpleinstructionscanbeusedforI Ocommunication complexI OprogrammingisdifficultTheprogrammingmodelandaddress mappingmethodaredifferent itisnotconvenientforprogrammers OperatingSystem CITS NanKaiUniversity 11 Memory mappedI O AdvantagesTreatI Oaddressasapartofmemoryaddress anglobaladdressspaceisgeneratedThedifferencebetweenI Oandmemoryishidden programmercandesigncomplexI OprogramI OaddresscanbeprotectedefficientlyDisadvantageItisdifficultforhardwaretodistinguishtheaddressofmemoryandI OdevicesThecostofmanagementishigher anditismorecomplexunderdouble busormulti busarchitecture OperatingSystem CITS NanKaiUniversity 12 Memory mappedI O OperatingSystem CITS NanKaiUniversity 13 Databufferismappedintomemoryspace RegistersareidentifiedbyuniqueI Oport RealSample Pentium Howtoaccessdevices BUS OperatingSystem CITS NanKaiUniversity 14 Howtoaccessdevices BUS OperatingSystem CITS NanKaiUniversity 15 Workingmodeofdevices busywaiting OperatingSystem CITS NanKaiUniversity 16 Specialkernelprocesssendsthedatatodeviceport Theprocesscheckstheportrepeatedlyuntiltheportisavailableandsendsrestdata Theuserprocesscontinuesrunafterthekernelprocessisfinished Disadvantage CPUiswastedtoomuch Workingmodeofdevices interrupt OperatingSystem CITS NanKaiUniversity 17 Specialkernelprocesssendsthedatatodeviceport TheprocessgoestosleepandCPUwillrunotherprocesses ThedevicesendinterrupttoCPUafterthedatabufferisempty ThekernelprocessiswakedupandsendtherestdataDisadvantage frequentinterruptsaretime consuming Workingmodeofdevices DMA OperatingSystem CITS NanKaiUniversity 18 UserprocesscausesaCPUtrap thespecialkernelprocesssetstheregistersindeviceandexits Devicereaddatafrommemorydirectly ThedevicesendinterrupttoCPUafterthejobisdone Theuserprocessiswakedupandcontinuesrun DetailsofDMA InternalstructureofDMASingle path onlyonesuiteofregisters onlyoneI OdevicecanbecontrolledMultiplex path severalsuitesofregisters multipleI OdevicescanbecontrolledatsametimeDMAScheduling switchamongmultiplechannelsWorkingmodeofDMADatatransfermode word at atimeVSblockmodeCyclestealing DMArequestsbusforawordandgetitBurstmode DMAgetbusandstartaseriesofdatatransferFly bymode DMAtellsdevicescontrollertosendthedatatomemorydirectlyDevice to deviceandmemory to memory DMAgetthewordfromdevice memoryandsendittothetargetaddressAddressusedinDMAPhysicaladdress MMUislocatedinCPUVirtualaddress MMUislocatedinmemoryBuffering eliminatethespeeddifferencebetweendevicesIsDMAnecessary OperatingSystem CITS NanKaiUniversity 19 I Ochannel DisadvantageofDMASlowandsimple can tsupportcomplexI OprogrammingIntroductionofI OchannelSpecialchips PU areusedtomanageI OdevicesCharacter multiplex channel selection multiplex channel group multiplex channelI OchannelsharememorywithCPUandworkseparatelywithCPUStructureofI OchannelCAW addressregister storestheaddressofI OchannelprograminmemoryCCW commandregister storesthecurrentI OcommandCSW statusregister storesthestatusofI OoperationresultCDW dataregister databuffer OperatingSystem CITS NanKaiUniversity 20 I Ochannel OperatingSystem CITS NanKaiUniversity 21 IntroductionofI Osoftware SynchronousblockingVSasynchronoustransferBlocking userprogramwillsuspenduntilI OoperationisdoneDatatransfer CPUisworkingasynchronouslyuntiltheinterruptarrivesErrorhandlingHardware levelerrorhandling executesbydevicesHigh levelerrorhandling returnstatustohigherlevelandprocessedbykernel userprogramsUniformnamingConceptofdevice independenceMappingnamewithI OdevicesaddressBufferingHowtomaintaindatabufferandcontroldatatransferringbasedonbufferAllocationandreleasingofdevicesHowtorealizeI Odevicessharing Howtoavoiddead lock OperatingSystem CITS NanKaiUniversity 22 LevelsofI Osoftware OperatingSystem CITS NanKaiUniversity 23 interrupt Hardware driver Userprocess Deviceindependence Request Respond Systemcalllibraries daemonprocesssuchasspooling Naming protection sharing Errorhandling registerssetting HandleI Ointerrupt Interrupt HowtocontrolI Odevicesbyuser UserprocessrequestsI OandblockedDevicedriverstartI OoperationandblockedI OdevicefinishoperationandsendinterruptDevicedriverfinishanduserprocessiswakenupWorkingflowofinterruptHardware levelerrorhandling executesbydevicesHigh levelerrorhandling returnstatustohigherlevelandprocessedbykernel userprograms OperatingSystem CITS NanKaiUniversity 24 Devicedriver IntroductionofdevicedriverInstructionstocontroldevicecontrollerDevicedriveralwaystreatedaskernelprocessOSprovideuniforminterfacestoabstractdriverDevicedriver staticlibraryordynamiclibraryWorkingflowofdevicedriverReceiveandchecktheparameterssentbyhigh levelprocessCheckdeviceandstartdeviceConfigureregistersofdeviceReceivethestatusofI OoperationsImportantissuesofdevicedriverSynchronousblockingVSrunning without delayReentrant thecomplexityofdriverHotpluggablesystemandmemoryrequests OperatingSystem CITS NanKaiUniversity 25 Devicedriver OperatingSystem CITS NanKaiUniversity 26 Buffering OperatingSystem CITS NanKaiUniversity 27 I OsoftwareinUserspace SDK DDKorlibrariesforprogrammingHidethedetailsofdevicedriverandmakeitsimpleforusertoaccessI OdevicesSuchas cout print SpoolinganddaemonVirtualdeviceforusersBufferingandschedulingfordevicesharing OperatingSystem CITS NanKaiUniversity 28 DescriptionofDeadLock SceneofdeadlockProcessA HoldsCD Rom requestsprinterProcessB Holdsprinter requestsCD RomDeadlock Bothprocessesareblocked CD Romandprinterarenotavailableforotherprocesses OperatingSystem CITS NanKaiUniversity 29 ProcA ProcB Printer CD ROM AnalysisofDeadLock DefinitionofdeadlockAprocesssetthatanyprocessinthissetiswaitingfortheeventexecutedbyanotherprocessinthisset Thisstatusisnameddeadlock ConditionsofdeadlockMutuallyexclusiveresourceallocation theresourcecan tbesharedbymultipleprocesses nonpreemptable Processholdingsomeresourceandwaitingforsomeresource itisblockeduntiltherequestissatisfied Theholdenresourcecan tbebereftbyOS onlyitsmastercanreleaseit Circularwaitingsequence eachprocessinthissequenceiswaitingitsneighbortoreleasesomeresource andthesequenceiscircular OperatingSystem CITS NanKaiUniversity 30 AnalysisofDeadLock DangerousofdeadlockThedeadlockprocesssetwillneverbeactivatedandtheholdenresourcewillbeunavailableforever Unreasonableresourceallocationmechanismmaycausedeadlock Describedeadlockviadirectedgraph OperatingSystem CITS NanKaiUniversity 31 SampleofDeadLock OperatingSystem CITS NanKaiUniversity 32 Howtoresolvedeadlockproblem OstrichpolicyDeadlockisakindoflow probabilityevent Donothingforlow probabilityevent DeadlockdetectionandsystemrecoveryAspecialprocessisinchargeofdeadlockdetectionThedeadlockprocesswillbekilledandtheholdenresourcewillbereleased DeadlockpreventionOSdefinessomeconstraintrulesandrestrictresourcerequestandallocationofprocess TheconstraintruleswilldestroytheconditionsofdeadlockDeadlockavoidanceOSanalyzescurrentstatusofresourceallocationandtrytoallocateresourceinasafeway OperatingSystem CITS NanKaiUniversity 33 Deadlockdetectionandrecovery IdeaofthismethodAdaemonprocessisinchargeofdeadlockdetectionandtrytoresumesystem HowtodetectdeadlockUsinggraph set vectorandmatrixasdatastructuretorecordthestatusofresourceallocation andtrytofindcircularwaitingstatusHowtorecoversystemResourcebereaving bereavestheresourceofdeadlockprocessandallocatestheresourcetootherprocess Backdating setcheckpointinprocess theprocesswillbackdatetothecheckpointwhendeadlockisdetected Processkilling killstheprocessdirectly OperatingSystem CITS NanKaiUniversity 34 Deadlockdetectionandrecovery IdeaofthismethodAdaemonprocessisinchargeofdeadlockdetectionandtrytoresumesystem HowtodetectdeadlockUsinggraph set vectorandmatrixasdatastructuretorecordthestatusofresourceallocation andtrytofindcircularwaitingstatus Discussionaboutdeadlockdetectionalgorithm HowtorecoversystemResourcebereaving bereavestheresourceofdeadlockprocessandallocatestheresourcetootherprocess Backdating setcheckpointinprocess theprocesswillbackdatetothecheckpointwhendeadlockisdetected Processkilling killstheprocessdirectly OperatingSystem CITS NanKaiUniversity 35 Deadlockprevention IdeaofthismethodDestroystheconditionsofdeadlockMechanismandconstraintrulesSpoolingmechanism sharingresourcevirtually Resourceallocatingprediction satisfyallresourcerequirementsofaprocessinoneallocation otherwisetheprocesswillbeblockeduntilallneededresourceisavailable Resourcebereaving bereavestheresourceofdeadlockprocessandallocatestheresourcetootherprocess Labeledresourcesequence assigntypeIDforeachkindofresource processmustrequesttheresourceinascending descendingorder OperatingSystem CITS NanKaiUniversity 36 Deadlockavoidance IdeaofthismethodDeadlockpreventingisunreasonableandnotfriendlyforuser OSanalyzestheresourceallocationstatusandassuresthesystemtobesafeandstable StatusofresourceallocationSafestatus areasonableresourceallocationsequenceisexistedtomakeallprocessruntoendproperly Unsafestatus can tfindasaferesourceallocationsequencetoavoiddeadlock MechanismofdeadlockavoidanceWhenprocessrequestsomeresource OSwillcheckwhetherthestatusissafe theresourcewillbeallocatedundersafestatusandwon tbeallocatedunderunsafestatus OperatingSystem CITS NanKaiUniversity 37 Resourceallocationtrack OperatingSystem CITS NanKaiUniversity 38 Bankeralgorithm simplecondition Recordthemax requirementofresourceandcurrentallocationstatusofallprocess Simulation allocatetheresourcetoaprocessandcheckwhetherallprocesscanruntoendproperly I
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年液晶拼接行业洞察报告及未来五至十年发展趋势报告
- 2026广西农业科学院农业资源与环境研究所公开招聘编制外工作人员2人笔试备考题库与答案解析
- 2026福建医科大学孟超肝胆医院长期招聘劳务派遣医师助理12人考试参考试题及答案解析
- 2026年中南电力设计院有限公司勘测工程公司社会招聘1人笔试备考题库与答案解析
- 2026水发集团有限公司社会招聘104人(河北有岗)考试备考题库及答案解析
- 2026年新乡市中医院招聘工作人员若干名考试参考题库及答案解析
- 2026吉林蛟河市机关事务服务中心公益性岗位人员招聘10人笔试模拟试题及答案解析
- 2026上海商学院公开招聘其他专业技术岗位(第三批)笔试备考题库与答案解析
- 2026年风铃及配件行业洞察报告及未来五至十年发展趋势报告
- 2026年在线医疗咨询行业洞察报告及未来五至十年发展趋势报告
- DB15∕T 967-2025 林木育苗技术规程
- 美沙酮药物相关培训课件
- 院内传染病培训课件
- 脑梗塞后遗症护理疑难病例讨论
- 商业门面装修管理办法
- 掀冬学高潮动员班会课件
- 公司cqc标志管理办法
- 脑电治疗仪讲课件
- CJ/T 410-2012隔油提升一体化设备
- 护士床旁综合能力操作考核评分标准
- DG-TJ 08-402-2021 生活垃圾收集站(压缩式)设置标准
评论
0/150
提交评论