Main Memory
RAM and ROM; Cache Memory and the Memory Hierarchy; How the CPU Uses Main Memory
On this page6 sections
- 01Learning Objectives
- 02RAM and ROM
- 03Cache Memory and the Memory Hierarchy
- 04How the CPU Uses Main Memory
- 05Practical Work
- 06Scenario-Based Questions
Learning Objectives
- Distinguish between RAM and ROM.
- Describe cache memory and the memory hierarchy.
- Explain how the processor uses main memory.
- Explain why a computer uses virtual memory.
RAM and ROM
Main memory is the primary working memory inside a computer that the CPU accesses directly. It stores the instructions and data that the CPU is currently working with. Without main memory, the CPU would have no instructions to execute and no data to process. The two main categories of main memory are RAM and ROM, and each serves a different purpose.
RAM (Random Access Memory) is volatile memory, meaning it loses all its contents when the computer is switched off. It temporarily holds the programmes and data that are currently in use. When you open a web browser, a Word document or a game, its contents are loaded from secondary storage into RAM so that the CPU can access them quickly. There are two main types of RAM. DRAM (Dynamic RAM) is the most common type used in personal computers. It stores each bit of data in a tiny capacitor that leaks charge over time, so it must be refreshed thousands of times per second to maintain its data. DRAM is relatively cheap and dense, which is why it is used for the main system memory in laptops and desktops. A typical school computer in Abuja may have 4 GB or 8 GB of DRAM. SRAM (Static RAM) uses flip-flop circuits to store each bit and does not need refreshing. It is much faster than DRAM but also more expensive and takes up more space on the chip. Because of its speed, SRAM is used for cache memory rather than as the main system RAM.
ROM (Read-Only Memory) is non-volatile memory, meaning it retains its contents even when the power is switched off. It stores the permanent instructions the computer needs to start up, such as the BIOS (Basic Input/Output System) or UEFI firmware. ROM is called read-only because under normal operation the CPU can read from it but cannot easily write new data to it. When you press the power button on a school computer, the ROM provides the first set of instructions that tell the CPU how to initialise the hardware, check memory and load the operating system from the hard drive. Some modern forms of ROM, such as EEPROM and flash memory, allow limited writing, which is how firmware updates work.
Virtual memory means space on storage used as extra memory when RAM is full.
Cache Memory and the Memory Hierarchy
Cache memory is very fast, small memory located on or very close to the CPU chip. It stores copies of frequently accessed data and instructions from RAM so that the CPU can retrieve them much faster than going to main memory every time. There are typically three levels of cache. L1 cache is inside each CPU core, very small (32 KB to 256 KB) and the fastest. L2 cache is inside or near each core, larger (256 KB to 1 MB) and very fast. L3 cache is shared among all cores, the largest (2 MB to 64 MB), fast but slower than L1 and L2.
When the CPU needs data, it checks L1 first. If the data is there, this is called a cache hit and the data is retrieved instantly. If it is not there, this is called a cache miss, and the CPU then checks L2, then L3, and finally goes to RAM. The closer the data is to the CPU, the faster it can be used. Memory in a computer is arranged in a hierarchy from the fastest, smallest and most expensive at the top to the slowest, largest and cheapest at the bottom. CPU registers are at the top, followed by L1, L2 and L3 cache, then main memory (RAM) with 4 GB to 32 GB, and secondary storage (hard drives and SSDs) at the bottom with 256 GB to several terabytes. The hierarchy exists because fast memory is expensive. By keeping the most used data close to the CPU in cache and the rest in RAM or on disk, the computer achieves a good balance of speed and capacity.
Addressable memory refers to the total amount of memory that the CPU can uniquely address using memory addresses. The number of bits in the address bus determines how many unique addresses the CPU can create. A 32-bit address bus can address up to 2 to the power of 32 bytes, which is about 4 GB of RAM. A 64-bit address bus can address far more, theoretically up to 16 exabytes. If a school computer has 8 GB of RAM installed but the operating system only supports 32-bit addressing, it may only be able to use 4 GB of that RAM.
Memory hierarchy means the order of memory from the fastest and smallest to the slowest and largest.
How the CPU Uses Main Memory
During the fetch-execute cycle, the CPU uses main memory at several points. During the fetch step, the Program Counter sends the address of the next instruction to the MAR, which places it on the address bus. The instruction is then read from RAM into the MDR and placed in the Instruction Register. During the decode and execute steps, if the instruction requires data, the data address is sent to the MAR and the data is fetched from RAM into the MDR. During the store step, results are written back to RAM by placing the address in the MAR and the data in the MDR, with a write signal sent on the control bus. Cache speeds up this entire cycle by keeping frequently used instructions and data close to the CPU, reducing the need to wait for slower RAM accesses.
| Term | Meaning |
|---|---|
| Main memory | The primary working memory that the CPU accesses directly to store and retrieve instructions and data |
| RAM | Random Access Memory, volatile memory that temporarily holds data and instructions for active tasks |
| DRAM | Dynamic RAM, a common type that needs to be refreshed thousands of times per second |
| SRAM | Static RAM, a faster and more expensive type used for cache, no refreshing needed |
| ROM | Read-Only Memory, non-volatile memory holding permanent instructions such as boot-up |
| Cache memory | Very fast, small memory on or near the CPU that stores frequently accessed data |
| Memory hierarchy | The arrangement from fastest and smallest (registers) to slowest and largest (secondary storage) |
| Addressable memory | The total amount of memory the CPU can uniquely address using memory addresses |
| Volatile | Memory that loses its contents when the computer is switched off |
| Non-volatile | Memory that retains its contents even when the computer is switched off |
Practical Work
- Draw a table comparing RAM and ROM.
- Arrange cache, RAM, and storage in order of speed.
- Explain why cache is placed close to the processor.
- Describe what happens when RAM is full.
Scenario-Based Questions
- A student opens a web browser, a Word document and a game at the same time on a computer with 4 GB of RAM. Explain why these programs must be loaded from secondary storage into RAM before the CPU can use them, and what happens to their contents when the computer is switched off.
- A technician is choosing between DRAM and SRAM for different roles inside a computer. Compare DRAM and SRAM in terms of speed, cost and typical location inside the computer.
- A school purchases new desktops with 8 GB of RAM. The technician says a 32-bit operating system would not use all of it. Explain why a 32-bit OS can address at most 4 GB and how a 64-bit OS solves this.
- When a computer starts up, it first loads instructions from ROM. Explain what BIOS or UEFI does during boot and why ROM is used instead of RAM for this purpose.
- A developer is designing a system and must choose between L1, L2 and L3 cache. Explain the memory hierarchy from L1 to main memory and why faster cache is always smaller.
- During the fetch-execute cycle, the CPU copies an instruction address from the PC into the MAR. Explain why the MAR and MDR are needed rather than sending data directly between the PC and the CPU.
- A student says RAM is faster than ROM so ROM should be replaced with RAM. Explain why this would prevent the computer from starting up and why both types of memory are necessary.
LEARNING OBJECTIVES: BY THE END OF THE LESSON STUDENTS SHOULD BE ABLE TO:
| Cognitive | i. Distinguish between RAM and ROM. ii. Describe cache memory and the memory hierarchy. iii. Explain how the processor uses main memory. iv. Explain why a computer uses virtual memory. |
| Affective | i. Appreciate the value of Main Memory in school, at home and in the community. ii. Show willingness to use digital tools carefully, safely and responsibly. |
| Psychomotor | i. Draw a table comparing RAM and ROM. ii. Arrange cache, RAM, and storage in order of speed. iii. Explain why cache is placed close to the processor. iv. Describe what happens when RAM is full. |
Rationale: Main memory is the primary working memory inside a computer that the CPU accesses directly. Understanding rAM and ROM, cache Memory and the Memory Hierarchy, how the CPU Uses Main Memory helps learners use digital technology confidently, safely and responsibly.
Pre-requisite Knowledge: In Week 1, learners studied Review and Computer Architecture, including review of Computer System and IPO Model, computer Architecture and the CPU, the System Bus and the Fetch-Execute Cycle. The knowledge from that week is used again in this lesson.
Learning Material/Teaching Aid: Whiteboard, markers, computer or laptop where available, printed notes and charts on Main Memory, practical task sheets, learners' notebooks and pens.
Reference Materials: Digital Technology for Senior Secondary Schools (SS 2); NERDC Digital Technology Curriculum; Digital Technology SS 2 First Term Notes (Week 2); First Term examination and Continuous Assessment question papers.
LESSON DEVELOPMENT
| Stage/Step (Time) | Teacher's Activities | Student's Activities | Learning Points |
|---|---|---|---|
| Introduction 5 MINUTES | Welcomes learners, revises Week 1 (Review and Computer Architecture) with two quick oral questions, and asks what they already know about Main Memory. Elicits responses and writes the topic on the board. | Recall the previous lesson and share what they already know about Main Memory. | Connecting prior knowledge to Main Memory. |
| Step 1 8 MINUTES | Covers RAM and ROM: Main memory is the primary working memory inside a computer that the CPU accesses directly. It stores the instructions and data that the CPU is currently working with. Without main memory, the CPU would have no instructions to execute and no data to process. | Listen, take notes and answer oral questions on "RAM and ROM". | Understanding: RAM and ROM. |
| Step 2 8 MINUTES | Covers Cache Memory and the Memory Hierarchy: Cache memory is very fast, small memory located on or very close to the CPU chip. It stores copies of frequently accessed data and instructions from RAM so that the CPU can retrieve them much faster than going to main memory every time. There are typically three levels of cache. | Copy the key points, give examples from school and everyday life, and ask questions on "Cache Memory and the Memory Hierarchy". | Understanding: Cache Memory and the Memory Hierarchy. |
| Step 3 8 MINUTES | Covers How the CPU Uses Main Memory: During the fetch-execute cycle, the CPU uses main memory at several points. During the fetch step, the Program Counter sends the address of the next instruction to the MAR, which places it on the address bus. The instruction is then read from RAM into the MDR and placed in the Instruction Register. | Discuss in pairs, then report one point on "How the CPU Uses Main Memory" to the class. | Understanding: How the CPU Uses Main Memory. |
| Practical Work 6 MINUTES | Guides learners through the practical work: (i) Draw a table comparing RAM and ROM. (ii) Arrange cache, RAM, and storage in order of speed. (iii) Explain why cache is placed close to the processor. Moves round the class to check progress and correct unsafe or careless use. | Carry out the practical tasks individually or in pairs and record what they did in their notebooks. | Applying the lesson through hands-on practice. |
| Evaluation 3 MINUTES | Asks learners to: i. Distinguish between RAM and ROM. ii. Describe cache memory and the memory hierarchy. iii. Explain how the processor uses main memory. iv. Explain why a computer uses virtual memory. | Respond verbally and in writing to the evaluation questions. | Assessment and consolidation of the lesson content. |
| Conclusion 2 MINUTES | Recaps the main points: rAM and ROM, cache Memory and the Memory Hierarchy, how the CPU Uses Main Memory. Links them to the assignment and previews Week 3: Secondary Storage. | Listen, ask questions and copy the assignment. | Reinforcement of key concepts and a preview of the next lesson. |
Assignment: i. A computer's CPU is slowed by frequent trips to memory, and its owner notices that only 4 GB of an installed 8 GB is being used. Explain cache memory and the memory hierarchy, and explain the address limit. ii. A computer loses an unsaved document when it is switched off, and it starts up correctly every morning. Explain main memory, RAM and ROM, and state the difference between DRAM and SRAM.
On this page9 sections
- 01Lesson objectives
- 02Key vocabulary
- 03Common misconceptions
- 04Teacher activities
- 05Student activities
- 06Practical / learning evidence
- 07Resources and preparation
- 08Assessment for learning
- 09Inclusion and homework
Lesson objectives
By the end of the week, learners should be able to:
- Define primary memory and secondary memory in their own words.
- Name three types of RAM and state volatility for each.
- Explain caching as temporary faster access to frequently used data.
- Compare SRAM and DRAM on speed and cost.
- Map a program execution path onto main memory stages.
Key vocabulary
- Memory: working space holding programs and data currently in use.
- Main memory: memory inside the CPU accessible directly.
- Secondary memory: storage kept off the CPU bus.
- Volatile: loses contents when power is removed.
- SRAM: static RAM holding data without refresh cycles.
- DRAM: dynamic RAM requiring regular refreshes.
- Cache: very fast temporary storage nearby the CPU.
- Refresh cycle: repeated reads keeping DRAM data current.
- Execution path: the sequence of memory locations accessed during a run.
Common misconceptions
- "RAM holds my files permanently." RAM holds work in progress and clears at shutdown.
- "Cache stores permanent data." Cache is temporary and cleared once the data moves elsewhere.
- "SRAM and DRAM do the same things." SRAM is faster but more expensive than DRAM.
Teacher activities
- Starter: ask where your running spreadsheet data sits temporarily while you use it.
- Define main and secondary memory with one example each.
- Name three types of RAM and note their volatility.
- Explain caching as faster access for frequently used data.
- Compare SRAM and DRAM on speed and cost with a simple analogy.
- Map a simple program execution onto main memory stages.
Student activities
- Answer the starter and identify main versus secondary memory.
- Define main and secondary memory in their own words.
- Name three types of RAM and state volatility for each in one sentence.
- Explain caching in one paragraph tied to frequent access.
- Compare SRAM and DRAM on speed and cost with brief reasoning.
- Map a program execution onto main memory stages showing data movement.
Practical / learning evidence
A three-RAM type chart with volatility and a SRAM versus DRAM comparison, plus a one-page caching explanation. Hand in both for marking.
Resources and preparation
Printed charts, blank diagrams and sample program execution traces. Offline route: paper versions, no device needed. Display any hardware carefully and keep tools out of reach.
Assessment for learning
Inspect the three-RAM chart for correct volatile states. Mark the SRAM versus DRAM comparison for correct tradeoffs. Check the caching explanation for a sensible analogy. Flag any learner who says cache stores files permanently.
Inclusion and homework
Provide the three-RAM chart prefilled for learners who need scaffolding and allow oral comparison. Extend confident learners with five RAM types and a four-stage execution map. Homework: name two places in your school lab that use cache and state why they need it.