TUCOWS ARTICLE

Understanding Memory (RAM), Hard Drives, and the Difference Between Them

One of the greatest sources of confusion for computer users is the difference between memory and storage, due to a lot of overlapping terminology. This article will help you sort out your RAM and your hard drive and your bits and your bytes.
Published: Feb 13, 2008
Author: Jordan Running

When I was a kid our family computer started complaining about "insufficient memory" with newer programs. In an attempt to remedy the problem, we deleted as much unused stuff as we could from the hard drive, but it never seemed to help. We had committed one of the most common computing errors: confusing RAM with hard drive space.

Bits and bytes

The confusion is so common, I think, because the two share the same basic terminology: bits, bytes, kilobytes, megabytes, and gigabytes. So let's get those out of the way first. A bit is the smallest unit of information, like a light that can be described only as "on" or "off." The numeral 1 usually means "on" and 0 means "off." All information on a computer can be expressed as a string of bits, for example the letter "Z" can be encoded as 01011010. Eight bits--the number of bits a single character (that is, a letter, numeral, or symbol) is usually represented by--is called a byte.

Since we often deal with information that is many, many bytes in size--music or movie files, for example--we use shorthand prefixes like kilo-, mega-, and giga-, for thousands, millions, and billions of bytes, respectively. A kilobyte (kB) is 1,024 bytes (210, for technical reasons), a megabyte (MB) is 1,048,576 (1020), and so on, all the way up to terabytes, petabytes, and beyond. I won't go into any more technical detail, but if it interests you, Wikipedia is a good resource.

Both your computer's hard drive and its memory store information, and the capacity of both is measured in bits, bytes, kilobytes, and so on, but the two store different kinds of information in different ways, which I describe in the next sections.

RAM: Random Access Memory

RAM modules"RAM" is short for Random Access Memory, and it's commonly referred to as just "memory." Random Access means that the computer can access any data stored in it very quickly--in just a few nanoseconds, i.e. billionths of a second--without concerning itself with any of the data before or after. In desktop computers, RAM takes the form of long, narrow modules, sometimes called "sticks" of RAM, which have a connector with a hundred or more tiny metal contacts running the length of the long side that plugs into the motherboard. RAM for laptop computers is basically the same, but considerably smaller (and consequently more expensive). Most new computers are sold with 1 or 2 gigabytes (GB) of RAM. Older ones may have 256 or 512MB, and top-of-the-lines might have 2.5GB, 3GB, or more.

RAM's purpose in a computer is temporary storage for information that the computer is using right now. If you're listening to music, parts of the song file will be present in RAM, as well as the software that's being used to play it. If you're reading an email, the text of the email is in RAM, and likewise the software needed to read it.

All programs, including Windows itself, your web browser, video players, instant messaging programs, and so on, use memory while they're running (even if they're not visible on the screen and minimized or hidden). Unfortunately your computer's memory is finite. If a program complains of "insufficient memory," and often if your computer seems to be running slowly, it's because the computer needs to store things in RAM that it does not have enough room for. The computer can compensate, to a degree, by using "virtual memory"--which I'll discuss a bit later--but generally speaking the more RAM you have, the more and bigger programs you'll be able to run simultaneously without experiencing slowdowns and "out of memory" errors.

One thing worth reiterating is that memory is temporary storage. By its very nature, as soon as you turn off the computer, everything in memory is instantly gone. Without electricity running through them, RAM modules are blank slates and inert as rocks. That's just fine, though. For storing information we want to keep around, we have hard drives.

The hard drive

Hard disk drive (with cover removed)The proper term here, technical types will tell you, is hard disk drive. An apt metaphor is a record player: The disk refers to one or more circular platters that are like vinyl records but permanently mounted on a spindle. Instead of vinyl, however, they're made out of metal or glass and are coated with a magnetic material. The rest of the device is the drive, which is like the record player itself: It has a motor that turns the disks on the spindle and read-write heads for each platter, which are like the record player's needle, except that they use magnetism to both access--"read"--and modify--"write"--data stored on the disk. The drive also contains electronics that control these parts and let it talk to the rest of the computer. Most hard drives in desktop computers are similar in size and shape to a small paperback book, while laptop hard drives are a bit smaller than a deck of cards, and even smaller hard drives are used in some iPods and similar devices.

