ITFN 2601 Introduction to Operating Systems

Post on 09-Feb-2016

25 views 2 download

Tags:

description

ITFN 2601 Introduction to Operating Systems. Lecture 19 Input/Output Device Drivers. Agenda. I/O Hardware Memory-Mapped & DMA I/O Software Principles Programmed, Interrupt-based, & DMA I/O Device Drivers Device Independent I/O. I/O Hardware. Block devices - PowerPoint PPT Presentation

transcript

ITFN 2601Introduction to Operating

Systems

Lecture 19Input/Output

Device Drivers

Agenda

I/O HardwareMemory-Mapped & DMA

I/O Software PrinciplesProgrammed, Interrupt-based, & DMA I/ODevice DriversDevice Independent I/O

I/O Hardware

Block devicesStores info in fixed-size blocksEach independent & has own addressEx. Drives

Character DevicesStream-basedEx. Printers, NICs, & mice

Various Data Rates

Device Controllers

Controls the deviceEstablishes a standard (IDE, SCSI, etc.)Sits between the bus & device

Memory-Mapped I/O

CPU writes to registers on the controllerCPU can also write to data buffer on

controller (ex. video RAM)Memory chunk in main RAM assigned to

corresponding space on controllerWrite to memory chunk : this writes to

controllerMust be able to selectively disable cache!

“Listening In On” Memory-Mapped I/O

All I/O controllerslisten on main bus

Multi-bus systems requiresnooping or address filtering

DMA (Direct Memory Access)Without DMA

WithDMA

I/O Software Principles

Device IndependenceUniform NamingError HandlingSynch vs. Asynch transfersBufferingDedicated vs. Sharable resource/device

Programmed I/O

Disadvantage – ties up CPU

Interrupt-Driven I/O

Sending multiple blocks/chunks of data to device

Why not do something while device processes request

Let the device generate an interrupt when request complete – then resume with next block/chunk

Downside – too many interrupts!

DMA-based I/O

Let DMA handle the I/O transactionReduces need for interrupts

Downsides:DMA controller is slower than CPUCPU might be idle anyway

Device Drivers

Code that provides an API to controllerAllows OS to access controller’s

registers, memory buffer, etc.Must conform to OS standard for block

or character devices

Device Driver

Location

Device Independent I/O

Uniform Interface for DriversOS to communicate w/out “hacking OS”

each time a device is added

Device Independent I/O

BufferingAllow device to read/write data w/out having

to flood process w/ interrupts