A-Level WJEC Computer Science: Memory | A-Level WJEC 计算机:存储器

📚 A-Level WJEC Computer Science: Memory | A-Level WJEC 计算机:存储器

In the WJEC A-Level Computer Science specification, the study of memory is fundamental to understanding how computing systems store, retrieve, and manage data. This topic covers the hierarchy of storage from high-speed registers to mass storage devices, the principles of main memory and cache, and the role of virtual memory in modern operating systems. Mastery of memory concepts is essential for both the examination and for appreciating the architecture of contemporary computers.

在 WJEC A-Level 计算机科学考试大纲中,存储器的研究是理解计算系统如何存储、检索和管理数据的基础。本主题涵盖从高速寄存器到大容量存储设备的存储层次结构、主存储器和高速缓存的工作原理,以及虚拟存储器在现代操作系统中的作用。掌握存储器概念对于考试和理解当代计算机体系结构都至关重要。

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

The memory hierarchy organises storage types by speed, cost, and proximity to the CPU. At the top are registers, followed by cache memory (L1, L2, L3), main memory (RAM), and then secondary storage such as hard disks and solid-state drives. As one moves down the hierarchy, access time increases while cost per bit decreases.

存储器层次结构根据速度、成本和与 CPU 的接近程度来组织存储类型。顶层是寄存器,接着是高速缓存(L1、L2、L3)、主存储器(RAM),然后是辅助存储器如硬盘和固态硬盘。随着层次向下移动,访问时间增加,而每比特成本下降。

This structure exploits the principle of locality, ensuring that frequently accessed data resides in faster, more expensive memory, while less critical data is stored on slower, cheaper media.

这种结构利用了局部性原理,确保频繁访问的数据驻留在更快、更昂贵的存储器中,而不太关键的数据则存放在较慢、较便宜的介质上。


2. Primary Memory: RAM and ROM | 主存储器:RAM 与 ROM

Primary memory is directly accessible by the CPU and includes Random Access Memory (RAM) and Read-Only Memory (ROM). RAM is volatile, meaning it loses its contents when power is turned off. It holds the operating system, applications, and data currently in use. ROM is non-volatile and typically stores firmware, such as the BIOS or bootloader, which is essential for starting the computer.

主存储器可由 CPU 直接访问,包括随机存取存储器 (RAM) 和只读存储器 (ROM)。RAM 是易失性的,即断电时会丢失其内容。它保存当前正在使用的操作系统、应用程序和数据。ROM 是非易失性的,通常存储固件,如 BIOS 或引导加载程序,这些对于启动计算机至关重要。

Modern systems use different types of RAM, such as Dynamic RAM (DRAM) and Static RAM (SRAM). DRAM is slower and cheaper, used for main memory, while SRAM is faster and more expensive, used for cache. ROM variants include PROM, EPROM, and EEPROM, which allow for reprogramming in certain circumstances.

现代系统使用不同类型的 RAM,如动态 RAM (DRAM) 和静态 RAM (SRAM)。DRAM 较慢且便宜,用于主存储器;而 SRAM 更快且更昂贵,用于高速缓存。ROM 的变体包括 PROM、EPROM 和 EEPROM,它们在某些情况下允许重新编程。


3. Secondary Storage | 辅助存储器

Secondary storage provides non-volatile, long-term data retention. It includes magnetic hard disk drives (HDDs), solid-state drives (SSDs), optical discs, and USB flash drives. These devices are not directly accessed by the CPU; instead, data must be transferred to main memory before processing.

辅助存储器提供非易失性的长期数据保存。它包括磁性硬盘驱动器 (HDD)、固态硬盘 (SSD)、光盘和 U 盘。这些设备不能由 CPU 直接访问;数据必须先传送到主存储器才能处理。

Key characteristics to compare include capacity, access speed, cost per gigabyte, durability, and portability. SSDs use NAND flash memory and have no moving parts, making them faster and more shock-resistant than HDDs. HDDs store data on spinning magnetic platters and offer larger capacities at lower cost.

需要比较的关键特性包括容量、访问速度、每 GB 成本、耐用性和便携性。SSD 使用 NAND 闪存且无机载移动部件,比 HDD 更快、更抗震。HDD 将数据存储在旋转的磁盘上,以更低的成本提供更大的容量。


4. Virtual Memory | 虚拟存储器

Virtual memory is a memory management technique that uses a portion of secondary storage, typically an HDD or SSD, as an extension of RAM. When the physical RAM is full, the operating system swaps inactive pages of memory out to the disk, freeing space for active processes. This allows a computer to run larger programs or more programs simultaneously than would otherwise be possible.

