Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.

Similar presentations


Presentation on theme: "Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed."— Presentation transcript:

1 Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed I/O, DMA, etc –Interrupt Handlers, Device Drivers

2 Cpr E 308 Input/Output Devices Disk, CD-ROM Printer Terminal Keyboard Mouse Block Devices Character Devices

3 Cpr E 308 Data Rates

4 Cpr E 308 Hardware Issues Device Controller –Hardware that comes with the device and interfaces with the computer Memory mapped I/O –I/O happens by writing into locations in the process’s address space –Ex: Pentium, addresses 640K to 1M are reserved for device data buffers

5 Cpr E 308 Simple I/O Architecture Bus Controller Memory Controller Disk Processor Copyright © 2002 Thomas W. Doeppner. All rights reserved.

6 Cpr E 308 I/O Transfer Programmed I/O –Ex: Terminal –Read/write into the device data registers one byte (word) at a time –Interrupt happens when each byte has been handled Direct Memory Access (DMA) –Ex: Disk –CPU notifies the location and size of the memory buffer, and the I/O device address –Data transferred without CPU involvement –Separate DMA controller involved –Interrupt occurs when all data is handled Sometimes, DMA might be slower than programmed I/O

7 Cpr E 308 I/O Software Layers User Level I/O Software (printf, etc) Device-independent OS Software Device Drivers Interrupt Handlers Hardware

8 Cpr E 308 Interrupt Handlers Interrupt handlers are best hidden –have driver starting an I/O operation block until interrupt notifies of completion Interrupt procedure does its task –then unblocks driver that started it Steps must be performed in software after interrupt completed 1.Save regs not already saved by interrupt hardware 2.Set up context for interrupt service procedure

9 Cpr E 308 Interrupt Handlers (2) 3. Set up stack for interrupt service procedure 4. Ack interrupt controller, reenable interrupts 5. Copy registers from where saved 6. Run service procedure 7. Set up MMU context for process to run next 8. Load new process' registers 9. Start running the new process

10 Cpr E 308 Device Driver Talks to the device controller Knows all details about the device, its registers, etc Presents a device independent interface to the higher layers of the OS Usually supplied by manufacturer (need a different one for each OS)

11 Cpr E 308 Device Drivers Communications between drivers and device controllers goes over the bus

12 Cpr E 308 Device driver interfaces Block interface –Read and write blocks, seek Stream interface (for character devices) –Get/put next element –Can be augmented by undoing previous operation Memory-like interface

13 Cpr E 308 I/O Processors: Channels Memory Processor Controller Channel Controller Channel Controller Channel Copyright © 2002 Thomas W. Doeppner. All rights reserved.


Download ppt "Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed."

Similar presentations


Ads by Google