Memory: Key Concepts for IB & AQA Computer Science | IB/AQA 计算机:存储器 考点精讲

📚 Memory: Key Concepts for IB & AQA Computer Science | IB/AQA 计算机:存储器 考点精讲

Understanding how memory works is fundamental to grasping computer architecture. In both IB and AQA specifications, memory topics cover the hierarchy from fast registers to long-term storage, the distinction between volatile and non-volatile memory, caching principles, and virtual memory management. This article breaks down every key concept you need for exam success.

理解存储器的工作原理是掌握计算机体系结构的基础。在 IB 和 AQA 的考纲中,存储器主题涵盖从快速寄存器到长期存储的层次结构、易失性与非易失性的区分、缓存原理以及虚拟内存管理。本文拆解每一个关键概念,助你考试成功。


1. The Role of Memory in Computer Architecture | 存储器在计算机架构中的作用

The central processing unit (CPU) requires both instructions and data to be stored in memory that it can access quickly. Memory in a computer system serves as a temporary or permanent storage for the data and programs needed during execution.

中央处理器 (CPU) 需要将指令和数据存储在可以快速访问的存储器中。计算机系统中的存储器充当执行期间所需数据和程序的临时或永久仓库。

Memory is organised at multiple levels, each offering a different trade-off between speed, capacity, and cost. Without memory, the CPU would have no place to fetch instructions, and no processor can function without at least some form of memory, even if it is just registers.

存储器按多个层次组织,每一层都在速度、容量和成本之间提供不同的权衡。如果没有存储器,CPU 就没有地方取得指令;没有任何处理器可以在完全没有某种形式存储器(哪怕只有寄存器)的情况下工作。

The control unit in the CPU manages the flow of data between registers, main memory, and input/output devices. In the fetch-decode-execute cycle, addresses are sent out on the address bus, and data travels along the data bus to and from memory.

CPU 中的控制单元管理寄存器、主存和输入/输出设备之间的数据流。在“取指-译码-执行”周期中,地址通过地址总线发送,数据沿数据总线在存储器与 CPU 之间往返。

IB students are expected to outline the use of primary and secondary memory; AQA candidates need to explain the need for different types of memory and their role in the stored-program concept.

IB 学生需要概述主存和辅助存储器的使用;AQA 考生需要解释对不同类型存储器的需求以及它们在存储程序概念中的作用。


2. The Memory Hierarchy | 存储器层次结构

The memory hierarchy organises storage technologies in a pyramid. At the top are the fastest and most expensive components, and at the bottom are the cheapest and slowest but most capacious devices. The hierarchy, from top to bottom, usually includes registers, cache (L1, L2, L3), main memory (RAM), and secondary storage (SSD, HDD).

存储器层次结构将存储技术组织成金字塔形。塔尖是最快、最昂贵的部件,底部是最便宜、最慢但容量最大的设备。层次从高到低通常包括寄存器、高速缓存 (L1, L2, L3)、主存 (RAM) 和辅助存储 (SSD、HDD)。

Each level acts as a buffer for the level below it. The principle of locality allows a small amount of fast memory to satisfy most of the CPU’s requests, dramatically improving overall performance.

每一层都充当其下一层的缓冲。局部性原理使得少量高速存储器就能满足 CPU 的大部分请求,从而大幅提升整体性能。

Key characteristics that vary across the hierarchy are access time, cost per bit, and capacity. Registers have an access time of about 1 ns, cache 2–20 ns, main memory 50–100 ns, and secondary storage can take milliseconds.

层次结构中变化的关键特征是访问时间、每比特成本和容量。寄存器的访问时间约为 1 ns,缓存为 2–20 ns,主存为 50–100 ns,而辅助存储可能达到毫秒级。

Level Technology Typical Access Time Typical Capacity
Registers Flip-flops inside CPU ~1 ns Bytes
L1 Cache SRAM ~1–2 ns 64 KB per core
L2 Cache SRAM ~5–10 ns 256 KB–512 KB
L3 Cache SRAM ~10–20 ns Several MB
Main Memory DRAM ~80 ns Several GB
SSD NAND Flash ~0.1 ms Hundreds of GB–TB
HDD Magnetic disk ~5–10 ms Several TB

The table above summarises the classic memory hierarchy. IB and AQA exam questions frequently ask you to justify why multiple levels of memory are necessary.