虚拟存储器是一种内存管理技术,它使用辅助存储器(通常是 HDD 或 SSD)的一部分作为 RAM 的扩展。当物理 RAM 已满时,操作系统会将不活动的内存页换出到磁盘,为活动进程腾出空间。这使得计算机能够运行比物理内存所能容纳的更大或更多的程序。

However, excessive reliance on virtual memory leads to thrashing, where the system spends more time swapping pages than executing instructions, causing severe performance degradation. The area on the disk used for this purpose is called the page file or swap space.

然而,过度依赖虚拟存储器会导致系统颠簸,即系统花费在页面交换上的时间多于执行指令的时间,从而导致性能严重下降。磁盘上用于此目的的区域称为页面文件或交换空间。


5. Cache Memory | 高速缓冲存储器

Cache memory is a small amount of very fast SRAM located close to or on the CPU chip. It stores copies of frequently used data and instructions from main memory to reduce the average access time. Caches operate on the principle of locality of reference: temporal locality (reusing the same data soon) and spatial locality (using data near recently accessed addresses).

高速缓冲存储器是位于 CPU 芯片附近或内部的小容量极快 SRAM。它存储来自主存储器的常用数据和指令的副本,以减少平均访问时间。缓存运行基于引用的局部性原理:时间局部性(不久后重用相同数据)和空间局部性(使用与最近访问地址邻近的数据)。

Modern processors feature multiple levels of cache: L1 (smallest and fastest, split into instruction and data), L2 (larger and slightly slower), and sometimes L3 (shared across cores). A cache hit occurs when the required data is found in the cache; a cache miss requires fetching from slower main memory.

现代处理器具有多级缓存:L1(最小且最快,分为指令和数据缓存)、L2(更大且稍慢),有时还有 L3(在多核间共享)。当所需数据在缓存中找到时称为缓存命中;缓存未命中则需要从较慢的主存中获取。


6. RAM Types and Characteristics | RAM 的类型与特性

For the WJEC specification, candidates should distinguish between DRAM and SRAM. DRAM stores each bit as a charge in a tiny capacitor and must be refreshed thousands of times per second. It is denser and cheaper, making it suitable for main system memory. SRAM uses flip-flop circuits and does not require refreshing, resulting in faster access times but at a higher cost and lower density.

根据 WJEC 大纲,考生需要区分 DRAM 和 SRAM。DRAM 将每位数据存储为微小电容中的电荷,必须每秒刷新数千次。它密度更高且更便宜,适合用作主系统内存。SRAM 使用触发器电路,无需刷新,因此访问时间更快,但成本更高、密度更低。

Other RAM types encountered include SDRAM (Synchronous DRAM) and its DDR (Double Data Rate) variants, which synchronise with the system clock to improve performance. Despite technical differences, the fundamental volatile nature and use case align with the broader DRAM category.

还会遇到其他 RAM 类型,如 SDRAM(同步 DRAM)及其 DDR(双倍数据速率)变体,它们与系统时钟同步以提高性能。尽管技术细节不同,但基本的易失性和用途与广义的 DRAM 类别一致。


7. ROM and Its Variants | ROM 及其变体

ROM is non-volatile and stores permanent code or data. Traditional mask ROM is hard-wired during manufacturing and cannot be altered. PROM (Programmable ROM) can be written once by the user. EPROM (Erasable Programmable ROM) can be erased by exposure to ultraviolet light and then reprogrammed. EEPROM (Electrically Erasable PROM) can be erased electrically and rewritten, enabling in-system updates.

ROM 是非易失性的,存储永久性代码或数据。传统掩膜 ROM 在制造时即硬连线,无法更改。PROM(可编程 ROM)可由用户一次性写入。EPROM(可擦除可编程 ROM)可通过紫外线照射擦除并重新编程。EEPROM(电可擦除 PROM)可以电擦除并重写,支持系统内更新。

Flash memory, widely used in SSDs and USB drives, is a type of EEPROM that can be erased and written in blocks, offering a balance of speed and non-volatility. It is not typically classified as ROM in the strict sense but is a descendant of ROM technology.

闪存广泛用于 SSD 和 U 盘,是一种 EEPROM,可以按块擦除和写入,兼具速度与非易失性。它通常不被严格归类为 ROM,但源自 ROM 技术。


8. Addressable Memory and Word Size | 可寻址存储与字长

Memory is organised as a sequence of addressable locations, each typically storing one byte. The number of addressable locations is determined by the width of the address bus. A system with an n-bit address bus can address 2ⁿ distinct memory locations. The word size defines the natural unit of data processed by the CPU, commonly 32 or 64 bits.

存储器被组织成一系列可寻址位置,每个位置通常存储一个字节。可寻址位置的数量由地址总线的宽度决定。具有 n 位地址总线的系统可以寻址 2ⁿ 个不同的存储位置。字长定义了 CPU 处理的自然数据单位,通常为 32 位或 64 位。

