Computers

Today, people use computers everyday without even thinking about it. There's almost an Orwellian cast to how they've assumed themselves into every aspect of your time, not just the box on your desk, but your digital watch, ATM machines, computers in your car, distant computers at the CIA, or what have you. However most people go on their merry way without the slightest inkling as to how these frustrating machines actually work. Most people have a vague notion as to how a television works. There's a vacuum tube and some sort of electron gun that fires electrons at a screen, drawing lines back and forth. However, in the comic strip "Shoe", the computer expert is portrayed as a wizard like Merlin, complete with a pointed hat. If you would like to be able to look down your nose at the mindless drones who daily plug themselves into their machines, then read on.

Let's get back to basics. At the most fundamental level, a computer works on a relay system like that which existed in the 19th Century. You need a thing where if there's a current on two specific wires, it creates a current on the third. Once you have that, by arranging them ingeniously, you can create almost anything.

Let's say you had a wafer of silicon, and you coat it with oxide. A track is then gouged through the oxide to reveal the silicon again, leaving a bridge in the middle. Finally, the exposed silicon is bombarded with atoms of iodine. The atoms of iodine sink in and make the silicon itself conduct electricity.

If you put a current at A, there'll be no current at B. The current can't get across the bridge because the silicon under the bridge is not doped. However, if those silicon atoms are within an electric field, they will conduct electricity. Therefore, let's say you print a track of aluminum across the oxide bridge.

If there's a current at both A and B, there'll be a current at C. This is because if there's a current in the aluminum, the silicon atoms beneath it will be within the electromagnetic field. Let's symbolize the above situation with the following diagram.

Let's say you had a situation where there was a current on the top, and the bottom was grounded. We assume there's a current on A. If there's a current on B also, the current will drain from A to the ground, leaving no current on C. If there's no current on B, this will not happen, and there will be a current on C. This is a thing where it makes it the opposite. This is called a NOT gate, where A is converted into NOT A.



				A | NOT A
				------------
				1  |   0
				0  |   1

This is all very well and good but there's not very much you can do with this. A fraction of the readers will be absolutely mesmerized by NOT gates, and sit there for hours gasping in awe, imagining turning them on and off. Leaving those people to themselves, the rest of us will move on. Let's say you had a thing like this.

If there's a current on both A and B, the current will drain down, and there'll be no current on C. If there's not a current on both A and B, there will be a current on C. This is called a NAND gate.


				A | B | A NAND B
				--------------------
				0 | 0  |    1
				0 | 1  |    1
				1 | 0  |    1
				1 | 1  |    0
Let's say you had a situation like this.

If there's a current on either A or B, the current will drain and there'll be no current on C. If there's not a current on either A or B, the current will not drain, and there will be a current on C. This is called a NOR gate.


				A | B  | A NOR B
				-----------------
				0 | 0  |    1
				0 | 1  |    0
				1 | 0  |    0
				1 | 1  |    0

Before I described a thing where you make it the opposite. Let's say you attached this thing to C in each of the diagrams. In other words, let's say you attached a NOT gate to the NAND gate and NOR gate. A NAND gate combined with a NOT gate is an AND gate. A NOR gate combined with a NOT gate is an OR gate.


				A | B  | A AND B
				-------------------
				0 | 1  |    0
				0 | 1  |    0
				1 | 0  |    0
				1 | 1  |    1


				A | B  | A OR B
				-----------------
				0 | 0  |    0
				0 | 1  |    1
				1 | 0  |    1
				1 | 1  |    1

There is also a thing called an "Exclusive OR" or "XOR" gate, in which if A and B are different, there's a current on C, and if not, not.


				A | B  | A XOR B
				------------------
				0 | 1  |    0
				0 | 1  |    1
				1 | 0  |    1
				1 | 1  |    0

One interesting thing is that these gates were imagined long before computers existed. They come from an ancient field of mathematics called logic, in which the greatest minds of Europe would while away the hours pondering, "If Socrates is living, and an oak tree is living, then Socrates is an oak tree", etc.