上表总结了经典的存储器层次结构。IB 和 AQA 考试题经常要求你论证为什么需要多级存储器。


3. Main Memory: RAM and ROM | 主存储器:RAM 与 ROM

Main memory is divided into Random Access Memory (RAM) and Read Only Memory (ROM). Both are directly addressable by the CPU and are essential for system operation, but they serve fundamentally different purposes.

主存分为随机存取存储器 (RAM) 和只读存储器 (ROM)。两者均可被 CPU 直接寻址,对系统运行至关重要,但它们的功能有着根本的不同。

RAM is volatile memory: it retains data only while the power is on. It is used to hold the operating system, application programs, and data currently in use. RAM enables reading and writing at high speeds, making it ideal for temporary storage during execution.

RAM 是易失性存储器:仅在通电时保持数据。它用来存放操作系统、应用程序和当前使用的数据。RAM 允许高速读写,因此非常适合在执行期间充当临时仓库。

ROM is non-volatile and typically stores the firmware, such as the BIOS or bootloader. The contents of ROM cannot be altered under normal operation and are used to boot the computer and initialise hardware.

ROM 是非易失性的,通常存储固件,如 BIOS 或引导加载程序。ROM 的内容在正常运行中无法更改(或只能以特殊方式更改),用于启动计算机和初始化硬件。

A classic exam contrast: ‘Explain the difference between volatile and non-volatile memory.’ The answer must mention that volatile memory loses data when power is removed (RAM), while non-volatile memory retains data (ROM, flash storage).

经典的考题对比:“解释易失性和非易失性存储器的区别。”答案必须提到易失性存储器断电后丢失数据 (RAM),而非易失性存储器保留数据 (ROM、闪存)。


4. Semiconductor Technologies: SRAM, DRAM, and Flash | 半导体存储技术:SRAM、DRAM 与闪存

Static RAM (SRAM) stores each bit using a flip-flop circuit consisting of 4–6 transistors. It is faster and more expensive than DRAM, and it does not need to be refreshed, which is why it is used for cache memory.

静态 RAM (SRAM) 使用由 4–6 个晶体管组成的触发器电路存储每一位。它比 DRAM 更快、更贵,而且不需要刷新,因此被用作高速缓存。

Dynamic RAM (DRAM) stores each bit as a charge in a tiny capacitor, requiring only one transistor and one capacitor per cell. Because capacitors leak charge, DRAM must be refreshed thousands of times per second. Its simple cell structure allows very high densities, making it the standard for main memory modules.

动态 RAM (DRAM) 将每一位存储为微小电容中的电荷,每个存储单元仅需一个晶体管和一个电容。由于电容会漏电,DRAM 必须每秒刷新数千次。其简单的单元结构允许极高的集成度,使其成为主内存模块的标准。

Flash memory is a type of floating-gate transistor technology that is non-volatile. It is used in solid-state drives (SSDs), USB drives, and memory cards. Flash can be read quickly and write speeds are improving, but it has a finite number of program/erase cycles.

闪存是一种采用浮栅晶体管技术的非易失性存储器。它用于固态硬盘 (SSD)、U 盘和存储卡。闪存读取快速,写入速度也在不断提高,但具有有限次数的编程/擦写周期。

In the exam, you could be asked to compare SRAM and DRAM in terms of speed, cost, construction, and typical use. It is also worth knowing that modern DRAM variants (SDRAM, DDR SDRAM) are synchronous and transfer data on both edges of the clock.

考试中可能要求你从速度、成本、结构和典型用途等方面比较 SRAM 和 DRAM。还值得了解现代 DRAM 变体 (SDRAM、DDR SDRAM) 是同步的,并且在时钟的双沿传输数据。


5. ROM Family: PROM, EPROM, EEPROM | ROM 家族:PROM、EPROM、EEPROM

Classic ROM is manufactured with fixed contents. Programmable ROM (PROM) can be written once by blowing internal fuses. Erasable PROM (EPROM) can be erased with ultraviolet light and rewritten, while EEPROM (Electrically Erasable PROM) can be erased and rewritten electrically, even byte by byte.

经典 ROM 在制造时内容就固定了。可编程 ROM (PROM) 可以通过熔断内部熔丝一次性写入。可擦除 PROM (EPROM) 可用紫外光擦除并重写,而电可擦除 PROM (EEPROM) 能够带电擦写,甚至可按字节进行。

EEPROM technology evolved into flash memory, which allows blocks of cells to be erased in a single operation. Flash is now ubiquitous, and the older EPROM/EEPROM terminology still appears in exam specifications when describing non-volatile memory evolution.

EEPROM 技术演变为闪存,允许在一个操作中擦除整块单元。闪存如今无处不在,而在描述非易失性存储器发展历程时,考纲中仍会出现 EPROM/EEPROM 这类术语。

BiOS chips historically used EPROM or EEPROM; later systems adopted flash memory to allow firmware updates without physically replacing chips. Understanding this progression helps in answering questions about the purpose and development of read-only memory.

BIOS 芯片历史上采用 EPROM 或 EEPROM;后来的系统使用闪存,使得固件更新无需物理更换芯片。理解这一演进有助于回答关于只读存储器用途及发展的问题。


6. Cache Memory | 高速缓存

Cache is a small amount of very fast SRAM located close to the CPU. Its purpose is to reduce the average time needed to access main memory by keeping copies of frequently used data and instructions.

高速缓存是位于 CPU 附近的一小片极快速的 SRAM。其目的是通过保存常用数据和指令的副本来减少访问主存所需的平均时间。

Cache operates on the principle of locality of reference: temporal locality means recently accessed items are likely to be accessed again soon; spatial locality means items near a recently accessed address are likely to be needed. A good cache algorithm exploits both.

缓存依据的是访问局部性原理:时间局部性意味着最近访问过的项很可能再次被访问;空间局部性意味着靠近最近访问地址的项很可能被需要。好的缓存算法会同时利用两者。

When the CPU needs data, it checks the cache. If the data is present (a cache hit), it is retrieved quickly. If not (a cache miss), the data must be fetched from the slower main memory and a copy is placed in the cache. The hit ratio and miss penalty determine performance.

当 CPU 需要数据时,它会检查缓存。如果数据在缓存中(缓存命中),则快速获取;如果不在(缓存未命中),则必须从较慢的主存中取得数据,并在缓存中放置一个副本。命中率和未命中代价决定了性能指标。

Average access time = Hit time + (Miss rate × Miss penalty)

平均访问时间 = 命中时间 + (缺失率 × 缺失代价)

IB and AQA syllabi both include cache mapping schemes: direct mapped, fully associative, and set-associative. You should be able to sketch the structure of each and discuss the trade-offs in complexity, speed, and conflict misses.

IB 和 AQA 考纲都包含缓存映射方式:直接映射、全相联和组相联。你应当能够画出每种结构的示意图,并讨论在复杂性、速度和冲突缺失之间的权衡。


7. Virtual Memory and Memory Management | 虚拟内存与内存管理

Virtual memory allows a system to run programs that are larger than the physical RAM by using disk space as an extension of main memory. The operating system maintains a page table that maps virtual addresses to physical frames.

虚拟内存允许系统将磁盘空间用作主存的扩展,从而运行比物理 RAM 更大的程序。操作系统维护一个页表,将虚拟地址映射到物理页框。

When a program accesses a virtual address that is not currently in physical memory, a page fault occurs. The OS then loads the required page from secondary storage into RAM, possibly swapping out another page. This process is called paging.

当程序访问的虚拟地址当前不在物理内存中时,就会发生缺页异常。操作系统随后从辅助存储中将所需页面加载到 RAM,同时可能换出另一个页面。此过程称为分页。

Another memory management technique is segmentation, where memory is divided into logical segments such as code, data, and stack. Combined paging and segmentation (e.g., in x86) provides flexibility and protection.

另一种内存管理技术是分段,将内存划分为代码段、数据段和栈段等逻辑段。页段结合(如 x86 架构中)提供了灵活性和保护。

Physical address = (Page number → Frame number) × Page size + Offset

物理地址 = (页号 → 帧号) × 页面大小 + 偏移量

Exam tips: Be prepared to describe the benefits of virtual memory (multitasking, isolation, efficient memory usage) and its drawbacks (thrashing when too many page faults occur). Understand the concepts of least recently used (LRU) page replacement and translation lookaside buffer (TLB).

