Primary Memory — RAM, ROM, SRAM and DRAM
Imagine the controller behind the lighting in a school theatre. It must remember how to start, yet it also needs to change brightness levels and cue timings during a performance. Those two demands call for different kinds of memory.
This lesson explores what each memory technology is for, how it preserves a bit, and why a designer chooses one type instead of another.
Learning goals
- Distinguish RAM from ROM using power loss, writing and typical purpose.
- Explain how capacitor-based DRAM retains data by refreshing stored charge.
- Explain how flip-flop-based SRAM holds a state without periodic refresh while powered.
- Justify when DRAM or SRAM is preferable using speed, density, capacity and cost.
1. Why does a processor need memory?
A processor executes instructions and operates on data. It needs a place from which it can obtain those instructions and values as it works. This is the job of primary memory. Memory and long-term file storage serve different purposes: a program saved on a storage drive is normally loaded into working memory before execution.
In the theatre controller, the current fade percentage is a frequently changing value. The instructions that initialise the controller, by contrast, must still exist after it has been unplugged. We therefore distinguish two broad groups:
| What is needed? | Suitable memory | Why? |
|---|---|---|
| A changing value while the controller operates | RAM | The program can read and replace the value repeatedly. |
| Instructions available immediately after power returns | ROM or another non-volatile firmware technology | The information remains stored through shutdown. |
Do not confuse these terms
Primary does not mean permanent. RAM and ROM are both taught as primary memory, despite behaving differently when power is removed. An SSD, meanwhile, is secondary storage, even though it also uses electronic memory cells.
2. RAM and ROM: the main contrast
RAM (Random Access Memory) is a read–write working area. Its contents can change many times as software runs; ordinary RAM loses its information when power is removed. ROM (Read Only Memory) is non-volatile: it stores information intended to remain available after power-off, usually read during ordinary operation.
| Question | RAM | ROM family |
|---|---|---|
| Does data survive loss of power? | No — volatile | Yes — non-volatile |
| Can software normally change it repeatedly? | Yes | Normally read during operation; some variants can be specially programmed again |
| What is it normally used for? | Current data, active program information and intermediate results | Firmware and instructions that must persist between starts |
Explain rather than label
“RAM is volatile” is a fact. A fuller explanation adds the consequence: changing values held only in RAM are lost after an unexpected shutdown, so data needed later must be stored elsewhere.
Terminology nuance: “random access” means an address can be selected directly, not that the processor selects locations at random. Also, the ROM family includes reprogrammable technologies explored in the next lesson.
3. Two different ways of making RAM
Both DRAM and SRAM are volatile RAM. The important difference is the electronic mechanism holding each bit.
DRAM: charge that must be maintained
A typical DRAM bit cell uses a tiny capacitor to hold electrical charge and a transistor to control access. Charge gradually leaks away. The memory controller must refresh the cells at intervals, restoring their stored states before they become unreliable.
Small cells mean high storage density and a comparatively low price per bit. DRAM is therefore widely used for large main-memory capacity.
SRAM: a maintained circuit state
SRAM uses a flip-flop-like circuit with two stable states representing 0 or 1. While the circuit receives power, feedback maintains the state without periodic refresh.
Each cell requires more circuitry, making SRAM less dense and more expensive per bit, but it generally offers shorter access times. It is commonly used in processor caches.
| Property | DRAM | SRAM |
|---|---|---|
| Bit storage | Charge on a capacitor | State of a flip-flop circuit |
| While powered | Periodic refresh required | No periodic refresh required |
| Speed, typically | Slower access | Faster access |
| Density and cost | More bits per area; lower cost per bit | Fewer bits per area; higher cost per bit |
| Typical use | Main memory | Cache memory |
A common trap
Static does not mean non-volatile. SRAM avoids refresh while power is present; it still loses its stored state when power is removed.
4. Make a design decision
A workstation needs a large area for running applications, so the density and lower cost of DRAM matter more than obtaining the very shortest access time for every byte. A processor's small cache instead prioritises access speed and can justify using SRAM.
Real systems use different memory types together. The objective is not to find one universally “best” technology, but to match the properties to a requirement.
A useful answer structure
Requirement → technical property → consequence. For example, an audio-mixing processor repeatedly needs a small group of instructions quickly; SRAM is appropriate for a cache because it has short access time, reducing delays compared with fetching everything from main memory.
5. Interactive Memory Lab
Predict the outcome before pressing the controls. The simulations deliberately simplify the electronic details and are intended to demonstrate principles, not exact hardware timings.
Memory Lab
Explore power loss, compare bit cells, and justify choices.
Will the data still be there after shutdown?
A theatre controller has a current lighting cue in working memory and a fixed start-up routine in non-volatile memory.
Start-up routine: initialise controller
Power is on. Change the cue, then predict what happens when you switch off.
DRAM charge compared with SRAM state
A simplified model of one stored 1. Each step represents the passage of time, not a specific number of milliseconds.
Charge: 100% · bit readable
State stays at 1 while powered.
Elapsed steps: 0
With refresh enabled, the DRAM cell is restored before the charge becomes too weak.
Teaching simplification: refresh occurs periodically, and the charge indicator is illustrative. A real DRAM controller reads/restores stored information; it cannot recover a bit after the information has become irretrievable.
Choose and explain
Read each original scenario, select an answer and check the reasoning. The challenge is self-marking practice, not an official exam question.
Question 1 of 5 · Score: 0
Choose an answer to reveal the explanation.
6. Apply what you know
Question A · Short explanation [3]
A ticket-validation terminal loses the number of visitors currently waiting when it is switched off. Its start-up instructions are still present at the next switch-on. Explain the different behaviour of the two types of primary memory.
Question B · Explain a mechanism [3]
Explain why a DRAM cell needs refreshing. Refer to the component that stores the bit, what happens to its stored quantity and how refreshing helps.
Question C · Justified comparison [4]
A new workstation needs a large amount of main memory and a small, very fast processor cache. Recommend DRAM or SRAM for each requirement and justify both recommendations.
Check your reasoning · suggested answer points
A: RAM is volatile and holds changing current information; ROM-family non-volatile memory retains initialisation instructions after power-off.
B: DRAM stores a bit as capacitor charge; leakage weakens the charge; periodic refresh restores the stored state before the information is lost.
C: Choose DRAM for large main memory because of density and lower cost per bit; SRAM for cache because it typically offers faster access, with small size making its higher cost manageable.
These are original guidance points, not an official Cambridge mark scheme.
7. Review
RAM: volatile, normally read and written frequently. ROM: non-volatile, normally read during operation. DRAM: charge-based, requires refresh, dense and relatively inexpensive. SRAM: flip-flop-based, no periodic refresh while powered, faster and more expensive per bit.
Exit question
Why is “SRAM does not need refreshing, so it is non-volatile” incorrect? State both the storage mechanism and the role of power in your explanation.
Next: PROM, EPROM, EEPROM and data buffering — how non-volatile contents can be programmed, and how temporary storage helps data move between components running at different rates.