操作系统结构分析解析
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Operating System Concepts – 6th Edition
1.2
The Hardware of a Modern Computer System
Operating System Concepts – 6th Edition
1.3
Computer-System Structures (1): Input/Output
Operating System Concepts – 6th Edition
1.4
Interrupt Handling
Interrupts are “asynchronous(异步) requests for service”
signal on a wire connecting the devices preserves the present CPU state
Operating System Concepts – 6th Edition
1.6
Interrupt Handling (contd.)
Operating System Concepts – 6th Edition
1.7
Interrupts vs. Traps
Interrupts
asynchronous(异步)
memory, secondary storage, tape
Hardware support for protection different views: functional, components, services, structure
Operating-system structures
1.5
Example
处理文档 电话铃响 暂停文档 文档中作暂停记号 电话交谈 找出暂停记号位置 继续处理文档
执行主程序(日常事务程序) 中断申请信号有效 (中断请求) 暂停执行主程序响应中断 当前PC及寄存器入栈(保护现场) 处理外设要求(中断服务) 寄存器及PC出栈(恢复现场及中断返回 ) 继续执行主程序
Device controllers
I/O devices and the CPU can execute concurrently(并发). Each device controller is in charge of a particular device
type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by causing an interrupt.
After I/O starts, control returns to user program without waiting for I/O completion
Triggered(触发) by devices outside the CPU Traps(陷阱) synchronous(同步)
–
e.g., only higher-priority interrupts may be handled
resumes the interrupted program
Most modern OSes are interrupt-driven
Operating System Concepts – 6th Edition
Chapter 2: Computer System and OS Structures
Chapter 2: Computer System and OS Structures
Computer-system structures
I/O structures Storage structures and hierarchy
–
forces execution of code at an interrupt address
indexed by the interrupt number (ISR 中断服务程序)
interrupt handlers
perform the requested service selective processing of other interrupts
When an interrupt occurs, the CPU
百度文库
this includes its registers and program counter this may be dependent on the source of the interrupt(中断源) typically, table-driven: a table stores addresses of interrupt handlers
Operating System Concepts – 6th Edition
1.8
I/O Operation
Two approaches: Synchronous(同步) and Asynchronous(异步)
Operating System Concepts – 6th Edition
After I/O starts, control returns to user program only upon I/O completion
triggered by special instructions in user program
Other than the above, handling of interrupts and traps is identical Traps are the hardware mechanism for implementing system calls