Friday, January 13, 2012

How Your Conputer Uses Memory

I originally published this article on Yahoo Voices under the pen name John Mario.

Most new computer has several gigabytes of memory. A gigabyte is 1,000,000,000 bytes. This article talks about how your computer keep track of where everything is stored in this memory. You don't need a background in electronics to read this article. It is an article for those who want to learn about computer memory without getting buried in a myriad of complicated technical terms.

Let's digress for a moment. Each family that lives on any given street has a door number on their front door. That door number, as you well know, is part of your address.

Every memory location has an address associated with it. For purposes of this discussion, a memory location is defined as one byte of memory. A byte can hold an 8 digit binary number. In decimal, this means a byte can hold any number from 0 to 255.

When the computer program wants to write data to memory, it accesses memory via the memory address. As you learned in my article on programming, the programmer assigns a name to a memory location. The name describes what is in that memory location. That name is associated with a memory address. Lets assume the name is price_of_apple and the memory address is 36125. Now we write an instruction in our program to save the value 0.95 in the memory named price_of_apple. When that instruction is executed, the memory location with the address 16125 will contain the value 0.95. The English explanation would be that an apple costs $0.95.

Lets take a closer look at what is happening inside your computer without getting buried in mounds of technical jargon:

Basically there are two different types of memory: sequential access and random access. In sequential access memory, you must read everything that is in memory in the order that the data appears until you find the data you are looking for.

In random access memory, you can read any memory locations you want without having to read the other locations. This article will focus on random access memory.

A memory stick inside my HP computer looks like a thin rectangular piece of plastic with multiple pins on one edge. Inside my computer is an Intel computer chip. This Intel chip is referred to as a processor. When the computer program wants to store the price of an apple in memory, the processor sends that price, 0.95, to the memory stick. The processor also sends the address 36125 to the memory stick. Then the processor sends a command to the memory stick telling it to save the price at the memory address. Hence the price is written to the memory location whose address was sent by the processor.

Now let's talk about reading a memory location. When the computer program wants to read the price of an apple, the processor sends the address (36125) of the memory location price_of_apple to the memory stick. Then the processor commands the memory stick to send the price back to the processor. The memory stick sends the price (0.95) to the processor.

This concludes the explanation of how your computer uses memory.

References

I have a Bachelor of Science degree in Electrical Engineering and worked as an embedded systems software engineer.

No comments: