收藏 分销(赏)

操作系统教学课件OS13.pptx

上传人:精**** 文档编号:2722211 上传时间:2024-06-04 格式:PPTX 页数:21 大小:390.74KB
下载 相关 举报
操作系统教学课件OS13.pptx_第1页
第1页 / 共21页
操作系统教学课件OS13.pptx_第2页
第2页 / 共21页
操作系统教学课件OS13.pptx_第3页
第3页 / 共21页
操作系统教学课件OS13.pptx_第4页
第4页 / 共21页
操作系统教学课件OS13.pptx_第5页
第5页 / 共21页
点击查看更多>>
资源描述

1、操作系操作系统教学教学课件件OS_13Chapter 13:I/O Systems(P496)lThe two main jobs of a computer:nI/O and processing.(I/O操作和计算处理)nE.g.:browsing websites,editing files.lThe role of OS in computer I/O is to:nManage and control I/O operations and I/O devices 2 1/2/20212 6/3/2024Chapter 13:I/O SystemslOverviewlI/O Hardw

2、are nPolling,Interrupts,DMAlApplication I/O InterfacelKernel I/O SubsystemlPerformance 3 1/2/202113.1 Overview(P496)lI/O设备技术呈现两个矛盾的趋势,nIncreasing standardization of software and hardware interface.(标准化)-这一趋势有助于将众设备集成到计算机操作系统。nIncreasingly broad variety of I/O devices.(多样性)-有的设备与以前的设备区别很大以至于难以集成到计算机和

3、操作系统中。lThis challenge is met by a combination of software and hardware techniques.lThe basic I/O hardware elements:ports,buses and device controllers.(I/O设备基本要素:端口,总线和设备控制器。)4 1/2/202113.2 I/O Hardware Basic names(P496)lIncredible variety of I/O deviceslCommon concepts nPort端口端口:a connection point t

4、hat the device communicates with the machine via.设备与计算机通讯的连接设备与计算机通讯的连接点点nBus(daisy chain or shared direct access):a set of wires and a rigidly defined protocol that specifies a set of messages that can be sent on the wires.是一组线和严格定义的可以描述在线上传输信息的协议。是一组线和严格定义的可以描述在线上传输信息的协议。nController(host adapter主机

5、适配器主机适配器):a collection of electronics that can operate a port,a bus,or a device.用用于操作端口,总线或设备的一组电子器件于操作端口,总线或设备的一组电子器件lI/O instructions control deviceslDevices have addresses,used by(设备的寻址方式设备的寻址方式)nDirect I/O instructionsnMemory-mapped I/O 5 1/2/2021A Typical PC Bus Structure(P497)6 1/2/2021Registe

6、rs on ports(P498)lAn I/O port typically consists of four registers,called the status,control,data-in,and data-out registers.I/O端口通常有四种寄存器:状态寄存器控制寄存器数据输入寄存器数据输出寄存器 7 1/2/202113.2.1 Polling轮询(P499)主机与控制器之间的协调如下:l主机不断地读取忙位,直到该位被清除。l主机设置命令寄存器中的写位并向数据输出寄存器写入一个字节。l主机设置命令就绪位。l当控制器注意到命令就绪位已被设置,则设置忙位。l控制寄存器读

7、取命令寄存器,并看到写入命令。它从数据输出寄存器中读取一个字节,并向设备执行IO操作。l控制寄存器清除命令就绪位,清除状态寄存器的故障位以表示设备的IO成功,清除忙位以表示完成。8 1/2/2021Interrupts(P499)lIRL _interrupt request line_中断请求线 lCPU在执行完每条指令后,都将判断IRL,当CPU检测已经有控制器通过中断请求线发送了信号,CPU将保留少量状态如当前指令位置,并且跳转到内存特定的位置的中断处理程序。l中断处理程序判断中断原因,进行必要的处理 9 1/2/2021InterruptslCPU Interrupt request

8、line triggered(触发)by I/O device.lInterrupt handler receives interrupts.lMaskable(可屏蔽的)to ignore or delay some interrupts.10 1/2/2021Interrupt-Driven I/O Cycle 11 1/2/2021Direct Memory Access(P503)l主机向内存写入DMA控制块(包括传输的源地址指针,传输的目的地址指针,传输的字节数)。lCPU将该命令块的地址写入到DMA控制器后,就继续其他工作。lDMA控制器直接操作内存总线开始传输。12 1/2/20

9、21Six Step Process to Perform DMA Transfer(P504)13 1/2/2021Application I/O Interface(P505)lI/O system calls encapsulate device behaviors in generic classes.I/O系统调用将设备行为封装成通用类别系统调用将设备行为封装成通用类别lDevice-driver layer hides differences among I/O controllers from kernel.(设备驱动层对核心隐藏了设备驱动层对核心隐藏了I/O控制器控制器的不同的

10、不同)lDevices vary in many dimensions(设备变化范围非常大)设备变化范围非常大)nCharacter-stream or block(字符流或者块设备)字符流或者块设备)nSequential or random-access(顺序或随机设备)顺序或随机设备)nSharable or dedicated(共享或独占设备)共享或独占设备)nSpeed of operation(操作速度的不同)操作速度的不同)nread-write,read only,or write only(读写读写,只读只读,只写)只写)14 1/2/2021A Kernel I/O Str

11、ucture(P506)15 1/2/2021Characteristics of I/O Devices(P507)16 1/2/2021Blocking and Nonblocking I/O(P510)l系统调用的接口还同阻塞与非阻塞I/O的选择有关。lBlocking-process suspended until I/O completednEasy to use and understandnInsufficient for some needslNonblocking-I/O call returns as much as availablenUser interface,dat

12、a copy(buffered I/O)nImplemented via multi-threadingnReturns quickly with count of bytes read or written 17 1/2/2021Kernel I/O Subsystem(I/O内核子系统)(P511)lSchedulingnSome I/O request ordering via per-device queuenSome OSs try fairnesslBuffering-store data in memory while transferring between devicesnT

13、o cope with device speed mismatch(失谐)nTo cope with device transfer size mismatchnTo maintain“copy semantics”18 1/2/2021Improving PerformancelReduce number of context switcheslReduce data copying lReduce interrupts by using large transfers,smart controllers,polling lUse DMAlBalance CPU,memory,bus,and I/O performance for highest throughput(吞吐量)19 1/2/2021end 20 1/2/2021谢谢!

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 教育专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服