Computer Memory

A computer's memory is one of its most interesting components. In this article, I want to discuss how to teach a middle school student some basic concepts about computer memory.

A computer's memory is the set of electronic circuits that allows it to store numbers. A digital computer is designed around the concept of a binary digit, called a bit. Each bit can represent a value of either "0" or "1". A bit is an abstract mathematical concept. In an electronic circuit, it is realized as a switch. A switch must be either "open" or "closed" and these two states can represent the values of "0" or "1". (See the article "The Mighty Switch" for further discussion of switches.) For example, here is a circuit that shows a very simple memory. It has two switches, which means this memory is two bits wide. With two switches, there are four possible combinations of "open" and "closed", which means that this memory can store the following binary numbers 00, 01, 10, and 11.
In decimal, those values are 0, 1, 2, 3. With more switches we can represent more bits, and with more bits we can store larger numbers. Each additional switch doubles the size of the number we can store. With two switches, we can store 2 x 2 = 4 different combinations of "0" and "1", representing the 4 values from 0 to 3. With four switches we can store 2 x 2 x 2 x 2 = 16 combinations, as shown in this table. So, if we have eight switches, we can represent any number from 0 to 255
(2 x 2 x 2 x 2 x 2 x 2 x 2 x 2= 256 )
by turning the different switches either ON or OFF.
A number that is 8 bits wide is used so commonly that we give it special name, which is a byte.

Suppose we want to store two bytes at the same time. In that case, we will need two sets of eight switches. In fact, for each byte we will need a set of eight switches.

Suppose we have a small computer memory that consists of 4 sets of 8 switches each. It can store four numbers. We would say that it has 4 memory locations. If we want to "look up" a value in one of the locations, how do we know which location, which set of switches, to look at? We need a way to identify each location uniquely, that is, with a name that only it has. We could call them by names like "My Memory Location", "My Other Memory Location", "Another Memory Location", and so on.

The easiest way to name each location is with a number. One way to illustrate this concept to your student is at your local post office, where there are walls of post office boxes which people can rent as a place to receive their mail. They look something like this. Each box has its own number, which identifies it. The number is part of the address to which mail is delivered.

P. O. Box 104

Yourtown, YourState Zip Just as every P. O. box (or every house on a street) has its own number to identify it, so every memory location in a computer has its own number. We usually call the number of a memory location its "address". We said a small memory might be 4 locations, each 1 byte (8 bits) wide. We can draw it something like this. If we "read" the contents of memory at address 103, we get the binary number "00000011", which is a decimal "3".

Now that we know what a byte of memory, we can define some units of memory size that are commonly used. We have seen that a byte of memory can store any number from 0 to 255, which is a total of 256 possible values.
Another way to say it is that 2 to the 8th power, which is 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 256.
What is 2 to the 10 power? Well, if you multiply it out, you will find that it is 1024. You have probably learned that kilo- is a prefix that means 1000. For example, a kilometer is a unit of distance equal to 1000 meters. When people first noticed that 1024 is only a little larger than 1000, they began to speak of memory in terms of kilobytes. A kilobyte is not, however, 1000 bytes. Instead, it is 1024 bytes, because 2 to 10th power is 1024.

In a similar manner, the prefix mega- generally means 1,000,000, but in computer terminology it means not 1000 x 1000 but rather 1024 x 1024, which is equal to 1,048,576.

In general usage, the prefix giga- means 1,000,000,000, that is, a billion.
But if you are read a sentence like the following:

"The new XYZ computer comes with a 80 gigabyte hard drive."

then you know that it has a 1024 x 1024 x 1024 = 1,073,741,824 bytes of memory.
These units are often abbreviated as follows:

kilobyte (KB)= 2 to 10th power = 1024

megabyte (MB) = 2 to 20th power = 1024 x 1024 = 1,048,576

gigabyte (GB) = 2 to 30th power = 1024 x 1024 x 1024 = 1,073,741,824

Early personal computers often had no more than 16 kilobytes of memory. Over the past two decades, engineers have learned how to make memories smaller, cheaper, and faster, so that today the appropriate units are usually either megabytes or gigabytes.

One activity you can do with your student is to check the memory sizes of electronic products in your home. For example, a typical CD can hold a maximum of about 700 megabytes of data. If you have a digital camera, how much memory does it have for storing pictures?

Computer memory is one of the topics taught in
Introduction to Computers  Middle School,
a 9 week computer-based course from StrongTower Software .