09 - IO Subsystem Flashcards
State three classes of IO devices
Very wide range of devices that interact with the computer via input/output (IO):
(1) Human readable: graphical displays, keyboard, mouse, printers
(2) Machine readable: disks,tapes, CD, sensors
(3) Communications: modems, network interfaces,radios
Differences between IO devices
(1) Data rate : keyboard vs network
(2) Control complexity : printer vs disk
(3) Transfer unit and direction : blocks vs characters vs frame stores (???)
(4) Data representation (???)
(5) Error handling (???)
Why is the IO subsystem the “messiest” part of the OS.
(1) Variety of devices / applications
(2) Dimensions of variation
=> Character-stream or block
=> Sequential or random-access
=> Synchronous or asynchronous
=> Shareable or dedicated
=> Speed of operation
=> Read-write,read-only, or write-only
Why does OS need device classes.
5 or 6 dimensions of variation between IO devices : character stream or block …
Thus, completely homogenising device API is not possible so OS generally splits
devices into four classes
State the four types of device classes
- Block devices
- Character devices
- Network devices
- Misc devices
Examples : block devices
- disk drives, CD
- Commands : read, write, seek
- Access either
a (raw),
b via filesystem (“cooked”),
c or memory mapped.
Examples : character devices
e. g. keyboards, mice, serial
- Commands: get, put
- Layer libraries on top for line editing etc…
Examples : network devices
- Vary enough from block & character devices to get their own interface.
- Unix, Windows NT use Berkeley Socket interface… API for internet sockets, Unix domain sockets, used for IPC.
Examples : misc devices
- Current time, elapsed time, timers clocks.
UNIX : ioctl system call covers other odd aspects of IO
Examples of virtual devices
Terminal => terminal stream Frame buffer => window Raw mouse => event stream Disk block => files Parallel port => print spooler Raw ethernet frames => transport protocols
Explain how the OS creates an interface between user programs and raw hardware
??????????? 7 out of 20 §9
Describe how polled mode IO works
Consider simple device with three registers : status, data, command (diagram).
HOST can read / write these registers via bus.
Polled mode operation :
1. H repeatedly reads device_busy until clear
2. H sets e.g. (write) bit in command register, puts data into data register.
3. H sets command-ready and sets device_busy.
4. D performs write operation (slow)
5. D clears command_ready and then clears device_busy.
Problem with polled mode IO
?????
- Time wasted while D is writing the data / performing its IO operation.
Purpose of interrupt driven IO
- CPU speed»_space;» IO device speed
- CPU provides interrupt mechanism to handle mismatch between CPU and device speeds.
Describe : interrupt driven IO
- End of each instruction => CPU check interrupt lines for pending interrupt.
=> Need not precisely occur at definite point in instruction stream. - If line asserted, CPU:
2a Save PC, processor state.
2b Change processor mode => kernel mode
2c Index interrupt vector => jump to service routine.
3 Finish interrupt handling => use rti instruction to resume.
- More complex CPUs :
- Multiple priority levels of interrupt
- hardware vectoring of interrupt
- mode dependent registers