Input/Output Devices in Operating System - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

Input/Output Devices in Operating System

Share This

Different people look at I/O hardware in different ways. Electrical engineers look at it in terms of chips, wires, power supplies, motors, and all the other physical components that make up the hardware. Programmers look at the interface presented to the software—the commands the hardware accepts, the functions it carries out, and the errors that can be reported back.

I/O Devices


I/O devices can be roughly divided into two categories: block devices and character devices

A block device is one that stores information in fixed-size blocks, each one with its own address. Common block sizes range from 512 bytes to 32,768 bytes. Disks are the most common block devices.

A character device delivers or accepts a stream of characters, without regard to any block structure. It is not addressable and does not have any seek operation. Printers, network interfaces, mice (for pointing), rats (for psychology lab experiments), and most other devices that are not disk-like can be seen as character devices.

I/O devices cover a huge range in speeds.

Device Controllers


I/O units typically consist of a mechanical component and an electronic component. 

It is often possible to separate the two portions to provide a more modular and general design. 

The electronic component is called the device controller or adapter. On personal computers, it often takes the form of a printed circuit card that can be inserted into an expansion slot. The controller card usually has a connector on it, into which a cable leading to the device itself can be plugged. Many controllers can handle two, four, or even eight identical devices. 

The controller’s job is to convert the serial bit stream into a block of bytes and perform any error correction necessary. 

The block of bytes is typically first assembled, bit by bit, in a buffer inside the controller. After its checksum has been verified and the block declared to be error-free, it can then be copied to the main memory.


Memory-Mapped I/O


Each controller has a few registers that are used for communicating with the CPU. 

By writing into these registers, the operating system can command the device to deliver data, accept data, switch itself on or off, or otherwise perform some action. 

By reading from these registers, the operating system can learn what the device’s state is, whether it is prepared to accept a new command, and so on. 

In addition to the control registers, many devices have a data buffer that the operating system can read and write. For example, a common way for computers to display pixels on the screen is to have a video RAM, which is basically just a data buffer, available for programs or the operating system to write into.

The approach is to map all the control registers into the memory space. Each control register is assigned a unique memory address to which no memory is assigned. This system is called memory-mapped I/O. 

Usually, the assigned addresses are at the top of the address space. A hybrid scheme, with memory-mapped I/O data buffers and separate I/O ports for the control registers. 

The Pentium uses this architecture, with addresses 640K to 1M being reserved for device data buffers in IBM PC compatibles, in addition to I/O ports 0 through 64K.


Happy Exploring!

No comments:

Post a Comment