|
Input/Output & Interfacing
Definition:
Interface: The hardware and associated software needed
for communication between processors and peripheral devices to
compensate for the difference in their operating characteristics.
(courtesy of IB Comp. Sci Glossary of Computer Science
Terms)
How it works:
An outside source sends a message to the CPU which is
directed to a device driver. The device driver in turn
translates the message into a language that the operating system can
interpret. The operating system sends the message back to the CPU
for processing, when then responds to the message (ie: could operate
a peripheral such as a scanner).
An
interface is only as strong as its weakest component, thus all
levels and environments (of the interface) must be properly
maintained.
Examples of Interfaces:
Between user and computer – to allow us to communicate
to the computer in a language we understand (ie: operating
system, character sets).
Master/Slave Interfaces - are between two components in which one
controls the other or has priority over the other
(ie: the master hard disk drive is the one from which you load
the operating system and is thus usually higher performing
than the second, slave drive, and is of higher importance).
Direct Memory Access (DMA) Interfaces: - transfers data
from a storage device directly to memory
without passing through a processor. (ie: DMA hard disks
perform faster than non-DMA).
Busmastering: when peripherals in a computer can transfer
data directly into the system's main memory (RAM) via the main bus
in the PC without having to wait for the CPU to do it for them. DMA
interfaces are such an example (ie: DMA drives, Video Cards).
DACs:
Digital to Analog Converter. A device that converts
digital signal to analog, such as for speakers (in soundcards) and
monitors (RAMDAC in video cards). The opposite happens in Analog to
Digital Converters.
Transducer:
A mechanism that translates energy signals (ie: sound,
light) into equivalent electronic signals and vice versa.
Flags and Interrupts:
Flag: is a bit of information that is either in one of
two states: on or off. The state of the flag determines what is
performed by the computer (ie: on files, processing).
Interrupt: a command that suspends the processor from what
it's doing and orders it to wait for further instructions. (ie: to
suspend current job for some more important function. Virus scanners
that work in the background are such examples when they detect a
virus; they stop all processing and notify the user of the
virus).
Polling:
Is simply to check the status of an input line,
sensor, or memory location to see if a particular external event has
been registered (ie: a modem to see if information has arrived or
departed). It involves a node inspecting the
communication hardware - typically a flag bit - to see if
information has arrived or departed. Polling is an alternative to an
interrupt driven
system. The natural
synchronization of the nodes
imposed by polling is used in the implementation of blocking
communications
primitives. Blocking in communications operations implies that the
communicating process cannot perform any other operations until the
communication has completed.
2Handshaking:
1. Predetermined hardware or software activity
designed to establish or maintain two machines or programs in
synchronization. Handshaking often concerns the exchange of messages
or packets of data between two systems with limited buffers. A
simple handshaking protocol might only involve the receiver sending
a message meaning "I received your last message and I am ready for
you to send me another one." A more complex handshaking protocol
might allow the sender to ask the receiver if he is ready to receive
or for the receiver to reply with a negative acknowledgement meaning
"I did not receive your last message correctly, please resend it"
(e.g. if the data was corrupted en route).
Hardware handshaking uses voltage levels or pulses on wires to
carry the handshaking signals whereas software handshaking uses data
units (e.g. ASCII characters) carried by some underlying
communication medium.
Flow control in bit-serial data transmission such as RS-232 may
use either hardware or software handshaking.
2. The method used by two modems to establish contact with each
other and to agree on baud rate, error correction and compression
protocols.
2Motherboards / Main board:
The main printed circuit board in an electronic
device, particularly a computer, which contains sockets that accept
additional boards ("daughter-boards").
In a
(personal) computer, the motherboard contains the bus, the
microprocessor and chips used for controlling any built-in
peripherals such as the keyboard, text and graphics display, serial
ports and parallel ports, joystick and mouse interfaces.
The mainboard is possibly the most important part of the
computer. It manages all transactions of data between CPU and the
peripherals. It houses the CPU and its second level cache, the
chipset, the BIOS, main memory, I/O chips, ports for keyboard,
serial I/O, parallel I/O ,disks and plug-in cards.
The bus is the main circuit on the motherboard that
serves to link and transfer data between devices and peripherals
connected to the motherboard.
2Peripheral Devices:
(Or "peripheral device", "device") Any part of a
computer other than the CPU or working memory, i.e. disks,
keyboards, monitors, mice, printers, scanners, tape drives,
microphones, speakers, cameras, to list just a few.
2Device Drivers (part of OS):
Software to control a hardware component or peripheral
device of a computer such as a magnetic disk, magnetic tape or
printer (peripheral device control).
A
device driver is responsible for accessing the hardware registers of
the device and often includes an interrupt handler to service
interrupts generated by the device.
Device
drivers often form part of the lowest level of the operating system
kernel (responsible for resource allocation, low-level hardware
interfaces, security etc.), with which they are linked when the
kernel is built. Some more recent systems have loadable device
drivers which can be installed from files after the operating system
is running.
Check Sums:
A sum generated using individual digits of a number
and employed as an error-detecting device. (courtesy of IB. Comp.
Sci. Glossary of Computer Science Terms)
Example: Many compression utilities, such as PKZIP, use
checksums to check the integrity and validity of decompressed files.
The checksum reports the size of each file, and is stored with the
compressed file(s). Upon decompression, the size/checksum of the
decompressed file is compared to that of the stored one from the
original. Optional flags may be used while executing the
program to ignore checksums to prevent it from reporting potential
errors if desired.
2 Buffers:
An area of memory used for storing messages
temporarily. Typically, a buffer will have other attributes such as
an input pointer (where new data will be written into the buffer),
and output pointer (where the next item will be read from) and/or a
count of the space used or free. Buffers are used to decouple
processes so that the reader and writer may operate at different
speeds or on different sized blocks of data.
There are many different algorithms for using buffers, e.g. first
in first out (FIFO or shelf), last in first out (LIFO or stack),
double buffering (allowing one buffer to be read while the other is
being written), cyclic buffer (reading or writing past the end wraps
around to the beginning).
Video and disk buffers serve to improve performance by storing
commonly used/read data into a faster memory (ie: better disk
performance, smoother video playback).
Double and triple buffering are also used to store even more
information into memory and could serve to further improve the
performance of certain components (ie: triple buffering for 3D
accelerators enables a smoother frame rate than double
buffering).
2Cache:
<memory management> A small fast memory holding recently
accessed data, designed to speed up subsequent access to the same
data. Most often applied to processor-memory access but also used
for a local copy of data accessible over a network etc.
When data is read from, or written to, main memory a copy is also
saved in the cache, along with the associated main memory address.
The cache monitors addresses of subsequent reads to see if the
required data is already in the cache. If it is (a cache hit) then
it is returned immediately and the main memory read is aborted (or
not started). If the data is not cached (a cache miss) then it is
fetched from main memory and also saved in the cache.
The cache is built from faster memory chips than main memory so a
cache hit takes much less time to complete than a normal memory
access. The cache may be located on the same integrated circuit as
the CPU, in order to further reduce the access time. In this case it
is often known as primary cache since there may be a larger, slower
secondary cache outside the CPU chip.
Video Memory:
Memory present on the graphics card itself. It's
purpose is to store on screen information, and is constantly read by
the RAM DAC as it refreshes the screen. The higher the screen
resolution and color depth, the more video memory is needed. Video
memory is also used for storing textures (ie: for 3d
graphics).
Swap Files:
In operating systems such as Windows 95, the operating
system uses a swap file (win386.swp) to create "virtual memory" that
acts like your main memory, or RAM, but reads off the hard drive.
Therefore, this memory is a lot slower, but is still essential,
especially in multitasking OS's which demand lots of memory (more
than what is available in "physical memory", or RAM)
2Operating System (OS):
The low-level software which schedules tasks,
allocates storage, handles the interface to peripheral hardware and
presents a default interface to the user when no application program
is running.
The OS
may be split into a kernel which is always present and various
system programs which use facilities provided by the kernel to
perform higher-level house-keeping tasks, often acting as servers in
a client-server relationship.
Some would include a graphical user interface and window system
as part of the OS, others would not.
Communications with the computer is made possible with the
operating system. Some operating systems are text based, such as
DOS. A command language is used for input of user commands in DOS in
the dos prompt. Graphical user interfaces (GUI), such as Windows,
use menus, pointers, icons, color, sound, and even voice recognition
for communication between the user and the computer and is therefore
a much nicer interface to use.
Data transfer is essential in any operating system. In Windows
9x, physical memory (RAM) is used to store the essential elements
needed to load the operating system. If any physical memory is left,
then applications will benefit from it's fast performance. Virtual
memory (swap file) is then used after physical memory is exausted.
Buffers and caches from are also used (either in RAM or specific
components, such as the video card) to store frequently accessed
date to speed up operations. Transfer of data from one
peripheral/component to another, such as disk drives and modems, are
handled by device drivers that are compatible with the operating
system. Thus, data transfer is a large element handled by an
operating system. More efficient operating systems are better at
data transfer.
Comparison
of various input/output peripherals:
1Hard Disk Drives:
The factors that affect the speed of a harddisk:
- Rotation speed
- Number of sectors per track
- Seek time / head switch time / cylinder switch time
- Rotational latency
- Data access time
- Cache on the HD
- How data is organized on the disks
- Transfer rates
- Interface (EIDE / SCSI)
What are sectors, tracks, heads and cylinders?
On a harddisk, data is stored in the magnetic coating
of the disk. The so called head, held by an actor arm, is used to
write and read data. This disk rotates with a constant turn time,
measured in revolutions per minute (rpm). Typical EIDE rpm's are
5400 – 7200, and 10,000 rmp's just hit the market. The higher the
rpm, the higher the transfer rate. Modern drives have common
capacities of 10, 12, and 13 gigabytes. Drives up to 30gigabytes
(perhaps beyond) are also available.
The Interface (EIDE / SCSI)
Currently there are 2 different common interfaces:
EIDE and SCSI. You will find an EIDE controllers integrated with the
motherboard and that EIDE harddisks are much cheaper than SCSI
drives. For SCSI you need an extra controller, because there aren't
a lot of motherboards with integrated SCSI controllers. Together
with the higher price of a SCSI disk a SCSI system is more expensive
than EIDE. The EIDE interface has a primary and a secondary channel
that will connect to two devices each, for a total of four. That
could be a harddisk, CD-ROM or disk changers. Lately there have been
tape backups with EIDE connectors, but you need special backup
software. Scanners and CD-writers aren't available with EIDE
interface, only with SCSI. You can connect up to 7 devices to a SCSI
bus or 15 devices to a Wide SCSI. In a standard environment, the
performance of single harddisk won't improve much from the SCSI
interface. Rather, the power of SCSI is that several devices can use
the bus at the same time, not using the bus while they don't need
it. So, we see the best benefit from SCSI when several devices are
all used on the same bus.
On one EIDE channel, the 2 devices have to take turns
controlling the bus. If there is a harddisk and a CD-ROM on the same
channel, the harddisk has to wait until a request to the CD-ROM has
finished. Because CD-ROM's are relatively slow, there is a
degradation of performance. That's why everybody tells you to
connect the CD-ROM to the secondary channel and your harddisk to the
primary. The primary and secondary channels work more or less
independently of one another (it's a matter of the EIDE controller
chip).
|
transfer
rates of the SCSI bus |
|
SCSIbus
clock |
8-bit (50 wire data cable) |
16-bit
(68 wire data cable, Wide SCSI) |
|
5 MHz
(SCSI 1) |
5
Mbytes/s |
NA |
|
10 MHz
(Fast SCSI, SCSI II) |
10
Mbyte/s |
20
MByte/s |
|
20 MHz
(Fast-20, Ultra SCSI) |
20
Mbyte/s |
40
MByte/s |
|
40 MHz
(Fast-40, Ultra-2 SCSI) |
40
Mbyte/s |
80
MByte/s |
The theoretical transfer
rates of EIDE drives is outlined in the table below:
|
Possible
theoretical transfer rates of the IDE bus
(ATA) |
|
single
word DMA 0 |
2.1
MByte/s |
|
PIO mode
0 |
3.3
Mbyte/s |
|
single
word DMA 1, multi word DMA 0 |
4.2
MByte/s |
|
PIO mode
1 |
5.2
MByte/s |
|
PIO mode
2, single word DMA 2 |
8.3
MByte/s |
|
Possible
theoretcial transfer rates of the EIDE bus
(ATA-2) |
|
PIO mode
3 |
11.1
MByte/s |
|
multi word
DMA 1 |
13.3
MByte/s |
|
PIO mode
4, multi word DMA 2 |
16.6
MByte/s |
|
Possible
transferrates of Ultra-ATA (Ultra DMA/33) |
|
multi word
DMA 3 |
33.3
MByte/s | Note that a new
Ultra-ATA that allows for up to 66Mbyte/s is now available.
It is not only the interface transfer rate that determines
how fast a harddisk is. How fast the data can be written or read
from the media, e.g. data density and rotation speed is more
important. The fastest interface can't do anything faster than the
'inner values' of a harddisk are capable of. Today, most harddisks
are still under 10 MByte/s transfer rate physically. A faster
interface is advantageous on when data is read from or written to
the cache in a multitasking environment with several devices
accessed simultaneously.
Multitasking environments especially benefit from
SCSI, since simultaneous access occurs frequently. If you have a
server or are working with large files like audio, video or
disk-intense applications, you will benefit more from SCSI than
EIDE. There are three reasons for this:
- All modern operating systems now supports SCSI very well.
Windows 3.x didn't!
- Busmastering really works better with a SCSI busmastering
controller.
- The fastest harddisks with the best performance are SCSI.
CDROM/DVD:
CDROM and DVD drives read information using a laser, and the
data is sent to either an EIDE, SCSI, or some priorperty interface.
Their transfer rate is slower than that of hard drives, but are an
excellent alternative to floppies. A typical CDROM can hold up to
650mb's of data.
Much like a regular CD, DVD uses a laser to read microscopic pits
on a disc to gather information and translate it into music, video
or information. But that's where the similarity ends.
To make
DVD as useful as it is, it had to hold much more information than
standard CD. In order to achieve this data storage capacity, several
daunting obstacles had to be overcome. For example, the microscopic
pits had to be made smaller and placed much closer together. A DVD
can hold up to 17 gigabytes of information.
2Modem:
(Modulator/demodulator) An electronic device for converting
between serial data (typically RS-232) from a computer and an audio
signal suitable for transmission over telephone lines. In one scheme
the audio signal is composed of silence (no data) or one of two
frequencies representing 0 and 1.
Modems are distinguished primarily by the maximum baud rate they
support. Baud rates can range from 75 baud up to 28800 and beyond.
Data to the computer is sometimes at a lower rate than data from the
computer on the assumption that the user cannot type more than a few
characters per second.
Various data compression and error correction algorithms are
required to support the highest speeds. Other optional features are
auto-dial (auto-call) and auto-answer which allow the computer to
initiate and accept calls without human intervention. Most modern
modems support a number of different protocols and two modems, when
first connected will automatically negotiate to find a common
protocol. Some modem protocols allow the two modems to renegotiate
("retrain") if the initial choice of data rate is too high and gives
too many transmission errors.
A modem may either be internal, connected to the computer's bus
or external ("stand-alone"), connected to one of the computer's
serial ports. The actual speed of transmission in characters per
second depends not just the modem-to-modem data rate, but also on
the speed with which the processor can transfer data to and from the
modem, the kind of compression used and whether the data is
compressed by the processor or the modem, the amount of noise on the
telephone line (which causes retransmissions)
1 Video Cards:
Recently, video cards have undergone gigantic leaps in
technology. In the past, a typical video card (ie: Matrox
Millennium) would be designed to excel in 2D performance, which
includes a high quality DAC (convert prior to sending to monitor),
high speed video memory (ie:2mb WRAM, which is dual ported), and a
typical 2D processor. Newer cards have common features, except with
3D features. For example, the nVidia TNT processor has about the
same about of transistors as a PII and runs at 90Mhz. The point of
such 3D processors on modern video cards is to perform 3D rendering
on the graphics card itself, thus improving 3D quality, speed, and
performance. These cards also have more memory than older 2D cards,
such as 16 – 32mb (ie: 125Mhz SGRAM) to store textures used for 3D
objects. The need for lots of on board memory, however, is reduced
with the introduction of a new port called AGP. Thus port is
essentially a separate bus used only for graphics input/output from
system memory to the graphics card. Thus, that allows for fast
access of system RAM for the graphics card, allowing for larger
textures and faster performance with large textures and high 3D
resolutions.
We have
to realize that the data as soon as it leaves the CPU has to go
through 4 steps until it finally reaches the monitor:
- From the bus into the Video Chipset, where it's processed
(digital data)
- From the Video Chipset into the Video Memory, to store a
mirror of the screen picture here (digital data)
- From the Video Memory into the Digital Analog Converter (RAM
DAC), to read out the screen mirror and convert it for the monitor
(digital data)
- From the Digital Analog Converter to the Monitor (analog data)
1. As you can see, except the step from the RAM DAC to the
monitor, each step is some kind of a bottleneck and crucial for
the overall performance of the graphical subsystem.
Summarizing all these performance aspects, we learn that for
optimal performance we should have an AGP or at least PCI system
with the latest chipset and 33 MHz PCI bus speed, a video card with
a high performance chip and either SGRAM or WRAM, a wide data path
or a high clock frequency of the video chipset or best all these
three things together!
Sound Cards:
Modern sound cards are much improved over previous cards, but all
cards have common features. A DAC is used for converting the digital
signal to analogue prior to sending to the speakers. Some USB
speakers, however, do not need that conversion. ADC's are used to
convert external sound, such as from the microphone, to one
recognized by the card (digital). Modern soundcards such as the
SBLive have their own processor equivalent to a Pentium 90. Their
purpose is to reduce the main CPU overhead while processing sound,
and can improve overall system performance as well as sound quality
(ie: increase number of audio voices to be played back
simultaneously, more 3D sound/surround sound capabilities, and
on-the-fly audio effects, the best midi….you get the jest).
1 Taken from Tom's Hardware Guide
( www.tomshardware.com) with some
modifications/additions
2 Taken from FOLDOC
( http://wombat.doc.ic.ac.uk/foldoc/index.html) with some
modifications/additions
|