egindocument

Input/Output Devices

Chapter 5 of Tanenbaum.

Have both hardware and software. Want to hide the details from the programmer (user).

Ideally have the same interface to all devices (device independence). Think of UNIX. Process doesn't need to distinguish between input coming from terminal, the network, a file or another process.

I/O Devices

Two principal types:

  1. block devices: stores information in fixed size blocks (128 to 1024 bytes). Example: disks. Tape drive: can seek and read, but probably cannot write at arbitrary place.
  2. character devices: stream of characters (independent of blocks). Examples: terminals, line printers, network drivers

Clocks fall outside of this categorization.

Device Controllers

Operating systems do not deal with devices directly. Rather there is a mechanical and electronic portion. Electronic portion is a device controller. A printed circuit card.

Look at Silbershatz Fig 13.1. Also a network interface card.

Example: CRT controller takes care of details of rescanning the CRT beam

How do controllers and the CPU communicate?

Use memory-mapped I/O

See Fig 5-5.

Polled I/O

No interrupts used. CPU puts request in controller's registers and then polls waiting for the request to finish.

Also called programmed I/O.

Might be used for debugging in operating system interrupt handler because it doesn't block.

Direct Memory Access (DMA)

What about large amounts of data to transfer? For example, disk read. Controller gets the data and buffers it.

CPU could only get data in small chunks (byte or word at a time).

Look at Fig. 5.4. Idea is to free CPU from being involved with transfer of data.

CPU also gives:

Principles of I/O Software

Issues of the software:

I/O Software Layers

Correspond to layers in Fig 5-16.

Interrupt Handlers

Bowels of the system. Occurs when a device controller wants to tell CPU something (clock tick, write done, ready to read more, etc)

What happens on interrupt:

Device Drivers

Contains device-dependent code. May have a device driver for a class of related devices (terminal driver for example).

It knows details about device.

device independent request -> device driver -> device dependent request

It may queue up the request if device is already busy. Will send that request when the current request is complete. Puts data in registers and retrieves results as needed.

Reports results to device-independent software.

See Fig 5-11.

Device-Independent I/O Software

Two major functions:

User-Space I/O Software

For example, printf() is a library routine that calls write().

Also user-level software to support other operations. Spooling for example where a daemon process controls access to a spooling directory. When you print, the file is put in the directory and when your turn comes it is printed.

Also used for file transfer. UUCP networks use this approach.

nddocument


About this document ...

This document was generated using the LaTeX2HTML translator Version 2K.1beta (1.61)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -no_navigation -split 0 -t 'Input/Output Devices' week6-io.tex

The translation was initiated by Craig Wills on 2002-12-04


Craig Wills 2002-12-04