Device Communication: Controllers and Functions

Classified in Computers

Written at on English with a size of 3.5 KB.

Key Functions of Device Communication

The main functions related to device communication are:

  • Sending commands to devices.
  • Detecting interrupts.
  • Handling errors.
  • Providing a simple and easy-to-use interface between devices and the rest of the system. This interface should ideally be the same for all devices, regardless of their specific type.

Device Categories

Human-Readable Devices

Used for communication with the user:

  • Printers
  • Graphic display terminals
  • Displays
  • Keyboards
  • Mice

Machine-Readable Devices

Used for communication with electronic equipment:

  • Disk and tape drives
  • Sensors
  • Controllers
  • Actuators

Communication Devices

Used for communication with remote devices:

  • Digital line drivers
  • Modems

Device Types

Devices fall into two broad categories:

  • Block devices
  • Character devices

Block Devices

Main features of block devices:

  • Information is stored in fixed-size blocks.
  • Each block has its own address.
  • Block sizes typically range from 128 bytes to 1,024 bytes.
  • Blocks can be read or written independently at any time.
  • Disks are a typical example of block devices.

Character Devices

Main features of character devices:

  • Information is transferred as a character stream, without a block structure.
  • Addresses cannot be used.
  • They do not have a search operation.
  • Line printers, terminals, network interfaces, and mice are typical examples of character devices.

I/O Units

I/O units usually consist of:

  • A mechanical component.
  • An electronic component: the device driver or adapter.

Many drivers can handle more than one device. The OS usually interacts with the controller, not directly with the device.

Communication Models between CPU and Drivers

  • For most micro and mini computers: The system bus model.
  • For most mainframes: A model with multiple buses and specialized computers for I/O, called I/O channels.

Interface between Controller and Device

The interface is often very low-level:

  • Communication is via a serial bit stream that:
    • Begins with a preamble.
    • Continues with a series of bits (e.g., from a disk sector).
    • Concludes with a provision for verification or error-correcting code.
  • The preamble:
    • Is written to format the disk.
    • Contains the cylinder number, sector number, sector size, and other similar data.
  • The driver must:
    • Convert the serial bit stream into a block of bytes.
    • Perform any necessary error correction.
    • Copy the block into main memory.

Controller Registers

Each controller has registers used for communication with the CPU:

  • The OS performs I/O by writing commands in the driver's registers. Command parameters are also loaded into these registers.
  • The CPU gains control.
  • The CPU checks the results of the operation.
  • The CPU gets the results and device status by reading one or more bytes of information from the driver's registers.

Entradas relacionadas: