How Do Computers
Work? The main
purpose of a modern computer is to automatically process information. For
many centuries the act of recording information was accomplished by using
manual methods.
Ancient civilizations used stone or clay tablets to store information.
Once written, they had to re-write everything on a new tablet to make
changes. Even in more modern times this was still true.
Up until the 1980s, if we wanted to change the wording on a paper or
the contents of a list, we had to retype the whole thing. With the advent
of computers, changing written information became much easer.
The fact is that personal computers were developed to increase the ease
and speed of processing information. This section is devoted to how
information is processed in the modern PC
Processing Information Several separate actions can happen to
information as its processed in a computer.
1. Input
; Information is typed
into the computer (it is input or added to a program).
- let us say you need to distribute several copies of the list of all
employees within your office or activity.
- You could type their names into a database program or word
processor.
2. Making
Changes Information is
changed according to instructions given to the computer.
- Let us say that you needed this list in a certain format such as
alphabetical or by rank.
- You would then give the computer instructions to sort the list.
(This is called processing).
3. Printing
Information is printed in
many different forms (this is the output).
- Lets say you now needed 10 copies of the list of names to
distribute to each employee.
- Instructions would be given to the computer to provide the copies on
your printer.
3. Storing
Information is saved by
the computer or program for future use (this is storage).
- Let say that now you would like to be able to update and print
this list in the future as needed.
- You would then give instructions to the computer to save this list
in a file that could be accessed later. B>
The Absolute Basics
Computers operate
using electrical current to represent "states" in the computer. The most
basic state is "ON" or "OFF".
For simplicity's sake we will say:
- The "ON" state is
represented by a positive voltage. (usually 4.5 volts)
- The "OFF" state is
represented by a negative voltage (usually 0 volts or a voltage negative
to the "ON" voltage.)
The "state" we
are talking about is not whether the computer is on or off. Instead we are
talking about whether a "bit" (a binary digit) is on or off.
This concept is much the same as an electric light.
- If the switch is on,
the light is receiving approximately 110 volts.
- If the switch is
off, the light is receiving 0 volts, and you are in the
dark.
Most computers prior to the 1990's operated at
voltages of +5 volts or greater for the "ON" state, and 0 volts to -5
volts for the "OFF" state.
Currently, processors are operating at 3.3, 2.7, and even 2.5 volts.
This is great because the lower the voltage, the less heat is generated by
the PC's processor and other components.
So, a binary bit has 2 values - a 1 or a 0. If we use the "extended
ASCII" code, it takes 8 binary bits to make a "byte" . A byte can be used
to represent a character, number, or symbol.
- A byte might look like "10001001",
The ON/OFF representation it would be:
"ON-OFF-OFF-OFF-ON-OFF-OFF-ON" 1 0 0 0 1 0 0 1
Number
Conversions: Actually, characters, numbers, and symbols are
represented by a number of binary bits. In most PCs, we use the "extended
ASCII" code and it requires 8 binary bits (a byte) to represent a
character, number or symbol. This is the same as 8 contiguous light
switches in a row.
Combinations of "ON" bits and "OFF" bits represent the characters,
numbers, and symbols.
Need more basic
on numbering systems?
- You and I think in decimal numbers. But computers think in "binary"
or base 2 numbers.
- There are several numbering systems with bases other than decimal
(base 10), e.g. octal (base 8) and hexadecimal (base 16).
- In the decimal numbering system, we count to 9 as a single digit,
and when we add one to 9, we say 10. So a 9 + 1 = 10 (or one 10, and
zero 1 s.) Eleven (11) is one "10" and one "1".
- Notice in the chart above: One character in the base 16 can be used
to represent any number up to 15. In decimal one character can be used
to represent a number up to 9.
Note: In binary a bit can represent a 1 or 0, in base
8 you can only represent up to the decimal number 7 without a carry.
So, computers use binary numbers to represent everything inside
them. Computer instructions at the machine level are composed of binary
numbers that direct the computer to perform actions.
The instruction must tell the computer what to do (add, move,
decision, etc.), what to use (which data to use), where to put the
results, etc. Don't stop here, DATA or information is also represented as
binary 1's and 0's; but they are sets of specific bit combinations for
representing a set of characters.
If you would like a bit more
information on Number conversions, You can view the
Number Conversion Tutorial here.
ASCII and
EBCDIC code explanations.
How is a computer instruction executed? The most basic process is
like this:
- Fetch Cycle - gets the next instruction to be executed into a
register.
- Decode Cycle - break down the instruction to see what to do.
- Execute Cycle - do the thing the instruction is supposed to do.
You see an instruction as "ADD A to B giving X" . In computer
instructions, this may take up to 20 simple instructions. Special computer
programs called "compilers" take the "ADD A to B giving X", and translate
them into "machine" language instructions which can be understood in your
CPU!
So, all computer instructions are a set of binary 1's and 0's,
arranged in a specific sequence to represent a machine or computer
language instruction. A machine language instruction can be decoded and
executed by the microprocessor (CPU).
Now, when a computer program is run on a computer, it is first
loaded into a 640KB piece of memory. This 640 KB can be the conventional
memory, or it can be a part of your extended memory (See Memory)
- Each instruction is moved from memory to a register in the CPU by
the fetch cycle.
- The instruction is then decoded, it determines that it is an add
instruction, then the data such as A and B in the example above are
retrieved and put in registers.
- The data in A and in B are added together and stored in a
register.
- The register storing the sum of A and B is moved to a location
specified as X. X takes on the value of the sum.
- The next instruction is 'fetched' from memory and the cycle goes
on.
- Actually the steps above may be many small instructions. We will
worry about details later.
More sophisticated, modern PCs often use more complex procedures in
executing a program's instructions. Some of the modern techniques are:
- Pipelining
- SuperScalar
- Super Pipelining
These are techniques for executing more instructions during a given
time. They will be discussed elsewhere.
|