- Practice
- About 13 min
- 5 practice questions
Primary memory: RAM, ROM, cache and their types
Separate volatile from non-volatile memory, name the types of RAM and ROM and order registers, cache, RAM and disk by speed and size.
If something looks wrong, please tell us.
Memory questions are among the most reliable in a computer-awareness paper. They come in a few styles: which memory loses its contents, which memory holds start-up instructions, and which is fastest. A single comparison table and one ordering cover nearly all of them.
Volatile and non-volatile
Volatile memory loses its contents when the power is switched off. Non-volatile memory keeps them. Primary memory is the memory the CPU can reach directly, and it includes RAM, ROM and cache.
| Memory | Volatile? | Read/write | Typical job |
|---|---|---|---|
| RAM (Random Access Memory) | Yes | Read and write | Holds the programs and data in use right now |
| ROM (Read Only Memory) | No | Normally read only | Holds start-up instructions (firmware) |
| Cache | Yes | Read and write | Very fast store between the CPU and RAM |
| Registers | Yes | Read and write | Tiny stores inside the CPU |
Types of RAM and ROM
- SRAM (static RAM): very fast and costly; does not need refreshing; used for cache.
- DRAM (dynamic RAM): slower and cheaper; must be refreshed constantly; used as the main memory.
- PROM: programmable once by the user after manufacture.
- EPROM: can be erased with ultraviolet light and reprogrammed.
- EEPROM: can be erased and rewritten electrically, without taking it out of the device.
The memory hierarchy
From the fastest, smallest and most costly per byte, to the slowest, largest and cheapest per byte: registers, cache, RAM, secondary storage (such as a hard disk or SSD). The CPU works with the top of the list, while the bottom holds files for the long term.
Worked examples
Example 1. A computer is switched off suddenly and an unsaved document is lost. Which memory held it? RAM, because RAM is volatile. A saved file survives because it was written to secondary storage.
Example 2. Where are the instructions that run when you switch the computer on? In ROM, which is non-volatile and keeps the start-up program (the firmware) even without power.
Example 3. Arrange in order of speed, fastest first: hard disk, cache, RAM, register. Register, cache, RAM, hard disk.
Example 4. A computer has 8 GB of RAM and each running program in this example needs 512 MB. How many such programs fit in RAM at once? 8 GB = 8 × 1024 = 8192 MB, and 8192 / 512 = 16 programs. The figures are illustrative, because the operating system also needs memory.
Example 5. Name the ROM variant that can be erased with ultraviolet light. EPROM. The one erased with electricity is EEPROM, and the one programmed only once is PROM.
RAM is working memory and is volatile. ROM keeps start-up code and is not. Cache sits between CPU and RAM.
Traps
- Do not call RAM permanent storage. Saving a file moves it to a disk.
- Cache is not secondary storage; it is a small fast memory near the CPU.
- Registers are inside the CPU, cache is near or inside it, RAM is on separate chips.
- Adding RAM does not make the processor faster; it lets more programs and data stay in memory.
Key takeaways. RAM and cache are volatile; ROM is not. SRAM is fast and used for cache; DRAM is the main memory. PROM, EPROM and EEPROM differ in how they are erased. Speed falls and size grows as you move from registers to disk.
Check your understanding
-
1. Which memory loses its contents when the power is switched off?
- ROM
- RAM
- EPROM
- Hard disk
Show answer
Answer: B. RAM is volatile. ROM and disks keep their contents without power.
-
2. Which type of ROM is erased using ultraviolet light?
- PROM
- EEPROM
- EPROM
- DRAM
Show answer
Answer: C. EPROM is erased by ultraviolet light; EEPROM is erased electrically.
-
3. Which of these is the fastest?
- Register
- Cache
- RAM
- Hard disk
Show answer
Answer: A. Registers sit inside the CPU and are the fastest storage of all.
-
4. SRAM is commonly used for:
- Main memory
- Hard disks
- Start-up code
- Cache
Show answer
Answer: D. SRAM is very fast, so it is used for cache memory. DRAM is used for main memory.
-
5. 8 GB of RAM is shared equally between programs that need 512 MB each. How many programs is that?
- 16
- 8
- 32
- 64
Show answer
Answer: A. 8 GB = 8192 MB. 8192 / 512 = 16.
Sign in to keep track of the lessons you finish.