Memory in a computer system refers to the components that store (or remember!) things. There are different types of memory with different purposes. Some are very fast and expensive such as the cache memory discussed earlier, and some are cheaper and slower such as the memory sticks you probably use at school. These different types of memory have different characteristics and can be compared in terms of their access speed (how quickly you can read from them or write to them), their price and the whether they can store data when the power is turned off (volatility). Let’s consider some common types of memory in computer systems:
Random Access Memory (RAM)
RAM is the type of memory used in the computer’s main memory. Many people say “RAM” when they mean main memory. Nothing in a computer is really “random” so random access just refers to the fact that you can write anywhere in that memory space at any time, you don’t have to put the next thing straight after the last one like you do on a magnetic tape, for example.
When a program is running it has to be loaded from the hard disk into the main memory so the processor can access the instructions. Any data needed for that program to run is also loaded into main memory while the program is running. The main purpose of RAM is to act as temporary storage for programs and data, just for the duration of that program. Once the program has finished and is closed, it is no longer in main memory.
So why doesn’t the processor get the instructions straight from the disk? It is about access speed. Reading from and writing to a hard disk is very slow compared to the speed of the processor. Just as we used the high speed cache between the processor and main memory we need main memory to store the programs currently in use or the computer would be really slow.
As every program in use should, ideally, be in main memory while it runs, the amount of main memory also affects the performance of the computer. If a computer system has lots of programs running at the same time it needs lots of main memory.
Common Types of RAM:
Address Line = A line of microscopic conductive material on the RAM chip, it identifies where specifically on the chip the data is to be stored to. It has a transistor which will open when electricity flows down the line.
Data Line = The identity of memory at each specific location on the chip.
Transistor = A microscopic electronic switch.
Capacitor = Device that stores electricity.
Electric Pulse = Represented as 1 bit when charging the capacitor. No charge is 0 bit.
Firstly, the Software/Operating System sends a pulse of electricity along an address line. The electric signal instructs where on the chip the data is to be stored to. When electricity is flowing down the address line, the pulse will turn ON/Close a transistor. No pulse will leave the transistor OFF/Open. The Software/Operating System then sends a pulse of electricity along the data line. When the pulse down the data line crosses the address line that is ON, it knows to store the data at that location. The pulse then flows through the transistor at this point, and charges the capacitor (which stores the data). The process repeats continuously to refresh the capacitor's charge. If the capacitor looses charge, then the data is lost (ie. When the machine is shutdown).
The Software/Operating System sends another electric pulse along an address line. When the pulse is sent, the transistor connected to it is turned to ON/Close. Anywhere along the address line where a capacitor is holding a charge, those capacitors will discharge through the closed transistors. This sends a pulse up through the data line. The Software/Operating System will recognise which data line sent the pulse and interprets each of them as 1 bit. So, on any line where a pulse is lacking it indicates 0 bit. The Software/Operating System then uses the combination of the eight data lines bit's, to form a byte.
Sometimes there just isn’t enough main memory for all the programs that need to run. Computers can be configured so part of the hard disk behaves like main memory. This is called virtual memory. The access speed on a hard disk is much slower than the speed of RAM so this isn’t ideal. It is used to store parts of programs currently being run but the parts actually being executed still need to be in main memory. As the processor gets to the next part of the program, sections are swapped between virtual memory and main memory. Sometimes this works well but sometimes the computer spends more fetch-execute cycles swapping bits around than it does executing a program.
When you are in the middle of a piece of work at school and your “friend” turns the computer off you will notice that you lose the work you did since you last saved! This is because the saved version goes onto the hard disk but the most recent version was only in main memory/RAM when the power went off. RAM is described as volatile, it loses its contents if there is no power. The hard disk is designed for long term storage of files and is non-volatile memory.
Read only memory (ROM)
RAM is volatile so when you turn off your computer it loses its contents. When you turn the computer back on it needs to get the basic startup routine from somewhere that is not volatile! The operating system and all your programs will be stored on the hard disk but these need to be loaded into RAM to run.
The computer has a piece of software called the bootstrap loader. This is a small program that loads the operating system (BIOS). Once the operating system is loaded it takes care of the rest. The term comes from the idea that when you’re not doing very well in life you can “pull yourself up by your bootstraps”! In this day and age you’re more likely to hear “sort yourself out” but the meaning is the same - you are in effect getting yourself restarted. Bootstrapping became abbreviated to booting, a term you have probably heard before. To “boot” a computer is to start it up from scratch.
ROMRead Only Memory; you cannot write over the contents once it has been created (without a specific piece of software to flash the BIOS). It is also non-volatile; you can leave the computer switched off for months and it will still start up as soon as it has power again. The ROM stores the instructions becuase it has a separate power source, the small battery often seen on a desktop motherboard. RAM on the other hand is only used for temporary storage of programs and data when they are running. RAM is read-write and volatile.
Main memory is also known as Primary Memory or Immediate Access Store. Memory is all about storage so, strictly speaking, storage devices such as hard disks are also a type of memory. These long-term, non-volatile types of storage are also called Secondary Memory. Typically a PC will have a hard disk that stores all the files long term but secondary memory/storage also includes memory sticks, floppy disks (seldom used these days), tapes and CDs.