Primary memory and secondary storage, RAM and ROM - purpose and differences
Introduction
There is a distinction made in computing between primary memory and secondary storage.
Primary memory
Computer systems come with two types of primary memory, RAM and ROM. Both types are known as primary memory because the CPU can access them both directly. The CPU can go directly to either RAM and ROM and fetch an instruction from it. It can then decode that instruction and execute it.
Secondary storage
Secondary storage is the term used for long term storage devices like a hard drive, a CD-ROM or a pen drive. The hard drive in a computer, for example, typically stores your operating system, your applications and all of your files, even if the power is switched off and even if you are not using them at the moment. We often think of secondary storage as a suitcase, a place simply used to store large amounts of software and files while they are not being used. The important distinction between primary memory and secondary storage is that secondary storage cannot be accessed directly by the CPU like primary memory can. If the CPU needs to run an application or access a particular file and it is not in primary memory, then a copy of the application or file has to be made from the hard drive and then moved into primary memory first. Only then can the CPU access it.
The purpose of RAM (Random Access Memory)
This is the place where the computer stores programs and files it is using at the moment. Remember, all your programs and files are stored on your hard drive (whether you are using them or not) but the ones that are open, that are being used at the moment, have a copy in RAM. That means that the CPU can access them immediately. For this reason, RAM is often also known as Immediate Access Storage (IAS). Computers could be designed so that they accessed instructions and data in a program directly from a hard drive. The problem with this approach is that devices like hard drives and other storage devices are very slow compared to RAM. It wouldn't allow computers to perform as quickly as they do.
You can think of RAM as a table with two columns. The second column is used to store instructions in a program and any pieces of data the program needs. There will be lots of these 'storage units' so each of them needs an address and that is what the first column is used for. The CPU uses these addresses to find and save data and instructions.
|
RAM Address |
Data item in RAM |
|
1354354 |
0100 1011 1011 0011 |
|
1354355 |
1100 1111 1011 0001 |
|
1354356 |
0110 0011 1000 0001 |
|
1354357 |
0000 1111 1101 1111 |
|
1354358 |
0110 1111 0000 1011 |
|
1354359 |
0111 1001 1010 0000 |
|
1354360 |
1100 0001 1001 1010 |
A stick of RAM - RAM chips soldered onto a printed circuit board, ready to be plugged into a free slot on a computer's motherboard.
Names for RAM
RAM can be called a number of things, including memory, primary memory, Immediate Access Storage, IAS and the memory unit. It's important to recognise that they are all the same thing. They are all RAM.
The purpose of ROM (Read Only Memory)
ROM is needed when a computer system is powered up.
ROM holds part of a program that starts running when a computer is switched on.This program has two jobs:
- It checks that the computer hardware is all present and working correctly when you power up a computer system. It runs what is known as a 'BIOS' check (Basic Input Output System check)
- Then it helps the computer copy the operating system from the hard drive to RAM, so that the computer can then be used.
Starting up a computer is also known as 'booting up' the computer.
A ROM chip, soldered into a motherboard.
The differences between RAM v ROM
There are some key differences between RAM and ROM that should be noted, apart from their typical uses.
-
- RAM is volatile. That means that when you switch the power off, all the contents of RAM are lost. ROM is non-volatile - even if you switch the power off, the programs and data in ROM are not lost. They are there waiting for you to power up the computer again! If your computer starts misbehaving itself, one solution is to switch off the power and boot it up again. What you are doing is to clear out the RAM and reload it all again in a nice, organised fashion.
- You can both read from and write to RAM. With ROM, you can only read from it. You can't write anything to ROM. (Actually, it is possible if you know what you are doing. This process is known as 'flashing'. If something goes wrong whilst you are flashing ROM, the equipment can stop working all together!)
- ROM chips are usually part of the motherboard of a computer system. They are fixed to it so you cannot easily change the ROM chip, although it is possible to have motherboards with removable ROM chips. RAM, on the otherhand is 'plugged' into the motherboard in specially designed slots. You can change your RAM if you want to, for RAM 'sticks' (printed circuit boards with RAM chips attached) with more or faster memory, or if the RAM fails. A motherboard is designed to work with a specific maximum amount of RAM. You can't just keep adding as much as you want. There are also only a fixed number of RAM slots for you to add extra RAM sticks. You should always refer to the motherboard's technical specification before adding or changing RAM.
- In a computer system, ROM is usually talked about in terms of Megabytes. RAM is usually talked about in terms of Gigabytes. You really don't need much ROM - it's only used to hold the BIOS and booting up program. RAM, on the other hand holds all the programs and files you are running at any one time. The more you have, the faster your computer will run, generally speaking.