The platters in a hard drive spin very fast--7,200 RPMs is typical--and the read-write heads move incredibly fast as well (these are the sounds you hear from within your computer when it's working hard), but compared to RAM accessing a hard drive is very slow--milliseconds compared to RAM's nanoseconds (that is, a million times slower). But, per gigabyte, hard drives are much cheaper to manufacture than RAM, and unlike RAM, data stored on a hard drive will remain intact for many years, even in the absence of electricity, which is why we use them for long-term storage. (Solid-State Disks, a newer type of hard drive that has no moving parts and is faster and more energy efficient--but also more costly--are slowly gaining popularity, especially in laptop computers. Though they work differently inside, for the purposes of the rest of this article they're functionally equivalent to their platter-spinning cousins.)

By long-term storage I mean stuff you keep: The documents you create in Microsoft Word, your web browser bookmarks and history, photos, music and videos you save, and so on. These things--unless you keep them on removable media like a CD or USB flash drive--are all stored on your hard drive. Windows, as well as programs you've installed, along with their settings, are also stored on your hard drive--it isn't until you run them that they're loaded into RAM. "Hard drive space" or "storage space" refers to the amount of data that your hard drive can contain at once. New computers typically come with hard drives that hold anywhere from 30GB to 250GB of data, but this is constantly increasing--hard drives up to 1,000GB (one terabyte, or TB, i.e. one trillion bytes) have recently become available, at a price of course.

A single hard drive can be separated into one or more divisions of arbitrary size, called partitions. Partitions are sometimes, confusingly, also called drives. You might, for example, have a "C: drive" and a "D: drive" which are not different hard drives, but rather partitions of the same drive. A partition can be split up into different folders, also called directories. You probably save your documents in the "My Documents" folder (which in turn is inside another folder, which is inside another), for example, and Windows' system files are kept in a folder called "Windows."

When you get an error like "insufficient hard drive space" or "not enough free space on C:," it means the data on the hard drive--in that particular partition, to be specific--has filled its capacity. The music you've copied from CDs, the movies you've downloaded, the documents you've saved, the programs you've installed--all have contributed to your hard drive being filled, and once it's full you can't put anything else on it. The only solutions are to delete some large files--perhaps copying them to a CD first--or to buy a larger hard drive.

Virtual memory

Your computer's memory and its hard drive are two distinct things--I hope I've illustrated that successfully. But there is one place where they overlap: Virtual memory. Relatively speaking, RAM is expensive and hard drive space is cheap, and we must live with a lot of latter and relatively little of the former. Long ago, however, computer scientists figured out how to use space on the hard drive as though it were extra memory; they called it "virtual memory" or "swap space" for how the data is seamlessly "swapped" between "physical" memory--RAM--and "virtual" memory on the hard drive.

Modern computing wouldn't be the same without virtual memory, but it's not as good as real memory. Remember that accessing data on your hard drive is a million times slower than accessing data in RAM. So if the computer is performing a complex operation, or running many programs at once, or manipulating a large file, and runs out of "physical" memory, it will have to "swap" some of it to virtual memory on the hard drive, and storing and retrieving that data will be orders of magnitude slower than if it were in RAM. This is why, when your computer is working hard, you may hear a lot of clicking and whirring sounds from within--that's the computer rapidly reading and writing data to and from the hard drive. The good news is that because of virtual memory you don't see "out of memory" errors very often on modern computers. The bad news is that the more your computer has to use virtual memory, the slower it will operate.

Finally, you only have as much "swap space" for virtual memory as you have free space on your hard drive. That means if your hard drive is almost full, programs may not have as much memory as they need, and things will slow down and you may even get errors. For this reason it's best not to fill your hard drive completely--a couple gigabytes of elbow room will help keep things running smoothly.


About Jordan Running

Blogger since 1999, Jordan Running went pro in 2005 and never looked back. Sometimes programmer, occasional photographer, and serial tinkerer, he decided to to switch to Linux in 2001 but just hasn't quite gotten around to it yet.

Digg This
Please login to add your comment
Leave A Comment
Name: