Memory: RAM, ROM and Cache
Why This Matters
# Memory: RAM, ROM and Cache - Summary This lesson covers the three primary types of computer memory and their distinct functions within the von Neumann architecture. Students learn that RAM (Random Access Memory) is volatile, high-capacity memory for temporary data storage during program execution; ROM (Read-Only Memory) is non-volatile memory storing permanent instructions like BIOS; and cache memory is extremely fast, small-capacity memory that reduces CPU-RAM access time by storing frequently used instructions. Understanding the hierarchy, characteristics (volatility, speed, capacity, cost), and practical applications of each memory type is essential for exam questions on system architecture, performance optimization, and the fetch-execute cycle.
Key Words to Know
Core Concepts & Theory
Memory forms the crucial data storage hierarchy in computer systems, with three primary types serving distinct purposes.
RAM (Random Access Memory) is volatile memory that temporarily stores data and instructions currently in use. Cambridge defines volatility as the property where memory contents are lost when power is removed. RAM provides fast read/write access to any location (hence 'random access') and acts as the computer's working space. Modern systems use DRAM (Dynamic RAM), requiring constant refreshing, or SRAM (Static RAM), which is faster but more expensive.
ROM (Read-Only Memory) is non-volatile memory containing permanent instructions that cannot be easily modified. The BIOS (Basic Input/Output System) or UEFI firmware resides in ROM, providing boot-up instructions and hardware initialization routines. Types include:
- PROM: Programmable once
- EPROM: Erasable via UV light
- EEPROM/Flash: Electrically erasable and reprogrammable
Cache Memory is extremely fast, expensive memory positioned between the CPU and RAM to reduce the von Neumann bottleneck. It exploits the principle of locality:
- Temporal locality: Recently accessed data will likely be accessed again soon
- Spatial locality: Data near recently accessed locations will likely be needed
Cache operates in levels: L1 (smallest, fastest, on-chip), L2 (larger, slightly slower), and L3 (largest, shared between cores). The cache hit ratio measures effectiveness:
Hit Ratio = (Cache Hits) / (Total Memory Accesses)
Cambridge Key Point: Memory hierarchy balances speed, cost, and capacity - faster memory is more expensive per byte, requiring strategic organization.
Detailed Explanation with Real-World Examples
Think of memory hierarchy as a library system analogy: ROM is like reference books permanently kept behind the desk (rarely changed, always available), RAM is your study desk with books you're actively using (cleared when you leave), and cache is like keeping your most-used textbook open right in front of you.
Real-World RAM Applications: When you open a web browser, the application code loads from the hard drive into RAM. As you open multiple tabs, each webpage's content, images, and JavaScript occupy RAM space. If you have 8GB RAM and open too many tabs, the system begins paging - swapping data between RAM and slower storage, causing noticeable slowdown. Modern smartphones manage RAM aggressively, closing background apps to prevent this.
ROM in Everyday Devices: Your smartphone's ROM stores the bootloader that initializes the device when you press the power button. In embedded systems like washing machines, ROM contains the control program for different wash cycles. Gaming consoles use ROM cartridges (historically) to store unchangeable game code, ensuring consistency across millions of copies.
Cache in Action: Consider video editing: when scrubbing through a timeline, the CPU repeatedly accesses the same video frames. Cache stores recently viewed frames, providing instant access rather than fetching from RAM each time. This explains why the second playthrough of a video section feels smoother - temporal locality in action!
CPU Performance Impact: Intel's i9 processors include up to 36MB L3 cache, while budget processors have 4-6MB. In gaming benchmarks, this difference can mean 10-15% performance variation in CPU-intensive titles, demonstrating cache's critical role in modern computing performance.
Worked Examples & Step-by-Step Solutions
Example 1: Cache Performance Calculation
Question: A CPU makes 10,000 memory accesses. 8,500 are found in cache (hits), while 1,500 require RAM access (misses). Calculate the hit ratio and explain the performance implications.
Solution: Hit Ratio = Cache Hits / Total Accesses = 8,500 / 10,000 = 0.85 or 85%
Miss Ratio = 1 - Hit Ratio = 15%
Examiner Note: Always express as both decimal and percentage. Explain that 85% hit ratio means most accesses complete in ~1 nanosecond (cache), while 15% take ~100 nanoseconds (RAM), significantly impacting overall performance.
Example 2: Memory Hierarchy Selection
Question: A manufacturer designs an embedded medical device requiring: (a) program storage that survives power loss, (b) temporary patient data storage during monitoring, (c) fast instruction access. Recommend appropriate memory types with justification. [6 marks]
Solution: (a) ROM/Flash memory [2 marks] - Justification: Non-volatile storage ensures critical medical software persists without power; Flash allows firmware updates for safety improvements.
(b) RAM [2 marks] - Justification: Volatile memory suitable for temporary data; erased when device powers down, protecting patient privacy.
(c) Cache memory [2 marks] - Justification: Positioned between CPU and RAM to reduce latency when executing time-critical monitoring algorithms.
Examiner Note: Cambridge expects technical terminology (volatile/non-volatile) and context-specific justification linking memory properties to application requirements.
Common Exam Mistakes & How to Avoid Them
Mistake 1: Confusing Volatile/Non-Volatile Properties
Error: "ROM is volatile because it can be rewritten in Flas...
Cambridge Exam Technique & Mark Scheme Tips
Command Word Mastery:
"State/Identify" (1 mark): Brief answer without justification. Example: "State one char...
2 more sections locked
Upgrade to Starter to unlock all study notes, audio listening, and more.
Exam Tips
- 1.Clearly differentiate between **volatile** and **non-volatile** memory, providing examples for each (RAM is volatile, ROM is non-volatile).
- 2.Explain the **purpose and function** of each memory type (RAM for active data, ROM for boot-up, Cache for speed optimisation).
- 3.Be able to describe the **memory hierarchy** and explain *why* it is implemented (balancing speed, cost, capacity, and exploiting locality of reference).
- 4.When asked about cache, mention its **levels (L1, L2, L3)** and how they contribute to performance by reducing access time to main memory.
- 5.Understand the role of **BIOS/UEFI** and how ROM is essential for the computer's initial startup process.