An explanation of RAM, ROM and virtual memory

Memory is the area where the computer stores or remembers data. Memory provides the CPU with its instructions. There are different types of memory, and each one plays an important role in the running of a computer system. Memory is sometimes called primary memory.

Memory is either volatile or non-volatile. Volatile memory only stores information to run programs while the computer is on. It is reset and emptied once the computer is turned off. Volatile memory requires electricity to store data using transistors and capacitors.

There is a key difference between memory and storage. Programs are kept on a storage device and copied into the computer's memory before they are executed. Storage is also called secondary storage.

Storage and read only memory (ROM) use non-volatile memory to retain data - even when the computer has been switched off. In older computers, paper, punched tape and floppy disks have been used for non-volatile memory.

The following are all types of primary memory listed in order of closeness to the CPU:

  1. registers
  2. cache
  3. RAM
  4. virtual memory

The closer a memory type is to the CPU, the quicker the CPU can access the instructions and execute them. However, the closer it is to the CPU the smaller and more expensive it is. Each type of memory is limited by their speed, size, cost and position in relation to the CPU.

CPU registers are the fastest, smalles and most expensive kind of memory. Hard disks are the slowest, largest and least expensive kind

Latency is the time it takes for components to respond to a request. There will be a short delay, even a few milliseconds between asking the computer to execute a program and it finding the files in the memory. The circuitry that makes up primary memory is very fast, but not as fast as the CPU clock speed. Some instructions are copied into cache to make them more quickly available to the CPU.