IO Processormemory subsystem Fast device slow device Characteristics
I/O 系统 Processor-memory subsystem Fast device slow device
Characteristics of I/O Devices
Interrupt-drive I/O Cycle
Six step process to perform DMA transfer Cycle stealing: when DMA seizes the memory bus, CPU is momentarily prevented from accessing main memory
I/O control challenges v 设备种类繁多 v Two challenges Applications → OS ← Devices Ø How can the OS give a convenient, uniform I/O interface to applications? Ø How can the OS be designed such that new devices can be attached to the computer without the OS being rewritten?
OS ← Devices v For device manufacturers, device-driver layer hides differences among I/O controllers from kernel software Device driver Device controller hardware Device
Applications → OS v For applications, I/O system calls encapsulate device behaviors in generic classes v Device-driver layer hides differences among I/O controllers from kernel Ø Devices vary in many dimensions Ø Character-stream or block Ø Sequential or random-access Ø Sharable or dedicated Ø Speed of operation Ø read-write, read only, or write only
Kernel I/O Subsystem Services v I/O Scheduling v Buffering v Caching v Spooling v Device reservation v Error handling
I/O Scheduling v Scheduling Ø Some I/O request ordering via per-device queue Ø Some OSs try fairness, some not v E. g. , Disk read Ø 0, 50, 100, now at 100 Ø Reading 汤子瀛 三版 5. 6. 2 v Another way to improve performance is by using storage space in main memory or on disk Ø Buffering Ø Caching(前面讲过) Ø Spooling(前面讲过)
- Slides: 28