DEVICE IO

device types and categories

device driver presents an abstraction of the hardware to other parts of the OS, and translates commands from them into device-dependent operations

device controller has command register, status register, and one or more data registers.

device connects to controller, which connects to the bus, works somewhat like MAR and MBR for RAM, device drivers in the OS kernel read and write the controller command, status, and data registers

IO software layers

in polling (busy waiting) IO, a device driver continually checks the busy or done bits in the status register, waiting for the bits to change, which uses up CPU cycles that some other process could use

busy waiting (polling) IO

interrupt driven IO

remember: when an interrupt occurs, the CPU finishes the current instruction, changes to kernel mode, saves the current PC contents, saves all other register values, disables interrupts, and starts executing code to determine which device controller generated the interrupt; then it executes specific device driver code; when done handling the interrupt, the PC and other registers are loaded with the saved values, interrupts are enabled, and the CPU switches back to user mode

from the viewpoint of the individual user, polling is faster and better, but from the viewpoint of overall system efficiency, interrupts are better; the overall throughput of the system is improved by the overlap of CPU processing and IO processing in an interrupt driven system, even though the turnaround time of a particular process might be longer.

Direct memory access (DMA) IO

port-based IO

memory-mapped IO

original IBM PC architecture using Intel 8088 chip had RAM from 0 to 640 KB and memory-mapped IO from 640 KB to 1 MB (addresses are 20 bits in length) for buffers, I think, and IN and OUT instructions for reading and writing device controller registers

busy-waiting IO, interrupt-driven IO, DMA IO can be used with either port-based IO or memory-mapped IO (orthogonal); the choice is completely independent; think of a menu in a restaurant: choose one from column A of busy waiting or interrupt driven or DMA and then choose one from column B of port based or memory mapped

clock chips generate periodic interrupts and clock chip interrupt handler does the following

disks: randomly accessed storage devices

seek (disk arm) scheduling (optimization) can be done since this is dominant component

More seek (disk arm) scheduling examples.

grocery store shopping analogy, oh no not again, going down a list in order (FCFS), going to the closest item next (SSTF), going up and down aisles (SCAN)

monitors

keyboard generates interrupt for each key pressed or released

serial port: mouse, modem


home page: http://elvis.rowan.edu/~hartley/index.html
e-mail: hartley@elvis.rowan.edu