考试提示:准备好描述虚拟内存的优点(多任务处理、隔离、高效内存利用)及其缺点(过多缺页时发生颠簸)。理解最近最少使用 (LRU) 页面置换算法和旁路转换缓冲 (TLB)。


8. Secondary Storage Devices | 辅助存储设备

Secondary storage provides non-volatile, long-term storage for programs and data. It is not directly accessible by the CPU; data must first be copied into main memory. The three main types are magnetic, optical, and solid-state.

辅助存储为程序和数据提供非易失性的长期存储。CPU 不能直接访问辅助存储;数据必须先复制到主存。三种主要类型是磁性、光学和固态存储。

Hard disk drives (HDDs) use spinning magnetic platters and a moving read/write head. They offer large capacities at low cost but are sensitive to physical shock and have higher latency due to mechanical parts.

硬盘驱动器 (HDD) 使用旋转的磁盘片和移动的读写磁头。它们以低成本提供大容量,但由于机械部件而容易受到物理冲击且延迟较高。

Solid-state drives (SSDs) use flash memory (NAND) with no moving parts. They are much faster, quieter, and more durable than HDDs but cost more per gigabyte and have write endurance limits.

固态硬盘 (SSD) 使用闪存 (NAND),没有活动部件。它们比 HDD 快得多、更安静、更耐用,但每 GB 成本更高,且具有写入寿命限制。

Optical storage (CD, DVD, Blu-ray) uses lasers to read pits on a reflective surface. These are primarily used for media distribution and archival purposes. You should be able to compare the relative merits of each storage type in terms of capacity, portability, speed, and durability.

光学存储 (CD、DVD、蓝光) 使用激光读取反射面上的凹坑。这些主要用于媒体分发和归档。你应该能够从容量、便携性、速度和耐久性等方面比较每种存储类型的相对优点。


9. Storage Capacities, Units, and Addressing | 存储容量、单位与寻址

Digital storage is measured using binary prefixes. A kilobyte (KB) is 2¹⁰ = 1024 bytes; a megabyte (MB) is 2²⁰ bytes; a gigabyte (GB) is 2³⁰ bytes; and a terabyte (TB) is 2⁴⁰ bytes. However, manufacturers sometimes use decimal prefixes (1 MB = 1,000,000 bytes), which can cause confusion.

数字存储使用二进制前缀来度量。1 KB = 2¹⁰ = 1024 字节;1 MB = 2²⁰ 字节;1 GB = 2³⁰ 字节;1 TB = 2⁴⁰ 字节。然而,制造商有时使用十进制前缀 (1 MB = 1,000,000 字节),这可能造成混淆。

Memory is addressed using an address bus. A system with n address lines can directly address 2ⁿ memory locations. For example, a 32-bit address bus can address 2³² = 4 GB of memory. The data word size determines how many bits are accessed per location.

存储器通过地址总线寻址。拥有 n 条地址线的系统可以直接寻址 2ⁿ 个存储位置。例如,32 位地址总线可以寻址 2³² = 4 GB 的内存。数据字长决定了每个位置访问多少位。

Addressable space = 2^(Number of address lines) × Data word size

可寻址空间 = 2^(地址线条数) × 数据字长

Be ready for calculations: given the number of address lines and the width of the memory, determine the total capacity. You may also need to explain the difference between byte-addressable and word-addressable memory.

准备好计算:给定地址线条数和存储器宽度,求总容量。你还可能需要解释字节可寻址和字可寻址存储器的区别。


10. Performance Factors and Exam Insights | 性能因素与考试要点

Memory performance is determined by access time, bandwidth, and latency. Bandwidth is the amount of data that can be transferred per second, while latency measures the delay before a transfer begins. A high-performance system seeks low latency and high bandwidth.

存储器性能由访问时间、带宽和延迟决定。带宽是每秒可传输的数据量,而延迟衡量传输开始前的等待时间。高性能系统追求低延迟和高带宽。

Interleaving divides memory into banks accessed in parallel to boost bandwidth. Dual-channel and quad-channel architectures in modern RAM are practical examples. Questions about performance improvements often reference these techniques.

交错将内存分成多个体并行访问以提升带宽。现代 RAM 中的双通道和四通道架构就是实际例子。有关性能提升的题目经常涉及这些技术。

For IB exams, pay close attention to command terms: ‘outline the use of cache memory’, ‘explain the need

Published by TutorHao | IB Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading