Wednesday, September 2, 2009

Computer Literacy 101 -- what is a peripheral?


A computer system cannot often stand alone -- it needs a way to input data, it needs a way to output data and it needs a way to expand its capabilities. These devices are called peripherals. A keyboard is a peripheral. A monitor is a peripheral. The time panel on a microwave oven can properly be called a peripheral, although it may be part of the overall design and not optional.

Peripherals can be grouped in classes. One class is Input/Output (or I/O). These peripherals allow you to put in (input) data or to access (output) data. Another class would include removable storage systems -- a flash card, a hard disk, a CD-ROM unit. Other classes exist.

Input devices have a particular requirement from the operating system. Since it is unknown just WHEN data will be input, there must be a way for the operating system to notice that data are available. The two main ways of doing this are via polling and via interrupts. A poll is a periodic check for data -- like a child in a car asking "Are we there yet?". An interrupt is like a tap on the shoulder. Different systems will use different methods. A poll does not take long but there will be many times that the answer will be "no" -- and, thus, the time taken is "wasted". An interrupt takes much more time because it is necessary to save the current situation (maybe you're in the middle of a program) before the interrupt can be handled. Let's say that handling an interrupt takes 50 milliseconds and a poll takes 1 millisecond. If an event occurs once a minute, then doing an interrupt will take less time than polling once a second (50 < (60 x 1)). However, if the event occurs twice a minute, then polling is more efficient (50 > (30 x 1)).

A keyboard is an input peripheral. So is a mouse. In the case of a keyboard, a specific data value is sent when a key, or combination of keys, is pressed. This is usually kept in a temporary memory buffer that can be read by another program that is currently accepting input from keyboards (maybe a word processing program, maybe a browser window). A mouse sends two types of information -- a change in location and key presses. The key presses are handled similar to those of a keyboard. However, the change in location is done by the computer keeping track of the "location" of the mouse. When the computer starts up, the mouse is considered to be in a "default" (starting) location (often the upper left of your monitor). If you move your mouse to the right, it keeps track of how far to the right it has moved. Note that it isn't usually a one-to-one movement or your mouse pad would have to be as large as your monitor. Also, if you pick up the mouse and move it, it is as if it never moved.

Printers and monitors are typical output peripherals. Printers are fairly straightforward (although the actual data may not be such) -- your output may say "give me a new page", "print the letter 'a'", "go to the next line", and so forth but it basically is given a set of commands in sequence. A monitor, currently, is more complicated because of the idea of active windows and locations. So, in a modern operating system, the computer not only needs to keep track of where the mouse (as reflected by the cursor displayed on the monitor) but what program is making use of input while the cursor is at that location and what menu or button must be activated if there is further input (keyboard or mouse click) while at a specific location within that program's active space (or window). The input devices are actually what are causing changes about what you see -- the monitor just reflects the effects of that input.

And that pretty well covers Computer Literacy 101 -- though I would be happy to try to address any areas (of the many) that I have neglected.

No comments:

To Waste or to Waist: That is the question

       As is true of many people growing up in the US, I was encouraged to always clean my plate (encouraged is putting it mildly -- I remem...