The need for primary storage
Primary storage is memory the CPU can access directly and very quickly. It usually consists of RAM and ROM.
Why computers need it: the CPU works far faster than secondary storage. If it had to read every instruction from a hard disk or SSD it would spend almost all its time waiting. Primary storage holds the programs and data currently in use, close enough and fast enough to keep the CPU busy.
- Primary storage
- memory the CPU can access directly and very quickly, usually consisting of RAM and ROM, which holds the programs and data currently in use
RAM and ROM
Why ROM has to exist at all is worth understanding rather than memorising. When a computer is switched on, RAM is empty — it is volatile, so it lost everything when the power went off. Something has to tell the computer how to start and where to find the operating system. That something must survive a power cut, so it cannot be in RAM. It is held in ROM, and the program is usually called the bootstrap or boot program.
So the sequence at start-up is: the CPU reads the boot program from ROM, which locates the operating system on secondary storage and loads it into RAM, after which the computer runs normally.
- RAM
- Random Access Memory: volatile primary storage holding the programs and data currently in use, which loses its contents when the power goes off
- ROM
- Read Only Memory: non-volatile primary storage holding the instructions a computer needs to start up, which survive a power cut
- Volatile
- describes memory that loses its contents when the power is switched off
Virtual memory and cache
Virtual memory is used when RAM is full. The specification asks both why it may be needed and how it works.
Why it is needed: a computer may have more programs and data open than will fit in RAM. Without virtual memory, no further program could be opened.
How it works: the operating system moves data that is not currently being used out of RAM and onto secondary storage, freeing space in RAM for what is needed now. When the moved data is needed again, it is transferred back into RAM — and something else is moved out to make room.
The consequence, which questions usually want: secondary storage is far slower than RAM, so this transferring takes time. A computer relying heavily on virtual memory slows down noticeably. Adding more RAM reduces the need for it.
Cache is a small amount of extremely fast memory inside or very close to the CPU. It holds frequently used instructions and data so that the CPU does not have to fetch them from RAM every time.
The pattern to notice across this sub-topic: each level exists because the level below it is too slow. Cache exists because RAM is slow compared with the CPU; virtual memory exists because RAM is too small; and secondary storage exists because RAM is volatile and expensive.
Worked example
A computer becomes very slow when many programs are open. Explain why, and suggest an improvement.
- Identify the cause: with many programs open, RAM fills up.
- The operating system then uses virtual memory, moving data that is not currently in use out to secondary storage.
- Secondary storage is much slower than RAM, so every transfer takes significant time.
- The more this happens, the more time the computer spends moving data rather than doing work — so it slows down.
- The improvement follows directly from the cause.
Answer: RAM is full, so the operating system is using virtual memory — repeatedly transferring data between RAM and much slower secondary storage. Installing more RAM would let more programs stay in memory at once, reducing how often virtual memory is needed.
Common mistake
Virtual memory is not extra RAM and it is not faster than RAM. It is space on secondary storage used as an overflow, and using it makes the computer slower, not quicker.
- Virtual memory
- secondary storage used as if it were RAM when RAM is full; the operating system moves data that is not currently being used out to disk to make room
- Cache
- a small amount of very fast memory close to the CPU, holding frequently used instructions and data so the CPU waits less
Before you practise
- Primary storage is memory the CPU accesses directly, and usually consists of RAM and ROM.
- It exists because secondary storage is far too slow to keep the CPU supplied.
- RAM is volatile, large, read and written constantly, and holds what is running now.
- ROM is non-volatile, small, read-only in use, and holds the boot program.
- ROM is needed because RAM is empty at switch-on and something must tell the computer how to start.
- Virtual memory is used when RAM is full: unused data is moved to secondary storage and back when needed.
- Because secondary storage is slow, relying on virtual memory slows the computer — more RAM is the fix.
- Cache is very fast memory in the CPU holding frequently used instructions and data.