Computer Fundamentals - Part 1

4 replies [Last post]
Kayin
Offline
SX Retired
Joined: 2008/10/09

Introduction
--------------------
I'm sick of being criticized for not picking a "specialty".
I'm sick of all the classifications:
-"programmer"
-"cracker"
-"sys admin"
-"net admin"
-"hardware guy"
-"phreaker"
etc...

It's one thing to know more about one aspect of the body than the rest.
It's another thing to know one aspect of the body and nothing else.

With that said I'm going to try really hard to write a series of tutorials
teaching the absolute fundamentals of what a computer is and how they work.
My goal is towards the end, you will have a deeper understanding of what
you're really doing when you're working with them.

Lesson 1

The Bare Essentials - The Switch
---------------------------------
Contrary to popular belief, computers are remarkably stupid. If you really
want to boil it down, a computer is just the same thing done over and over.
The more you study computers, you'll begin to really understand that at the
hardware level there's very few original ideas.

Start with light switch:

  -------------------
  |		     |
-----		 -----------
Power|		|Light Bulb |
-----		 -----------
  |		     |
  -------------------

Basic Physics: the power source establishes a voltage.

	Ohms Law: I = V/R     
		I = current
		V = Voltage
   		R = Resistance

This tells us that a voltage is producing a current in the wire.
The current then passes through the light bulb causing light.
The amount of current passing through the bulb will determine how
bright it gets.

Easy Right?

What if the wire broke? Well the light would go out. What if
we could control when the wire was broken and control when the
wire was put back together?

This is a switch.

The switch establishes a distinguishable on/off behavior.

In terms of computers, instead of breaking the line physically, the
switch causes voltage to either go high or low. We'll discuss
implementation details later. For now, just remember the concept
of a switch.

The Bare Essentials - Logic Circuits
------------------------------------

What happens if we put 2 switches (call them A and B) next to eachother
in the same circuit?

       A       B
  -----/ ------/ ----
  |		     |
-----		 -----------
Power|		|Light Bulb |
-----		 -----------
  |		     |
  -------------------

In order for the light bulb to light up. We have to have both A and B
switched on right? If either one is off, then the circuit is broken.

This is what we call Logical AND.

What if we put 2 switches (A and B) in parallel with eachother in the same
circuit?

	    A
          --/ --
         |      |
  -------        ----
  |	 |      |    |
  |	  --/ --     |
  |         B        |
-----		 -----------
Power|		|Light Bulb |
-----		 -----------
  |		     |
  -------------------

When will the light bulb turn on?

      A  |  B  |  Bulb
     ------------------
     off    off   off
     off    on    on
     on     off   on
     on     on    on

Again pretty easy. Either A or B need to be on in order
for the light bulb to light up.

The above table is what we call a truth table. It lists off all
the possible combinations of the inputs (A and B in this case)
and their assiated outputs (the bulb in this case).
The truth table completely describes the output in terms of the input.

This example here is known as Logical OR

What about this circuit? When does the light bulb turn on here?

   ------------------
  |	   |	     |
-----	   | A	 -----------
Power|	   \	|Light Bulb |
-----	    	 -----------
  |	   |	     |
  -------------------

Well, if A is "on" and the wire is connected then we'll have
a wire with no resistance on it. This is called a short.

  Remember Ohms Law : I = V/R

If R is 0, then we'll have an infinte amount of current or in
practice we'll have ALL the available current passing through.

This will leave no current for the light bulb causing it to be "off"
The opposite is true if the switch A is "off" - the bulb will be on.

The truth table looks like this:

	A  |  Bulb
       ------------
       off     on
       on      off

This resembles the behavior of a Logical NOT - or negation or inversion.
Essentially anything done to A will have the opposite effect to the output.

These 3 : AND, OR, NOT all happen to be foundational concepts in a
branch of mathematics known as Boolean Algebra.

Interesting history note: Boolean Math has been around long before computers
but it wasn't until the invention of the computer where boolean math was
actually put into practice. Before it was simply used as a tool to aid in
expressing logical thought.

This is an important association. We can now create electronic circuits
(a physical thing) that can perform a virtual thing. In fact boolean math
can be used to express any logical system no matter how complex.

Example: Decision Making
------------------------

Lets use boolean algebra to make a decision based on something we give it.

"If Roses are red, then violets are blue, otherwise violets are black."

Inputs: the color Black (cblack), the color Blue (cblue), red roses (rrose)
Outpus: Color of the Violets (cviolets)

  We know that if the color of the roses has to be red to produce blue violets
  We know that if the color of the roses isn't red, we will get black voilets

  So:  (The color Black AND NOT Red Roses) OR (the color Blue AND Red Roses)

  In boolean algebra this is: 
	(cblack & !rrose) | (cblue & rrose)

This logic is a little tricky but it describes a "Multiplexer" which is yet
another foundational element in logic circuits.

The Multiplexer's purpose is to choose which output should be selected
based on a 3rd input. It's a decision maker using logic circuits. You will
likely see more complicated versions of this kind of "decision circuit" in use
in your motherboard spec.

Look Ahead
----------
Lesson 2 will probably be twice as long as this tutorial but will be talking about the foundation of
processors.

-K

-K