This document is roughly
three chapters plus a pile of notes from a book I never finished. It’s yours to read, but it’s contents are ©2003
Scott Hanselman (www.hanselman.com) Thanks.
Computer Zen
From Light Bulbs to the
Internet:
Computer Answers for
the Non-Geek
Introduction
Technology Snowballs
"Any sufficiently advanced technology is
indistinguishable from magic."
Arthur
C. Clarke
This book is for anyone who has ever thought, "I'm a smart
person. Why don't I understand
computers?" To begin to answer that question, let's back up.
Today, as we enter the 21st century, history repeats itself.
In medieval times, the monks controlled access to paper and
consequently, knowledge. As a peasant, I might have lived
my entire life without
seeing
a sheet of paper, and I couldn't have read
the words on one even if I had come
across it! Back then, if someone had said that in the future there would
be discarded scraps of paper lying in the streets -that paper was
virtually worthless- they'd surely have been called mad!
Today, our own special kind of monks, the geeks, control
access to computers – the latest key to knowledge. . However, unlike paper in medieval times, computers
are fast becoming ubiquitous. . . Soon
computers will be as paper is now.
Everywhere. In the near future, all forms of computers will be as
disposable as that wristwatch-calculator your kid found in her Happy Meal™. Perhaps
we'll pick up a six-pack of computers at the local corner store.
Who knows? But, they will all be useless to you unless you understand how
to access the information they store. There is a new caste
system developing in the world - the computer people, and the non-computer
people. Many smart, interesting, and successful people have given
up
and resigned to the thought, "I'm just not a computer
person."
The goal of this book is to bring those people back into the
fold. This isn't a how-to book; it won't teach you MSWord™
in 12 days or show you how to get your email.
This isn't a step-by-step book; this is an "in-between-the-steps"
book. If you get lost in a "simple 42 step process”,
this book is for you. If you say to yourself, "If someone would just
tell me what was going on underneath, I wouldn't be
stuck," this book is for you.
What is it that separates computer people from the rest of
us? It's that leap of logic - that
natural human tendency to omit the details when something “just makes
sense”.
Computer
people have a hard time explaining it to the rest of us, because they never had
to learn it – it always “just made sense” to them; and they're so busy (and so amazed that we don't “just get
it”)
that
they rarely have time to sit down and explain it all to us in
English. Not just what button to push, but the Zen of it
all. Where is my file? Why is there a button there? Why do
computers work like they do? Is my TV a computer? What makes a bit
a bit and a byte a byte? Why does a CD hold 74 minutes of music?
What's a pixel? What is an MP3 file and how
can I email a song?
These are the "why" and "what" questions. But, there
is an underlying connectedness to the answers. When you understand that
connectedness, you won't be afraid to answer these questions for yourself.
There is a movement towards consolidation of knowledge going
on in the world right now. We are reminding ourselves of what we
collectively know, as a species, and by revisiting these old
ideas we can develop new ones. What feels like technology advancing
faster than you can handle is really just a snowball rolling
downhill. If we can understand what the
snowball looked like when it was small, we'll have a better idea of
what it will look like when it gets bigger and where it's headed. A great
example of a "technology snowball" is the modern
This book is the stuff they don't teach in school, at least not all in one
convenient place. Pieces of it are there somewhere, buried in the lower
division Computer Science classes at your local university. The geeks get
it. They assemble the pieces with leaps of logic, leaving everyone else (in the
dust?) at the Start button, or the Apple menu. But I'm not
advocating a mass conversion of everyone into geeks! This is more than
computer theory. It's life - it's physics, it's math, it's
engineering...all those words that non-geeks are scared of. But these
things are not as hard as the geeks (or your computer guy) lead you to
believe. Computers are 80% "getting it" and 20% "looking
it up”.
Accepting this is the first step to understanding Computer Zen.
When I use the word “Zen”,
I don't mean it in a religious sense, either Eastern or otherwise. I may be
preaching a gospel here, but it's not a religious one. I use it to mean a
feeling of mindfulness, connectedness, and true understanding.
Science Fiction buffs might instead use the word
"grok" from Robert Heinlein's Stranger in a Strange Land.
To “grok”
something means to truly understand something, like a feeling, so much that it
becomes a part of you. As you read this book, it may move fast, it may
move slow, but try to absorb the meaning more than the details. Some of
the ideas I'll explore will not doubt remind you of other things in your life,
technologies you come in contact with that I haven't thought of. Maybe
you're a mechanic, a teacher, a carpenter, a doctor, or a geek like me.
Think about connecting the dots in your head, because things are more connected
than you've ever imagined.
The fundamentals that we'll discuss together touch of nearly
every aspect of our 21st century lives. If I do my job, you won't be able
to look at a TV, answer the phone, or get your email without thinking about
what's going on "underneath." And once you get it, you've got
it.
If we understand the How, we'll have the tools to explore
the Now. Let's go.
- Scott Hanselman,
August, 2000
Chapter One
Light Bulbs and Bits
"The avalanche has started. It is too late for
the pebbles to vote."
-
Everything that is digital is comprised of zeros and
ones. You may have heard that before, but what does it really mean?
Everything in this chapter is computer-related, but totally non-specific.
This isn't about Windows versus Macintosh. Binary is the language of your
Imagine a light bulb in a lamp in my house. We'll use
it to send information to someone across the street. When it's on that
will represent "true" and when it's off, that's a
"false." Perhaps the question at hand is, are you ok?
When the light bulb is on, my friend across the street will know that I'm OK,
when it's off, it's 911 time. This is a simple way for me to transmit information
across the street. If my friend has a light bulb of his own, we've built
a little two-way network based on light bulbs.
|
Figure 1 - An OFF Light Bulb and an ON Light
Bulb
Some folks say that most cultures on earth count by tens
because we have ten-fingers. We could have just as easily count by twos
because we have two eyes. Let's talk tens, then twos, then we'll come
back to the light bulb.
Remember in grade school when they taught you about number
places. If we have an number like, 15, the 5 is in the "ones"
place, and the 1 is in the "tens" place. When we add one
"ten" and five "ones" we get fifteen. You just tally
up the places to get the final number.
1000's |
100's |
10's |
1's |
thousands |
hundreds |
tens |
ones |
0 |
0 |
1 |
5 |
Figure 2 - The number fifteen in Base10
In the figure, we have four places. What's the largest
number that we can have with four places, before we need another place?
It's four 9's, the number 9999. If we add 1 to 9999, we get 10,000.
The new place is the ten-thousands.
Imagine a car odometer, as the numbers continue to climb.
… |
0007 |
0008 |
0009 |
0010 ß Here we "carry the
one." The 1 moves over to indicate that we have one
"ten" and zero "ones." |
0011 |
0012 |
0013 |
0014 |
0015 |
… |
Figure 3 - A car odometer as the numbers climb
in Base10
Of course, there is no single character number for
"10" - ten is made up of a one and a zero for reasons we've
seen. The numbers we have available to us are 0 to 9. This is
called Base10 numbering since ten is the absolute that we will base
everything thing else that's relative on.
Our example number, 15, is absolute right? If you have
fifteen of something, that doesn't change no matter how you choose to write the
number. If I told you about another numbering system where the symbol
"F" is 15, it's just the name that's changed. We'll learn about
that numbering system soon.
Ok, so we understand Base10. But, what if we decided
to count eyes instead of fingers? We'd be counting in Base2
In Base10, we had tens, hundreds, thousands, etc. What
places do we have in Base10?
8's |
4's |
2's |
1's |
eights |
fours |
twos |
ones |
1 |
1 |
1 |
1 |
Figure 4 - The number fifteen in Base2
So, 0 is zero and 1 is one. Do we have a 2? Just
like we don't have a "10" character in Base10, we don't have a
"2" character in Base2. Instead, we carry the 1 as we count
up. See figure three.
0000 ß
zero |
0001 ß
one |
0010 ß two (we carried the one, and move it
to the next column, in this case the "twos" column. So we
have one "two." |
0011 ß
three |
0100 ß
four |
... |
1111 ß fifteen |
Figure 5 - A Car Odometer in Base2
This might seem weird, but hang in there. How many 1's
do we have? One. How many 2's? One. And one each of 4's and
8's.
So, 1+2+4+8 = 15. Just like 10+5=15 earlier.
Each one or zero is a "bit." A bit is the
smallest piece of information there is. It either IS or it ISN'T.
That means that it's either dark or it's light. There is no in
between. Hence, a one or a zero. This is the WHOLE POINT of
binary. You know how your TV signal can "ghost" and fade in and
out? It's an analog waveform (more on this soon!) and it's
susceptible to interference, and being modified. In a binary world,
either a 1 was sent, or a 0. There is no middle ground. We'll
discuss later the relationship between analog and digital. You can send
digital information by analog means, and create analog information, like music,
from a digital source. Very cool.
So it took 4 bits to represent the number 15. More
specifically, 4 bits (or "places" in the case of Base2) will let use
represent any number from 0 to 15.
Remember; don't get confused, because numbers are pretty absolute.
Just because 15 is written as "1111" in Base2, doesn't mean it's not
15! Here are a few more examples for you to check out. Count up the
places in the Base2 numbers to see how it all works.
Base10 |
Base2 |
15 |
1111 |
2 |
0010 |
5 |
0101 |
11 |
1011 |
9 |
1001 |
Figure 6 - Some Base10 and Base2 Numbers
Byte-sized Information
Alright! So, now we can represent any number from 0 to
15. We could add a few light bulbs to our little messaging system with
the neighbors. Instead of just two pieces of information, we can send out
16 different messages. What's cool about this is that we only added three
more light bulbs, but the ability to represent fourteen more numbers!
When you add just another number place you gain exponentially more information.
|
Figure 7 - Four Light Bulbs ON in a Row, the
number 15 in Binary
So, instead of four light bulbs, let's double it to eight.
Eight bits is one byte.
128's |
64's |
32's |
16's |
8's |
4's |
2's |
1's |
one-twenty-eights |
sixty-fours |
thirty-twos |
sixteens |
eights |
fours |
twos |
ones |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
Figure 8 - The Number 255 in Base2
So, we double the number of bits, how much more information can
we store? Since it's expotential, we gain quite a lot!
By the way, I think of exponential as meaning add a little -
gain a lot. It also means, "raised to the power of." For
example 2 raised to the power of 2 is 4. 2 * 2 = 4. This is
also called two to the second power.
If we take 2 to the 8th power, since we are Base2 and we
have 8 bits, what do we get?
2^ 8 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 256
By just doubling the number of bits, or places, we go from
being able to represent 16 numbers to 256!
Here's a few examples. I added a dash to help you
count the places.
Base10 (Us, Humans) |
Base2 (Binary, Computers) |
63 |
0001-1111 |
64 |
0010-0000 |
127 |
0011-1111 |
128 |
0100-1111 |
234 |
0111-1010 |
255 |
1111-1111 |
Figure 9 - Base10 and Base2 Examples
Here's an easy way to practice turning your Base10 numbers
into binary. Now, I know you might think this whole chapter is not useful
to you, but remember they had to put rocks at the bottom of the pyramids before
they put rocks at the top. Trust me.
Let's take the example 234 from above.
We have 8 places, right?
128 |
64 |
32 |
16 |
|
8 |
4 |
2 |
1 |
0 |
0 |
0 |
0 |
- |
0 |
0 |
0 |
0 |
We'll start on the left with the big numbers. How many
"128's" do we have? It's a weird question, I know. How
many times does the number 128 "fit" into 234?
234 - 128 = 106 so we have 1 "128"
128 |
64 |
32 |
16 |
|
8 |
4 |
2 |
1 |
1 |
0 |
0 |
0 |
- |
0 |
0 |
0 |
0 |
How many 64s? 32s? Keep subtracting...
234 - 128 = 106 |
we have 1 |
128s |
106 - 64 = 42 |
we have 1 |
64s |
42 - 32 = 10 |
we have 1 |
32s |
10 - 16 = can't do it. |
we have 0 |
16s |
10 - 8 = 2 |
we have 1 |
8s |
2 - 4 = can't do it |
we have 0 |
4s |
2 - 2 = 0 (we’re done here) |
we have 1 |
2s |
0 - 1 = can't do it |
we have 0 |
1s |
Figure 10 - Converting a Base10 Number to
Base2 (Binary)
What does that give us? 1110-1010. So what.
Well, if I wanted to send the number 234 to my neighbor with my light bulbs,
now I know which light bulbs to light up! Fortunately you'll probably
never have to think about binary again, since it's hidden inside your
computer.
|
Figure 11 - 234 in Base2 on Eight Light Bulbs
What does this all mean? When I look at my computer I
see letters, and the mouse cursor, and windows, not ones and zeros.
You've probably heard that binary is the language of computers...but what does
that mean? How does a computer think about the letter
"A"? Or "Scott" for that matter? I would love
to know what my computer thinks of me, wouldn't you?
What about letters?
A byte - that's a lot of
information...so what do I want to tell my neighbor now with this array of
eight light bulbs? Well, I can send him any number from 0 to 255, but how
useful is that? Let's say I want to send letters to my neighbor with my
light bulbs.
ASCII (ask-key) is a mapping of numbers to letters
that the folks at the
Dec |
Hex |
Char |
|
Dec |
Hex |
Char |
Dec |
Hex |
Char |
Dec |
Hex |
Char |
0 |
0 |
NUL |
(null) |
32 |
20 |
SPACE |
64 |
40 |
@ |
96 |
60 |
` |
1 |
1 |
SOH |
(start of heading) |
33 |
21 |
! |
65 |
41 |
A |
97 |
61 |
a |
2 |
2 |
STX |
(start of text) |
34 |
22 |
" |
66 |
42 |
B |
98 |
62 |
b |
3 |
3 |
ETX |
(end of text) |
35 |
23 |
# |
67 |
43 |
C |
99 |
63 |
c |
4 |
4 |
|
(end of transmission) |
36 |
24 |
$ |
68 |
44 |
D |
100 |
64 |
d |
5 |
5 |
ENQ |
(enquiry) |
37 |
25 |
% |
69 |
45 |
E |
101 |
65 |
e |
6 |
6 |
|
(acknowledge) |
38 |
26 |
& |
70 |
46 |
F |
102 |
66 |
f |
7 |
7 |
BEL |
(bell) |
39 |
27 |
' |
71 |
47 |
G |
103 |
67 |
g |
8 |
8 |
BS |
(backspace) |
40 |
28 |
( |
72 |
48 |
H |
104 |
68 |
h |
9 |
9 |
TAB |
(horizontal tab) |
41 |
29 |
) |
73 |
49 |
I |
105 |
69 |
i |
10 |
A |
LF |
(NL line feed, new line) |
42 |
2A |
* |
74 |
4A |
J |
106 |
6A |
j |
11 |
B |
VT |
(vertical tab) |
43 |
2B |
+ |
75 |
4B |
K |
107 |
6B |
k |
12 |
C |
FF |
(NP form feed, new page) |
44 |
2C |
, |
76 |
4C |
L |
108 |
6C |
l |
13 |
D |
CR |
(carriage return) |
45 |
2D |
- |
77 |
4D |
M |
109 |
6D |
m |
14 |
E |
SO |
(shift out) |
46 |
2E |
. |
78 |
4E |
N |
110 |
6E |
n |
15 |
F |
SI |
(shift in) |
47 |
2F |
/ |
79 |
4F |
O |
111 |
6F |
o |
16 |
10 |
DLE |
(data link escape) |
48 |
30 |
0 |
80 |
50 |
P |
112 |
70 |
p |
17 |
11 |
DC1 |
(device control 1) |
49 |
31 |
1 |
81 |
51 |
Q |
113 |
71 |
q |
18 |
12 |
DC2 |
(device control 2) |
50 |
32 |
2 |
82 |
52 |
R |
114 |
72 |
r |
19 |
13 |
DC3 |
(device control 3) |
51 |
33 |
3 |
83 |
53 |
S |
115 |
73 |
s |
20 |
14 |
DC4 |
(device control 4) |
52 |
34 |
4 |
84 |
54 |
T |
116 |
74 |
t |
21 |
15 |
NAK |
(negative acknowledge) |
53 |
35 |
5 |
85 |
55 |
U |
117 |
75 |
u |
22 |
16 |
SYN |
(synchronous idle) |
54 |
36 |
6 |
86 |
56 |
V |
118 |
76 |
v |
23 |
17 |
ETB |
(end of trans. block) |
55 |
37 |
7 |
87 |
57 |
W |
119 |
77 |
w |
24 |
18 |
CAN |
(cancel) |
56 |
38 |
8 |
88 |
58 |
X |
120 |
78 |
x |
25 |
19 |
EM |
(end of medium) |
57 |
39 |
9 |
89 |
59 |
Y |
121 |
79 |
y |
26 |
1A |
|
(substitute) |
58 |
3A |
: |
90 |
5A |
Z |
122 |
7A |
z |
27 |
1B |
|
(escape) |
59 |
3B |
; |
91 |
5B |
[ |
123 |
7B |
{ |
28 |
1C |
FS |
(file separator) |
60 |
3C |
< |
92 |
5C |
\ |
124 |
7C |
| |
29 |
1D |
GS |
(group separator) |
61 |
3D |
= |
93 |
5D |
] |
125 |
7D |
} |
30 |
1E |
RS |
(record separator) |
62 |
3E |
> |
94 |
5E |
^ |
126 |
7E |
~ |
31 |
1F |
US |
(unit separator) |
63 |
3F |
? |
95 |
5F |
_ |
127 |
7F |
|
Figure 12 – 7-bit ASCII Chart, the first 128
characters
Referring to the chart, what's the number for "A"?
Looks like it's 65. What is the binary for 65? It's
0100-0001. Don't be sad if you can't do this in your head, your not
supposed to be able to! Don't forget that you were taught Base10 from day
one! The point is to see how digital information, "on" and
"off," "one" and "zero" provides the building
blocks for bigger things!
Now that we can see how a byte can be any number from 0 to
255, we can start working with more advanced ideas. Let's look at the
word "Scott" from a computer's point of view. It's a five
character word, so it will be 5 bytes long. If we look up each letter on
the ASCII chart, we get:
S |
c |
o |
t |
t |
83 |
99 |
111 |
116 |
116 |
Figure 13 - "Scott " in Base10 ASCII
Note: That's an uppercase "S," so it's 83,
instead of 115, which is a lower case “s.”
Now, if I wanted to send “Scott” to my neighbor, I'd send
binary with the Light Bulbs. If we viewed "Scott" as binary,
we'd get:
Letter |
Base2 |
Base10 |
S
|
0101-0011 |
83 |
c |
0110-0011 |
99 |
o |
0110-1111 |
111 |
t |
0111-0100 |
116 |
t |
0111-0100 |
116 |
Figure 15 - "Scott" in Binary (Base2) and Decimal
(Base10)
That's pretty hard to read. Base2 is difficult for
programmers to read, but Base10 isn't ideal either, because it doesn't really
reflect what's going on inside the computer. So, what is a compromise
numbering system that isn't as unwieldy as Base2, but is more management for
the human eye, like Base10?
Hexadecimal
Since eight bits is a very
useful and flexible byte-sized (sorry) amount of information, we can see the
need for a numbering system that lets the programmers work with familiar characters
and concepts, while still letting the computer do the work of binary 1s and 0s.
Since 1111 in binary is 15 in Base10, it would be cool to
refer to 4 bits as a single character. That way, instead of saying 1111
or 15, perhaps I'd say "F."
Hex |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
Dec |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Figure 16 - Hexadecimal
Whew...now we 3 numbering systems to keep straight.
Why are you doing this to me, Scott? We want computers to think like we
go, work like we do, and understand us. But we have to build our reality
up from the computers reality of 1s and 0s. On and off. +5 volts
and -5 volts.
(where to put this paragraph?)
Here's our number table again, now with Base16 or hexadecimal
added. That's mighty convenient! I don't need to think about
ones and zeros any more. I've also added some harder numbers. To
keep Hex or Base16 numbers separate from Base10, we add "0x" in front
of each number. It's just used to keep things straight, so don't let it
distract you.
Base10 |
Base2 |
Base16 |
Decimal |
Binary |
Hexadecimal |
15 |
1111 |
0x0F |
2 |
0010 |
0x02 |
5 |
0101 |
0x05 |
11 |
1011 |
0x0B |
9 |
1001 |
0x09 |
234 |
1110-1010 |
0xEA |
0 |
0000-0000 |
0x00 |
64 |
0100-0000 |
0x40 |
255 |
1111-1111 |
0xFF |
170 |
1010-1010 |
0xAA |
Figure 17 - Our Table of Numbers again, with
Base16 added, and some harder ones
So, if wanted to refer to the Base10 number 234 in Base16,
how would that look? Well, in binary 234 is 1110-1010; I'll take 4 bits
at a time. 1110 is fourteen. Fourteen is "E" in Base16.
1010 is ten, and ten is "A." So, 234 is "0xEA" in
Base16.
Notice how "64" in Base10 (that's us) is 40 in
Base16? Isn't that weird. But if we take the Base16 number and
split it up, we can see how that happened.
4 |
|
0 |
||||||
8s |
4s |
2s |
1s |
- |
8s |
4s |
2s |
1s |
0 |
1 |
0 |
0 |
|
0 |
0 |
0 |
0 |
That gives us the binary number 0100-0000, which equates to:
128s |
64s |
32s |
16s |
- |
8s |
4s |
2s |
1s |
0 |
1 |
0 |
0 |
|
0 |
0 |
0 |
0 |
We have one "64" so, the number is 64 in Base10.
Now this can be confusing. Why do I need two letters
to refer to one number that I use to look up on a chart and get one letter?
This is where the Zen comes in. Even though computers are absolute,
everything is relative to context. If I say "234" to you, from
one human to another, you would never question that I meant 234 Base10.
To a computer, if you say 234. Do you mean base10? Perhaps
Base16? To simply know that these questions exist and to know that often
they are answered without your knowledge is fundamental (better word?) to grokking
computers. We may see "Scott" but the computer sees:
ASCII |
S
|
c |
o |
t |
t |
Base10 |
83 |
99 |
111 |
116 |
115 |
Base16 |
53 |
63 |
6F |
74 |
74 |
Base2 |
0101-0011 |
0110-0011 |
0110-1111 |
0111-0100 |
0111-0100 |
Figure 18 - From Humans at the top, to the
Computer at the bottom
Sometimes while working with computers, you'll see things
like this on the screen:
13CD:0100
53 63 6F 74 74 2C 20 74-68 69 73 20 69 73 20 61 Scott,
this is a
13CD:0110 20 67 6F 6F 64 20 62 6F-6F 6B 21 20
20 20 20 0D good book! .
Figure 19 - Debug Output from a text file with
"Scott" in it.
This figure is a debug output of a text file on my
hard drive. It's used by geeks to find problems with files and
programs. It lets them see exactly what's going on inside the
computer. Many old school geeks don't appreciate all the cursors,
icons and windows, and want to get down to the "bits." You can
see on the right the text "Scott." In the middle, you can see a
lot of letters and numbers. Do they look familiar? They are the
hexadecimal representations of Scott. On the extreme left there are some other
hexadecimal numbers. Those numbers show the position of that line in the
file, express in Hex. If you've ever had your computer crash and you see
the "blue screen of death," often it will say something like "An
error 0x06 has occurred in Module SOMEMOD at Position 0xFF40-667A."
Now that you know about Hexadecimal, Binary, and Decimal, you can infer than
these numbers represent some position in memory where something horrible has
happened! Of course, you may not be able to fix it, but it's nice to have
some insight into the bowels of the beast.
Conclusion
So far in this chapters, we've covered:
·
Bits
·
Bytes
·
ASCII
·
Base2 or binary numbering
·
How computers think about letters
·
Base10 or decimal numbering
·
Base16 or hexadecimal numbering
We've seen how much you can do with just 8 bits. Just
eight light bulbs or eight wires. Often today we hear about computers
with 32-bit processors or home game machines with 16-bit power. You can
take the number two and raise it to the power of the number of bits and get an
idea of how much power a computer has. For example:
24 |
4 bits |
2*2*2*2 |
16 |
28 |
8 bits |
2*2*2*2*2*2*2*2 |
256 |
216 |
16 bits |
2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 |
65,536 |
224 |
24 bits |
2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 |
16,777,216 |
232 |
32 bits |
2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 |
4,294,967,296 (4 billion) |
Figure 20 - How bits get big!
We'll refer back to this table later in the book when we
talk about digital music and pictures, and how audio and color quality is
improved on computers by adding more bits. We'll discuss how bytes are
used to store image information, compress CD-quality audio and more
importantly, how these bytes travel across the globe in seconds.
There is law, well, really more of a creepy rule of thumb,
that the CEO of Intel came up with. He said that processor power would
double every 18 months. It's actually proven to be true! That's the
power of exponents and bits. Add a few more bits, and it's easy to
increase the amount of information a computer can manipulate. Soon, we'll
have 64-bit processors in our refrigerators ordering more peaches from the
Internet when it detects that mine have gone bad (as they always do). And
it all started with a light bulb.
1 byte |
8 bits, or a single letter like "A" |
a grade on my report card |
1 kilobyte or 1kbyte or 1K |
1024 bytes |
a short memo, half a page or so |
1 megabyte or 1 meg or 1M |
1024K or roughly 1 million bytes (220 or
1,048,576 bytes) |
500 pages or an average novel |
1 gigabyte or 1 gig or 1G |
1024M or roughly 1 billion bytes (230 or
1,073,741,824 bytes) |
500,000 pages |
1 terabyte |
1024G or roughly 1 thousand billion bytes (2401,099,511,627,776
bytes) |
550 million pages or 3 million average books |
1 petabyte |
1024T or roughly 1 million billion bytes (250 or 1,125,899,906,842,624 bytes). |
550 billion pages or 2 billion average books |
1 exabyte |
1024P or roughly 1 billion billion bytes (260 or 1,152,921,504,606,846,976 bytes) |
3 trillion average books |
Figure 21 - The size of things - one, kilo,
mega, giga and beyond
Chapter Two
Two Worlds: Analog and Digital
"You keep using that word. I dunna think it
means a-what you think it means." - Inigo Montoya
(Look for good descriptions of the deference between
Analog and Digital.)
Everything digital is made of bits of ones and zeros, on
or off. Analog is the opposite of digital and consists of many levels of
information. If digital is Black and White, then analog is the millions
of shades of Gray in between. When you watch regular TV you are watching
an analog signal and when you listen to the radio, you are hearing an analog
waveform. When information is sent in an analog format, there is the
potential for great subtlety in the signal. Digital naturally describes this
or that while analog can describe this that or and all the things in
between.
A good way
to explain analog is to look at a curve. For the mathematically inclined
reader, this curve might be a representation of an equation, but for the rest
of us, it's just a curve. Here's a sine wave describing some
information. Maybe it's showing temperature rising and falling over time,
or perhaps someting more complrex like a radio or TV show. (see figure)
<picture
of a sinewave with a smooth curve>
Notice how
smooth the curve is. In the figure we've zoomed in on a portion of the
curve. See how the curve is still smooth when we look at it closer?
One of the great stengths of analog is it's subtlely and
smoothness. Music may sound more lifelike and warm. Pictures may have
truer color. But it's great strenth is also it's great weakness. If
I send informaton as an analog signal, interferance might change the signal on
its way. Here's the same curve with some interferance added.
<picture of the same curve with some blip>
An example of interference in an analog signal is ghosting
on your television. Sometimes analog signals bounce against mountains or
other houses and when it reaches your TV you're seeing double, or hearing
static on your radio.
If I could
send the information as bits, one or zere, I could be more sure of its quality
when it reaches its detination. The net result is a curve on both sides
of the transmission, which is essentially analog, but we'll convert it to
digital just while we transmit it.
Let's find a way to store this curve as digital
information, then reproduce it later. (see figure)
<picture showing Analog -> Digital -> Analog>
Let's assign
a vertical scale to our wave, and assign numbers to the different values of the
curve, say from 0 to 10. But if we pick a point on the curve with a value
of 7, how can we be sure that "7" is the true value of that
point? Perhaps it's 7.5, or 7.31412343234? How much information is
neccessary? If set a scale of 1 to 10, what about those points on
the curve between 7 and 8?
If we do
store a series of points as whole numbers, then try to recreate the curve
later, we'll see something like this:
<picture
of a sinewave with a few points, and straight lines between them.>
The result
looks similar to our curve, but it's not perfect. It becomes clear that
whole numbers from 1 to 10 won't adequantly represent our curve.
Moreover, it can be said that our curve would have "poor
resolution." So, if 1 to 10 isn't enough, let's try 1 to 100?
What about 1 to 1000? How many points to I need to store to be able to
reproduce this curve later?
We learned about using bytes to repsentent information in
chapter one. Let's see if bytes can help us store this curve. When
we convert a signal from analog to digital, it's kind of up to use to decide
how much information to store. We could use a scale from zero to a
million, but of course we'd need a lot of bytes! Rather than using
multiple bytes for each point, and since a single byte is a nice convenient
piece of information, we'll try using a single byte. When we convert a signal
from analog to digital, it's kind of up to use to decide how much information
to store. We could use a scale from zero to a million, but of course we'd
need more bytes! Since a byte is a nice convenient piece of information,
we'll try using a single byte. Since a byte is 8 bits, or 2^8, we know a
byte can store any number from 0 to 255. Let's change the measuring scale
of our curve from "0 to 100" to "0 to 255."
<picture of the same curve with a Y scale of 0 to
255" with numbers reassigned>
Now our waveform/curve/signal has a "Y" scale
from 0 to 255 and a "resolution" of one byte. If we used two
bytes for our scale instead of one, our curve would have "greater
resoluton." You may have heard the word resolution reffering to
pictures or your computers monitor. The more reoslution you have, the
more information is being stored.
So one byte will be used to store a number that represents
the height of the curve. If we store 255, the point appears at the top of
the curve. If we store zero, that point on the curve is plotted very
low. But what if the curve moves from low to high very fast? Then
how many samples should we capture as the curve moves steeply? To phrase
it another way, what is our sampling rate?
If this curve represents a signal that was transmitted in
a second, perhaps we want to store 100 bytes. That would make our
sampling rate 100 bytes per second.
<figure of chart chopped up with x axises
If we then plot points roughtly where the curve intersects
with the the Y axis, our resolution, and the X axis, our sampling rate, we are
left with a series of points. If we list these points in sequence, our
analog curve could be represented by a digtal stream of bytes like this:
<list of bytes in a row>
Notice how the numbers increase and decrease, just like
the curve? Now, we send these numbers to our neighbor with the lightbulb
network, he can write them down and connect the dots. Now we've
transmitted an analog curve of information digtally, and reproduced the analog
signal on the other side. This is called DA (Digital to Analog) Conversion.
Note: You may have seen labels on CD Players or VCRs that
say "DA Converter."
<picture of the curve with the dots plotted, but only
half the lines drawn in>
When we look at our reproduced waveform along side the
original, we see some differences. The curves are not as smooth,
consequently there is less information in our reproduction. What could we
do to make a truer reproduction? We could use more bytes to store the
levels. Or, we could store more bytes per second. However, the more
bytes we store, the longer it will take to send that information to my
neighbor. It's a tradeoff. The person sending the signal has to
decide quality and quantity. We'll discuss these issues in future
chapters when we talk about how computers store pictures and music.
<figure showing varying resolutions and samplingn
rates>
Here's a thought. We've been using lightbulbs to
transmit information, and that's made our examples a little easy. The
light bulbs are either on or off, representing one or zero. But computers
use wires to transmit information, which begs the question, how to we transmit
our digital information over a wire?
Copper is a very good conducter of electricity, and
consequently most wires are made of copper. Let's say that when we check
a piece of copper wire that has +5 volts of electricity running through it, we
call that a digital "one." When the wire shows -5 volts, that's
a "zero." Now, instead of eight lightbulbs in my window transmitting
informaiton between my house and my neighbors, I'll string eight copper wires in
parallel between our houses. Using a battery, I'll send electrical
pulses across each wire, while my neighbor watches for them on his side.
<picture of a ribbon cable with 8 wires>
Electrical currents can vary a bit considering the source,
the thickness of the wire, the engh and a number of other factors. What
if the resuling voltage is 3.5V or 4, instead of a full 5 volts? My
neighbor and I will agree upon on a tolarance for flexiblity, while still
making sure that there's no question whether I'm sending a 1 or 0. We'll
agree if the voltage is between 3.5 and 5, I'm transmitting a one.
Now I can send curves to my neightbor, or ASCII Text like
we saw in chapter one. Much of our world could be considered analog
data. All of our five senses, what we see, hear, and feel is all analog
information being transmitted through our nervous system as electrical
impulses. The concept of digital to analog conversion is pervasive in our
lifes. If I were to lose my arm in an accident and had it replaced with a
prothetic, the doctors would connect the new arm to my existing nerves and
muslces. They would have to perform conversion between the analog
information provided by my system to the digital language spoken by the
computers in the artificial arm.
Gaining an intuitive understanding of the how and why of
converting the analog wolrd to digital bits and back again is the next step on
the path of Computer Zen.
Chapter Three
Use What You Have: Copper Wire and
Whistles
"We have the technology. We can rebuild
him" - The scientists on The Six Million Dollar Man
" You'll have to speak up." - Grandma
Everything we have today is a direct result of the people
who were here before us. This seems like a relatively safe, if not
obvious statement, but it's an important principle of Computers that is often
forgotten. As users, we take for granted that we can plug our computer
into any old phone line and hookup to a network of information. But why
is it that computers talk over the same phone line that I talk on? Why
don't they have their own hole in the wall to talk over? Why don't they
talk over the power cord? Simply stated, noone wants to pull more
wire. Building a country's infrastructure isn't a fun job. Heck,
building my own home's infrastructure isn't fun. I recently spent a month
pulling cables through my attic in an attempt to connect the computers in my
home together.
So why the telephone? When it became clear that the
telephone was a luxury we couldn't live without, it became a standard part of
our infrastructure. If a new house is built, it receives water, power,
and a telephone line. Of course, it's up to you to pay for the
priviledge, but the telephone company or government is kind enough to pull the
wire right up to your door.
Adoption of the telephone took a few years, as did
adoption of the television. Computers are another matter, spreading like wildfire
with "a PC on every desktop." (Or Mac, if you like.) As
computers continue to gain acceptance, the world population continues to
swell. Connecting our computers is clearly important, but noone is
looking forward to pulling more wire to all those existing households. So
we turn to look at what we have. Technologies that have become endemic in
our society include:
·
Power - one-way, delivered via wires from local power stations,
connecting all homes to a regional power grid
·
Television - one-way, delivered through the air from local transmitters
·
Telephones - two-way, delivered via wires from local switching routing
and switching stations
·
Water - one-way, delivered from local aquaducts and water towers
Short of a two-way wireless solution, which wasn't
feasible thirty years ago, it was thought that phone lines were the best and
most obvious choice of the existing infrastructure to connect to our
computers. It is possible to transmit information over the power grid
while not affecting the flow of power. "X10" is a popular home
automation technology that sends small pieces of information from a clock radio
to, say, or coffee machine, instructing it to begin making coffee. Using
the telephone, however, would allow us to send data anywhere a phone call could
be made, and additonally provided an addressing mechanism in the form of phone
numbers. The power grid doesn't have an addressing scheme that precise.
To begin to understand the zen behind sending data over
the phone we must remember that the phone transmits sound waves.
Telephones take the sounds wave produced by our voices and transmits those
waves over long distances, recreating them accurately on the other end.
When we speak, the vibrations of vocal cords produce an analog wave of sound
much like the curvy waveform we explorer last chapter. As we remember
that the phone systems are designed to route the sound of my voice from my
house to my neighbors, as opposed to moving accurate voltages between houses as
in our previous examples, we can see that we will have convert our digital
computer language to sound.
We've used a light bulb turning on and off and we've used
varying voltage on a wire carrying electricity to indicate binary data.
How about using precise frequencies of sound like a whistle? If I whistle
a high note, that's a one. If I whistle a low note, that's a zero.
Now, assuming that I can whistle loud and fast enough, whistling one bit at a
time could serve as another method to send data to my neighbor. If I
could send 10 ones or zeros in a second then I'd be whistling at 10 bps (bits
per second).
The word modem is a combination of the words MOdulator and
DEModulator. Modems a digital to analog convertors that modulate and demodulator
sound to and from a digital form. Since computers are digital and
telephones transmit sound via an analog means, the modem is the bridge between
these two worlds. Simply stated, modems take the bits from your computer
and convert them into sound that is easily sent over the phone. An
important zen concept is that the phone companies system hears only sound, and
has no idea that two computers, rather than two people, are speaking!
Now, hopefully my modem will be able to send more
information than my paltry 10bps. Modems orignally sent information at
75bps, 150bps, then 300bps that translated to roughly 30 bytes per
second. If I wanted to send a 2000 word ASCII text document over a 300bps
modem, would take about 1250 seconds or 20 minutes. Over the years modems
increase in speed to the current theorectical maximum speed of 33,600.
When a modem transmits at 14,400bps, people often say it's a "14.4"
or "14.4K" modem, with the "K" meaning 1,000.
It's important to note that modem speeds are measured in
bits, not bytes. So, a 14,400bps modem or 14.4kbits modem
transmits approximentialy 1.4Kbytes or 1400 bytes a second. A 33,600bps
modem transmits about 3.4Kbytes or 3400 bytes a second. Even though I
acheived my calculations by diving by 10, rather than 8, it's roughly
equivilent, as modems inccur some overhead as they continually handshake and
confirm the delivery of the bits. For example, my neighbor might whistle
back to me once for every 8 bits sent him, to which I would also respond with a
whistle, then continue transmitting.
There was some heated debate as modems became faster and
faster, as to what the theorectical maximum speed would be. Many new
protocols were developed, each aimed at increasing the sampling rate, or number
of distinct sounds per secondn that could be reliably sent over a phone line
that was never meant to sent data. Remember, phone lines were designed to
transmit just our voices, and only at a level that would make the human voice
recognizable and understandable. The fact that computers can transmit
over these existing copper wire is a clever and unexpected benefit.
<do some research into how 8kilohertz of sound holds
56k bits?>
<table showing modem speeds>
150
300
1200
2400
9600
14400
19200
28000
33600
56600 (achieved by digital compression)
Old style modems connected to phones via an acoustic
coupler, while new modems plug directly into the phone line in your wall.
<picture of an acoustic coupler>
---------
"The eight-fold path to Computer Zen
1. Ones and zeros are the building blocks of the
digital world
2. Noone wants to pull more wire. All new
computer technolgy relies on the technolgies of the past.
3. Analog to Digital Conversion is the bridge between
life and computers
4. Modems use phones lines in entirely unexpected
way.
5. Compression is based on two concepts: store only
what is needed, and don't repeat information.
6. Wireless devices are the same as wired devices,
only the transport mechanism has changed.
7. Computers may use 1s and 0s at the low level, just
as all humans have emotions, but they often speak different languages at the
high level
8. The internet is the sum of all the computers
that are attached to it, no matter how they are attached.
Electrons are cheaper than molecules.
Find our what the ____-fold path is...
Add word definitions at the beginning of each
chapter??
Chapter on XML?
"Any sufficiently advanced technology is
indistinguishable from magic."
"The avalanche has started. It is too late for
the pebbles to vote." -
"You keep using that word. I dunna think it
means a-what you think it means." - Inigo Montoya
" You'll have to speak up." - Grandma
"We'll sell you a car in any color, as long as it's
black." - Henry Ford
"This boulder is too large, I can lift a smaller
one." - Bill Murray as an aging Hercules on Saturday Night Live
"I went home and all my stuff had been stolen and
replaced with an exact duplicate. I told my roommate, Look all my stuff
has been replaced with an exact duplicate. And he said, Do I know
you?" - Steven Wright
"Trying to stop file sharing is like trying to stop
the rain." - Chuck D. of Public Enemy
"Dot-com!" - Uncle Ronnie
"Fantastic Voyage" - Coolio
"From frustration first inclination is to become a
monk and leave the sitatuation." - Young MC
"Luke, I am your father." - Darth Vader
"I think that there is a market in the world for at
most 3 computers" - head of
"This is the biggest interview since God talked to
Moses." - Newspaper Editor Perry White in the movie Superman I
"Illogical." - Mr. Spock
NOTES
Making stuff with Bytes
1 bit, then 8-bit grayscale, good examples, color, then
rle
Sending information - wires, voltage?
Bytes....everything in bytes...
Unicode - a simplification
Transport layer, TCPIP, DNS, Telnet
Packet switching as a concept? Difference between
phone lines physically and the Internet conceptually?
Compression as a comcept...dictionary compression
Bitmaps 1-bit, Fax Machine
RLE Run Length Encoding
GIF, LZW - Just another kind of encoding
JPG - Lossy Compression
Audio
The concept of Analog to Digital...an analog waveform,
expressed as digital...the "resolution" of 8-bit versus the
resolution of 16-bit
Modems - how to express digital information like bytes in
an analog world? whistling of the modem...diagram of digital sound over a modem
over analog phone lines?
Free phone calls over the net - what's that about?
Discussion of
8Khz phone
11Khz AM Radio
22Khz FM Radio
44Khz CD Audio
MP3s - revisiting compression, again lossy, but now
applied to sound...
MPEG? Video - put the two together, lossy video and lossy
audio, and suddenly you can fit 24 frames a second + multiple audio tracks on a
Disc!
Email - sends text across the net
Email Attachments - UUENCODING Converting 8bit binary and
all that into 7 bit ASCII
(Check on the difference between 8 and 7bit ASCII?
Worth mentioning? )
Now, Text across the Net, plus graphics =
Go lower? Discussion of RISC and
Quotes Bin and Goo - Possiblities for Chapter Headings?
"What's the square root of 2 when you work it
out?"
"The same thing when I don't work it out!"
Ain't nothin' to it, but to do it. - Unknown?
"The greatest thing the devil ever did was convince
the world he didn't exist." - Keiser Soze
It compiled? Ship it!
"Illogical." - Mr. Spock
"Thank you very much, Mr. Roboto." -
"Trying to stop file sharing is like trying to stop
the rain." - Chuck D. of Public Enemy
"The avalanche has started. It is too late for
the pebbles to vote." -
"You're so money and you don't even know it - Vince
Vaughn in the movie "Swingers"
"You keep using that word. I donna think it
means a-what you think it means." - Inigo Montoya
"John Doe has the upper hand here." - Morgan
Freeman in the movie "Seven"
"...back when I invented the Internet..." -
attributed to Al Gore
"Luke, I am your father." - Darth Vader
"There is another" - Yoda
"When you label me, you nagate me." -
Kuirkaguard(sp) or Dick Van Patton
"You kids!" - Mike Brady
"I went home and all my stuff had been stolen and
replaced with an exact duplicate. I told my roommate, Look all my stuff
has been replaced with an exact duplicate. And he said, Do I know you?"
- Steven Wright
"640K ought to be enough for anyone" - Bill
Gates
"I think that there is a market in the world for at
most 3 computers" - head of
"Watson, Come here." - Alexander Graham Bell
upon inventing the telephone
"We'll sell you a car in any color, as long as it's
black." - Henry Ford
"Thank you very much, Mr. Roboto." -
"You are not a special and unique snowflake." -
Tyler Durden
"I am Jack's complete lack of surprise." - Jack
"This is the greatest [thing] since God talked to
Moses." - Perry White in Superman I
"I longed to know what kind of dining room set
defined me as a person." - Jack
"From frustration first inclination is to become a
monk and leave the sitatuation." - Young MC
"Dot-com!" - Uncle Ronnie
"Fantastic Voyage" - Coolio
"No bull, no pork" - Senator Joseph Lieberman as
told to Al Franken
"Why not me?" - Al Franken
"That's pretty OUT THERE stuf.." No, It's
right here stuff."