The following is a simple analogy for the layers involved with the
computer's operations.
Memory devices:
RAM - requires that the power be on to hold memory (or voltage)
Hard-Disk - holds memory without power b/c it uses magnetic patterns
instead of voltage to retain memory.
CD-ROM - Compact Disk - Read Only Memory, works with microscopic divits.
Processing devices:
Processor - Used to get, compare, change, and put voltage to RAM.
The processor uses voltage to operate which explains why it is an
electronic device. The reason the computer has RAM is to hold data in
the form of voltage so the processor can use it.
Lets say we want to add 1 + 2. The calculator program will take 1 and 2
and send it to the operating system instructing it to request the
processor to add these numbers and return the results. The operating system
converts 1 and 2 to binary: 00000001 and 00000010 and feeds the value to
the processor in the form of voltage. The processor then compares voltage
in the addresses and returns 00000011 voltage to the operating system. The
operating sytem then gives this number to the program as its decimal
equivalent of 3. The program then tells you that the answer to 1 + 2 is 3.
The voltage stream can be imagined by someone shocking you. Imagine a series
of 8 shocks: the first 6 are mild (0.5 volts) and the last 2 are strong
(5.5 volts). You would interpret this to be 00000011 or 3 decimal.
There is one layer missing in my example. This layer is the one that links
the operating system and the processor, also known as the system BIOS. BIOS
stands for Basic Input and Output Service. The BIOS understands how to use
the processor, the RAM, the Hard-Disk, and all input and output ports
where other layers plug in like a modem, printer, monitor, keyboard, etc.
here are the layers:
processor, ram, hard-disks, ports, bus (or electronic route(s))
which is controlled by the BIOS
which is controlled by the operating system
which is controlled by the program
which is controlled by the user (we hope).
Why all the layers? Well I think it is because: If I want to write a
program that will add 1 + 3, without the layer's I would have to also
write an operating system that will control a bios that will control
all the hardware on every machine. This would be re-creating the wheel
each time a program was made and the source-code would be huge.
A programmer could not predict what type of hardware may be present on all
machines. So, a hard-disk comes with firmware which knows how to make the
hard-disk turn, get and write magnetic attraction to a piece of metal and
locate specific addresses with the head. The BIOS will know how to deal with
different device's firmware. The operating system will understand how to
deal with the BIOS and the user should know how to control the operating
system.