part iv i o systems y
play

Part IV I/O Systems y Chapter 13: I/O Systems p y 1 Fall 2009 - PowerPoint PPT Presentation

Part IV I/O Systems y Chapter 13: I/O Systems p y 1 Fall 2009 I/O Hardw are I/O Hardw are a typical PCI bus structure 2 How How do the How How do do the the processor he processor processor and processor and and and


  1. Part IV I/O Systems y Chapter 13: I/O Systems p y 1 Fall 2009

  2. I/O Hardw are I/O Hardw are a typical PCI bus structure 2

  3. How How do the How How do do the the processor he processor processor and processor and and and controller communicate? controller communicate? � Use the controller: a controller usually has a few registers ( e.g ., status, control, data-in and f i ( l d i d data-out). � Use memory-mapped I/O. � Or, a combination of both. , 3

  4. Memor Memory-Mapped I/O y -Mapped I/O � Each controller I/O address Device has a few registers 000-00F DMA controller that are used for 020-021 Interrupt controller p communicating 040-043 timer with the CPU. 200-20F 200 20F Game controller Game controller � If these registers 2F8-2FF Serial port (secondary) are part of the p 320-32F 320 32F Hard-disk controller Hard disk controller regular memory 378-37F Parallel port address space, it is p , 3D0-3DF 3D0 3DF G Graphics controller hi t ll called memory- 3F0-3F7 Floppy-disk controller mapped I/O. pp 3F8-3FF Serial port (primary) i i 4

  5. Three Three Commonly Three Three Commonly Commonly Seen ommonly Seen Seen Protocols een Protocols Protocols Protocols � Pooling � Interrupts � Interrupts � Direct Memory Access (DMA) 5

  6. Pollin Polling � The status register has two bits, busy and � The status register has two bits, busy and command-ready . Processor Controller wait until the busy bit is not set set the write bit in command set command-ready bit if command-ready is set, set busy do input/output transfer clear the command-ready and busy 6

  7. Interru Interrupt p CPU CPU I/O Contr I/O Controller ller device driver device driver initiates I/O initiates I/O receives interrupt calls interrupt handler ll i t t h dl d done processes data raises interrupt and returns resumes the resumes the Interrupt task 7

  8. Direct Memor Direct Memory Access: y Access: 1/2 1/2 � For large volume data transfer, most systems use direct memory access to avoid burdening the CPU direct memory access to avoid burdening the CPU. � The CPU gives the controller (1) disk address, (2) memory address for storing the block, and (3) a dd f t i th bl k d (3) byte count. Then, the CPU goes back to work. 8

  9. Direct Memor Direct Memory Access: y Access: 2/2 2/2 � DMA requests data transfer to memory � The disk controller copies the information into the address provided by the CPU, byte-by-byte, until the counter becomes 0, at which time an il h b 0 hi h i interrupt is generated. 9

  10. 10 Application I/O Interface Application I/O Interface

  11. I/O Devices I/O Devices � Character stream: a character stream device transfers byte one by one ( e.g ., modem) f b b ( d ) � Block: a block device transfers a block of bytes as a unit ( e.g ., disk) � Others: clocks, memory-mapped screens and so , y pp on. � Not all devices may be recognized by an OS. � Not all devices may be recognized by an OS. Thus, device drivers are needed. 11

  12. Kernel I/O System Kernel I/O System � Build on top of hardware and device drivers, the kernel usually provide many I/O services: h k l ll id I/O i � I/O scheduling ( e.g ., disk head scheduling) � I/O Buffering (see below) � Caching (see below) � Caching (see below) � Spooling � E � Error handling h dli 12

  13. Buffering: Buffering: 1/2 Buffering: Buffering: 1/2 1/2 1/2 � A buffer is a memory area that stores data � A buffer is a memory area that stores data while they are transferred between two devices or between a device and an application. or between a device and an application. � Major reasons of using buffers � Effi i � Efficiency (see below) ( b l ) � Copy semantics. What if there is no buffer and a process runs so fast that overwrites its previous write? The content on the disk becomes incorrect. The use of buffers overcomes this problem. 13

  14. Buffering: Buffering: 2/2 2/2 No buffer. The user process must wait until data transfer completes. O One buffer: While the user b ff Whil th process is running, next data transfer may begin transfer may begin Double buffer: while the user process is processing the first buffer, data transfer can be performed on the second. f d th d Multiple buffers: very efficient Multiple buffers: very efficient 14 (figures taken from W. Stallings’ OS text)

  15. Caching Caching � Just like a cache memory between the faster CPU and slower physical memory, a cache ( i.e ., disk cache) may be used between the faster physical memory and slower I/O devices. � Note that buffering and caching are different things. physical memory controller I/O device cache cache 15

  16. Th E d The End 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend