What Computers Are

J. Greg Davidson On Computing

Preface

As a Computer Scientist I'm relieved when people honestly declare that they don't really understand computers. This relief is in contrast to my distress when I discover that someone I'm interacting with has a seriously distorted understanding of computers.

It would be useful for most people today to have a basic understanding of what computers are along with some basic ability to make use of them. A few people may find themselves interested in knowing quite a bit about computers but not know where to start. Most people have notions of what computers are which are not true and get in the way of using them or learning about them. This Simple Note should provide a solid foundation.

I like to start with fundamentals whenever I undertake a new project, especially if I intend to go deep. This Simple Note is intended to cover the most basic aspects of What Computers Are, especially for someone who thinks they might want to go on and learn a lot about computers and computing. If you want to master something you need to take the time to get clear on the fundamentals!

The interactive features of this Simple Note have only been tested with recent versions of Firefox and Chrome. I apologize if they do not work with your browser yet, and especially if you get popup errors!

Part 1: Computers are a Collection of Switches

A computer is a collection of switches linked together to provide memory functions and logic functions. To understand computers you need to know:

  1. What is a switch?
  2. How can switches be used to represent meaningful values?
  3. How can switches be combined to perform meaningful operations on those values?
  4. How can I organize values into information and operations which reliably and conveniently address my needs and desires?

Part 1 looks at how switches store Bits, Bytes and Words.

So what is a Switch?

off switch on switch

A binary switch is a two-position switch like the simple ones used to turn lights on and off. We call it a binary switch because it has only two positions, ON and OFF. You can use such a switch to represent any either-or kind of value.

Here are some possible interpretations we could give the switch positions::

and so on. We can freely choose either switch position for any meaning as long as we are consistent.

Here are some common interpretations:

Interpretation First Meaning Second Meaning
Switch On Off
Answer Yes No
Truth True False
Number 1 0
Quantity Some None
Value Is Known Unknown

What you call them is just a matter of convenience or convention. What you decide to have them mean is the big deal.

One switch makes a Bit you can click on off

Please do click on the switch!

off switch on switch

Possible interpretations humans might give to the switch positions :

Interpretation Meaning
Unsigned Integer 0
Truth Value false true
Color Value black white

switches makes a Lyk

You can click on these and all subsequent switches!

off switch on switch off switch on switch

These switches might represent the value .
See how high you can count with switches!
How many combinations total is that?
The number of combinations should always be an even number; can you say why?
DId you include the initial all-off combination?
What non-numerical interpretations could you give to this many patterns?

switches has no special name

off switch on switch off switch on switch off switch on switch

These switches represent the value .
See how high you can count!
How many distinct combinations is that?
What did adding another switch do to the number of combinations?
What non-numerical interpretations could you give to this many patterns?

switches makes a Nybble

off switch on switch off switch on switch off switch on switch off switch on switch

These switches might represent the value .
See how high you can count!
How many distinct combinations is that?
What does adding another switch each time to the number of combinations?

Some interpretations of a Nybble's Patterns

Four switches gives us enough combinations to express the decimal numbers 0 through 9, with six extra combinations left over. The extra combinations can be ignored or given the names A through F. Although you're free to assign combinations any way you want, here's the usual way we do it:

Switch Settings Binary Base 2 Bits Hexadecimal Base 16 Digits Decimal Base 10 Digits Colors
OFF OFF OFF OFF 0000 0 0 Black
OFF OFF OFF ON 0001 1 1 Navy
OFF OFF ON OFF 0010 2 2 Green
OFF OFF ON ON 0011 3 3 Teal
OFF ON OFF OFF 0100 4 4 Maroon
OFF ON OFF ON 0101 5 5 Purple
OFF ON ON OFF 0110 6 6 Olive
OFF ON ON ON 0000 7 7 Silver
ON OFF OFF OFF 1000 8 8 Gray
ON OFF OFF ON 1001 9 9 Blue
ON OFF ON OFF 1010 a 10 Lime
ON OFF ON ON 0011 b 11 Aqua
ON ON OFF OFF 1100 c 12 Red
ON ON OFF ON 1101 d 13 Fuchsia
ON ON ON OFF 1110 e 14 Yellow
ON ON ON ON 1111 f 15 White

Four Bits is sometimes called a Nybble. The joke may not be obvious yet.

Using a Nybble to represent the ten decimal digits is called Binary Coded Decimal or BCD. BCD wastes six switch combinations.

When the full set of values in a Nybble is expressed using the sixteen numerals 0-F it is called base-16, hexadecimal or simply hex. It's a matter of style whether we use upper-case A-F or lower-case a-f letters for the hex digits.

The more Bits, the more combinations, the more you can express.
What other interesting interpretations can you give to a Nybble?

switches makes a Byte

Now do you get the joke about Bytes, Nybbles and Lyks? Jokes are a matter of taste.

off switch on switch off switch on switch off switch on switch off switch on switch off switch on switch off switch on switch off switch on switch off switch on switch

These switches might represent the value .

Eight switches makes what we now call an Octet or a Byte of 8 Bits.
Try to guess the number of distinct combinations of the switches in a Byte without trying the switches.
Now try it and see.
The original IBM PC and Microsoft DOS did nearly everything 8 Bits (or one Byte) at a time.
Still today, nearly all Input/Output operations are done in Bytes.
That includes all traffic on the Internet.
We measure storage in Bytes.
How many Bytes of main memory does your favorite computer have?
How many Bytes of disk memory does it have?

How can switches be combined to represent meaningful values?

One switch can only represent a choice of two alternatives. Combining several switches lets us represent more choices:

Number of switches Number of Combinations
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256

Notice that each time we add another switch, the number of combinations doubles, because we can have all the previous combinations with the new switch OFF plus all the previous combinations with the new switch ON.

A Byte is the smallest unit of information which a modern computer can individually address and manipulate. Getting at Bit(s) requires first accessing the Bytes which contains them and then extracting the desired Bit(s) using several operations slow the computer down. Therefore when we want to represent some fancy kind of value we usually think about how many Bytes to use rather than how many Bits.

Ganging together still more switches gives more patterns, some of which have special names and uses:

Switches Combinations Name(s) Typical Use(s)
1 2 1 Bit Boolean true/false
4 16 Nybble BCD, Hex Digit
7 128 char ASCII Character
8 256 1 Byte 1 Character in a Phonemic Alphabet or Syllabary, Input/Output, Word Size of early PCs
10 1024, 1 Ki K approximate 1000 or metric kilo
16 65536, 64 Ki 2 Byte short word early Unicode, very limited Arithmetic, Word Size of later PCs
24 16777216, 16 Mi 3 Bytes RBG Red/Green/Blue Color Pixel (1 Byte per Primary Color)
32 4294967296, 4 Gi 4 Byte long word Unicode Character, limited Arithmetic, Memory Address, IP Address, Word Size of many modern computers, RGB+Alpha(transparency) Pixel
64 18446744073709551616 8 Bytes long long word Extended Arithmetic, Memory Address, Cons-cell, Word Size of high-end computers

Because a Ki (often pronounced "K") is close to 1000, it is treated as being roughly 1000 or a metric "kilo". Similary, a Mi is close to a metric "mega" and a Gi is close to a metric "giga". The terms megabytes and gigabytes are usually shorthands for Mi Bytes and Gi Bytes. This discrepancy has lead some tricky memory vendors to sell their customers less memory than they were expecting, i.e. to sell an actual megabyte or gigabyte instead of the expected Mi Byte or Gi Byte.

Early microprocessor-based computers, such as the original IBM PC were designed to work with 8 or 16 Bits at a time. Most general purpose computers and more recent PCs are designed to work with 32 Bits at a time. Scientific computers and the most recent PCs are designed to work with 64 Bits at a time. The number of Bits which a computer can work with in a single operation is called its word size. Just as it is more efficient for computers to work with Bytes rather than Bits, it is maximally efficient for computers to work in units of their preferred Word Size.

A computer with a smaller word size can simulate a computer with a larger word size by performing more operations, so for some tasks it will be slower. It is particularly inefficient for a computer to work with more memory than it can address as a single word - the meaning of this will be made clear in a companion Simple Note.

Data is generally transferred among computers and between computers and devices (mice, keyboards, disk drives, networks, etc.) in Bytes, i.e. 8-Bits at a time. Bytes are the universal coinage of Input/Output. Thus computers must serialize large values and data structures into sequences of Bytes when performing Output and then reassemble or de-serialize those Byte sequences into equivalent values and structures during Input operations. Sophisticated mostly-automated serializing and de-serializing schemes underly most computer networking and database operations.

End of Part 1.

What's Next?

Proceed to Part 2 for

Browse our materials On Computing

Check out our course on Computing Magic