So great, we got these wonderful gates, so now what do we do with them. We use them to do mathematics with binary numbers. Before you run off in terror, may I remind you that binary arithmetic is vastly simpler than base 10 arithmetic. If you took a toddler who did not know base 10, and taught them binary arithmetic, they could do it effortlessly. If you then tried to teach them base 10, it would be much more difficult, then if you hadn't taught them binary earlier. Teaching a child binary and then base 10, would be much more difficult then teaching them base 10 first, and then binary afterwards. Why then, do we punish our children by forcing them to learn base 10? Because numbers in binary get extremely long very quickly. If you were writing out a check, you couldn't squeeze the entire number on the paper unless it was a very small number. Of course some people would consider that an additional advantage. Also, this illustrates why computers use binary, because computers are basically very stupid.

Let's say you had two binary numbers with the same and even number of digits. Let's say you did a XOR gate on the left hand digits of the two numbers, and then you did the same thing to the second to left hand digits, and so forth. You end up with a third binary number. You divide it into pairs of digits, and do an OR gate on each pair. You continue this until you're left with only one digit.

Here A and B are the same.


A		1  1  0  1  0  1  1  0
B		1  1  0  1  0  1  1  0
XOR		0  0  0  0  0  0  0  0
OR		  0     0     0     0
OR		      0          0
OR		            0

Here A and B are different.


A		1  1  0  1  0  1  1  0
B		1  1  1  0  0  1  1  0
XOR		0  0  1  1  0  0  0  0
OR		  0     1     0     0
OR		     1            0
OR		             1

If that number is 0, the original two numbers were the same. If it was 1, they were different. This way you can compare two binary numbers. See how useful this is? But wait, there's more.

Here is an AND and XOR gate.



				A | B  | A XOR B         | A AND B
				------------------------------------
				0 | 1  |       0         |      0
				0 | 1  |       1         |      0
				1 | 0  |       1         |      0
				1 | 1  |       0         |      1

What do you notice about these numbers? Notice that this is the addition of two binary numbers, where the XOR is the "answer", and the AND is the "carry".


				A   B   Answer      Carry

				0 + 0 =    0          0
				0 + 1 =    1          0
				1 + 0 =    1          0
				1 + 1 =    0          1

I didn't mean to insult your intelligence by implying that you didn't see that. We can use this to add large binary numbers. Let's say we have two binary numbers with the same number of digits.


carry		0  1  1  1  1  0  1  0
A		  0  0  1  1  1  0  1  0
B		  0  1  0  1  1  0  1  0
	       +     --------------------
answer		  1  0  0  1  0  1  0  0

Do XOR gates and AND gates on the two right hand digits. Put the answer below, and the carry above the second column. Then do that again with the carry and the top digit of the second column. Then take the answer from that, and do this process again with the answer and the bottom digit of the second column. Put the answer below. If one of the two carries was 1, put 1 above the third column. If not, put 0. Repeat this with each column. Do an OR gate with the final carry and the answer from the left hand column.

We have added two binary numbers. If we used OR gates instead of AND gates, we would have subtracted two binary numbers. We can do addition and subtraction. If you can do addition and subtraction, you can do multiplication, division, exponents, roots, logarithms, or any mathematical function whatsoever. You can do anything that can be reduced to mathematical functions, such as elaborate graphics, virtual reality, or whatever. Since almost anything can be reduced to mathematical functions, you can do almost anything whatsoever. This is how anything is ever done inside a computer.

You doubtlessly have many unanswered questions, "hey, how do you do this?". Just to give an indication of how we've only scratched the surface, here is how computers remember things. This is how RAM is done inside a computer.

Notice that if there is a current at C, it would keep itself like that, and if there is no current at C, it would also keep itself like that. If you put a very large current across it, you can cause it to flip around so it would be the opposite of what it had been. Therefore, you can change what is in the memory.

1

Hosting by WebRing.