《操作系统原理操作系统原理 (5).pdf》由会员分享,可在线阅读,更多相关《操作系统原理操作系统原理 (5).pdf(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 操作系统操作系统原理原理 Operating System PrincipleOperating System Principle 2 2-1 1 计算机硬件计算机硬件 Computer-System Architecture 计算机系统体系结构 I/O devices and the CPU can execute concurrently.I/O 设备与CPU可并行运行 Each device controller is in charge of a particular device type.每一设备控制器负责一个设备类型 Each device controller has a l
2、ocal buffer.每一设备控制器有一局部缓存 CPU moves data from/to main memory to/from local buffers CPU 通过局部缓存与主存交换数据 I/O is from the device to local buffer of controller.I/O从设备到设备控制器的局部缓存 Device controller informs CPU that it has finished its operation by causing an interrupt.设备控制器通过引起中断通知CPU操作已完成 Computer-System O
3、peration 计算机系统操作 Computer-System Operation 计算机系统操作 中断机制 hardware interrupt 硬件中断 device controller informs CPU that it has finished its operation by causing an interrupt disk,timer,etc.software interrupt(trap)软件中断(陷阱)a trap(or an exception异常)division by zero,invalid memory access a system call 系统调用(a
4、lso called a monitor call)read(),write()中断定义 Why the interrupt?make the system more efficient and meanwhile make the system more efficient and meanwhile more responsivemore responsive Computer-System Operation 计算机系统操作 01 02 03 separate segments of code determine what action should be taken for each
5、type of interrupt a generic routine to examine the interrupt information,and in turn call the specific handler through the interrupt vector,which contains the addresses of all the service routines a modern operating system is interrupt driven 现代操作系统是中断驱动的 interrupt transfers control to the interrupt
6、 service routine(interrupt handler)generally 中断将控制权转移到中断服务程序 Computer-System Operation 计算机系统操作 Computer-System Operation 计算机系统操作 除法溢出中断 单步(用于DEBUG)非屏蔽中断(NMI)断点中断(用于DEBUG)溢出中断 打印屏幕 保留 0 1 2 3 4 5 6,7 00 03 04 07 08 0B 0C 0F 10 13 14 17 18 1F 中断中断 向量向量 中断号 中断 用途 I/O Structure 1 1 peripheral device(s)a
7、ttached to device controller 设备与设备控制器相连 2 2 a device controller(hardware)local buffer storage 本地缓冲器 a set of registers 一组寄存器 3 3 device driver,usually a software program embedded into an OS 设备驱动程序 Computer-System Operation 计算机系统操作 thethe useruser programprogram willwill bebe notifiednotified aboutab
8、out thethe I/OI/O completioncompletion onon a a laterlater timetime WindowsWindows messagemessage,oror callcall backback functionfunction 01 02 synchronous I/O mode:after I/O starts,control returns to user program only upon I/O completion asynchronous I/O mode:after I/O starts,control returns to user program without waiting for I/O completion two ways of an I/O operation two ways of an I/O operation 两种两种I/OI/O操作操作 Computer-System Operation 计算机系统操作 I/O Interrupts Synchronous Synchronous 同步 Asynchronous Asynchronous 异步 Computer-System Operation 计算机系统操作 synchrounous asynchrounous