Computers work on the base 2 numbering system, also known as the binary
number system (and sometimes 'digital' system).
My computer science classes began explaining this concept
by refreshing our understanding of the numbering system used by humans:
base 10 or decimal numbering system. I believe this is a good approach
to the binary concept.
Base 10 or decimal has 10 digits: 0-9. Lets have a look at how the decimal
system works:
1024
||||--> 4*10^0 = 4*0001 = 0004 (0001 - one's place)
|||---> 2*10^1 = 2*0010 = 0020 (0010 - ten's place)
||----> 0*10^2 = 0*0100 = 0000 (0100 - hundredth's place)
|-----> 1*10^3 = 1*1000 = 1000 (1000 - thousandth's place)
---- +
= 1024 (decimal)
Base 2 or binary has 2 digits: 0-1. Lets have a look at how the binary
system works:
Complex method:
101101
||||||--> 1*2^0 = 1*001 = 001 +
|||||---> 0*2^1 = 0*002 = 000 +
||||----> 1*2^2 = 1*004 = 004 +
|||-----> 1*2^3 = 1*008 = 008 +
||------> 0*2^4 = 0*016 = 000 +
|-------> 1*2^5 = 1*032 = 032 +
----
045 = (decimal)
Simple method:
8 7 6 5 4 3 2 1 - bits place.
128 64 32 16 8 4 2 1 - bits place value.
0 1 0 0 0 1 1 0 - a byte of data.
0 64 0 0 0 4 2 0 = 64+4+2 = 70 decimal.
notice that the 1's place will determine an even or odd number.
A computer uses the binary system because it can set 0 to be false and 1
to be true. Another way to look at this is: 0 = 0.5 volts, 1 = 5.5 volts.
A CD-ROM drive uses a laser as a 'depth-finder' on CD-ROMs. The laser tells
the drive that the rom begins with a shallow hole followed by 4 deep holes.
The drive then understands this as 01111. A hard-disk works this way also
only it uses magnetic alignment to be true or false. Ever seen an old
punch card? A punched hole means 1 or true and a non-punched section means
0 or false.
What is the anatomy of a text file? In a 'plain text' file, each character
is represented by a number. The character and it's numbered equivalent is
defined by the American Standard for Charaters rev 2 or ASCII system.
A = 65d - 1000001b
B = 66d - 1000010b
C = 67d - 1000011b
a = 97d - 1100001b
b = 98d - 1100010b
c = 99d - 1100011b
If I wrote a letter with the contents 'cab', the file would be saved to the
hard-disk as '99 97 98'. A binary representation is: '1100011 1100001 1100010'.
So to imagine this file on a cd-rom drive, here is the pattern the drive would
see on the cd-rom:
110001111000011100010
++---++++----+++---+-
What are bits, bytes, words, etc? A bit is a single value in the binary
number system. A bit can either be 0 or 1. A byte (on most machines) is
a combined vector of 8 bits. A word is equal two bytes.
The maximum amount of combinations that can be represented by a byte is
256. Lets briefly examine why:
12345678 bits = 1 byte
11111111 - all 8 bits in the byte are at the highest value 1.
||||||||--> 1*2^0 = 1*001 = 001 +
|||||||---> 0*2^1 = 1*002 = 002 +
||||||----> 1*2^2 = 1*004 = 004 +
|||||-----> 1*2^3 = 1*008 = 008 +
||||------> 0*2^4 = 1*016 = 016 +
|||-------> 1*2^5 = 1*032 = 032 +
||--------> 1*2^6 = 1*064 = 064 +
|---------> 1*2^7 = 1*128 = 128 +
----
255 = (decimal) = 256 combinations (remember 0?)
What does it mean if I have a 32-bit operating system? A 32-bit operating
system can handle 32-bits of data. Lets take colors on the screen as an
example. On a system that is only 8-bit resolution, as shown above, can
only have 256 possibilities. This means that only 256 different colors
can be used when making a program or setting the font-color. This is why
a 64-bit Nintendo is better than a 32-bit Sega when it comes to the
graphics (color tones possible).
Why do you think humans use the base 10 decimal number system instead
of base 2 binary, base 8 octal, or base 16 hexidecimal?
We use the decimal system because early humans used their fingers to
represent objects (amount of arrow-heads for amount of arrows?), this later
evolved into a concentration called mathematics. Most of us have 10 fingers
or base 10. It is a fact that man would use the binary system if he had only
2 fingers. The binary system would have been just as natural to us as the
decimal system is to us now. If intelligent extra-teresterial beings were
contacted and they only had 8 fingers, they would most definitely use the
base 8 or octal system. What is PI in octal?