Memory capacity is typically expressed in multiples of bytes: kilobyte (KB), megabyte (MB), gigabyte (GB), and terabyte (TB). In computer science, these are often binary multiples (1 KB = 2¹⁰ bytes = 1024 bytes), though decimal definitions are also used by storage manufacturers.

存储器容量通常以字节的倍数表示:KB、MB、GB 和 TB。在计算机科学中,这些通常是二进制倍数(1 KB = 2¹⁰ 字节 = 1024 字节),尽管存储制造商也使用十进制定义。


9. Data Transfer and Buses | 数据传输与总线

Data moves between the CPU and memory via a system of buses: the address bus carries the memory address, the data bus carries the actual data, and the control bus coordinates the transfer with read/write signals. The width of the data bus influences how much data can be transferred per clock cycle, affecting memory bandwidth.

数据通过总线系统在 CPU 和存储器之间移动:地址总线承载存储器地址,数据总线承载实际数据,控制总线通过读/写信号协调传输。数据总线的宽度影响每个时钟周期可传输的数据量,进而影响存储器带宽。

Modern systems use memory controllers integrated into the CPU or chipset to manage these transfers, supporting multi-channel architectures that effectively multiply bandwidth by accessing multiple memory modules simultaneously.

现代系统使用集成到 CPU 或芯片组中的内存控制器来管理这些传输,支持多通道架构,通过同时访问多个内存模块来有效增加带宽。


10. Memory Performance Metrics | 存储器性能指标

Key performance metrics include latency (the time between initiating a request and receiving the data), bandwidth (the rate of data transfer, e.g., GB/s), and access time (combined seek, rotation, and transfer times for disk-based storage). SRAM has the lowest latency, while DRAM and solid-state storage are progressively slower.

关键性能指标包括延迟(从发起请求到接收数据之间的时间)、带宽(数据传输速率,例如 GB/s)和访问时间(基于磁盘的存储器中寻道、旋转和传输时间的总和)。SRAM 的延迟最低,而 DRAM 和固态存储器则逐渐变慢。

For magnetic disks, latency also includes rotational delay, which depends on the spindle speed (e.g., 5400, 7200 RPM). In the exam, students may be required to calculate average access times or explain the impact of fragmentation on performance.

对于磁性硬盘,延迟还包括旋转延迟,这取决于主轴转速(例如 5400、7200 RPM)。在考试中,学生可能需要计算平均访问时间或解释碎片化对性能的影响。


11. Storage Devices in Practice | 实践中的存储设备

Selecting an appropriate storage device involves trade-offs. Magnetic tapes offer huge capacity and low cost for archival backup but have sequential access, making them unsuitable for random access. Optical discs (CD, DVD, Blu-ray) are portable and durable for distribution, but have limited capacity and speed compared to HDDs and SSDs.

选择合适的存储设备需要权衡利弊。磁带为存档备份提供巨大容量和低成本,但只能顺序访问,不适合随机访问。光盘(CD、DVD、蓝光)便携且耐用,适合分发,但与 HDD 和 SSD 相比容量和速度有限。

Cloud storage has emerged as another layer in the memory hierarchy, providing remote mass storage accessible over a network. It introduces considerations of bandwidth, latency, and security. Within the WJEC specification, focus remains on local storage media and their integration into computer architecture.

云存储已成为存储器层次结构中的另一层,提供可通过网络访问的远程大容量存储。它引入了带宽、延迟和安全性等考虑因素。在 WJEC 大纲范围内,重点仍然是本地存储介质及其在计算机体系结构中的集成。


12. Exam Tips and Common Pitfalls | 考试技巧与常见误区

When answering questions on memory, be precise with terminology: distinguish between volatile and non-volatile, primary and secondary, RAM and ROM. Use examples of devices for each category. In calculation questions, ensure correct unit conversions and remember that address bus width determines addressable memory using powers of two.

回答存储器相关问题时,术语要精确:区分易失性与非易失性、主存与辅存、RAM 与 ROM。为每个类别列举设备示例。在计算题中,确保单位转换正确,并记住地址总线宽度使用 2 的幂次来确定可寻址内存。

Avoid common mistakes such as confusing cache with virtual memory, or stating that ROM is used for storing the user’s documents. Understand that virtual memory is not a physical memory chip but a technique using disk space. Also, recognise that while ROM is non-volatile, it is still a form of primary storage because the CPU can directly access it.

避免常见错误,例如混淆缓存与虚拟内存,或声称 ROM 用于存储用户文档。要理解虚拟内存不是物理内存芯片,而是一种使用磁盘空间的技术。此外,要认识到虽然 ROM 是非易失性的,但它仍然是主存储器的一种形式,因为 CPU 可以直接访问它。

Published by TutorHao | 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