📚 AS OCR Computer Science: Core Knowledge Points Review | AS OCR 计算机核心知识点梳理
This article summarises the core knowledge points of the AS OCR Computer Science specification (H046), covering both the Computing Principles component (01) and the Algorithms and Problem Solving component (02). It provides a bilingual revision guide that helps students consolidate their understanding of processor architecture, software, data representation, networks, data structures, Boolean logic, algorithms and the legal and ethical issues surrounding computing.
本文梳理 OCR AS 计算机科学(H046)课程的核心知识点,涵盖"计算机原理"(01)与"算法与问题求解"(02)两大组成部分。这份双语复习指南帮助学生巩固对处理器架构、软件、数据表示、网络、数据结构、布尔逻辑、算法以及计算机相关法律与伦理问题的理解。
1. Processor Architecture and the FDE Cycle | 处理器架构与取指-译码-执行周期
The classic von Neumann architecture stores both instructions and data in the same memory, using a single shared bus for communication. This is a fundamental design choice: because instructions and data share memory, a program can treat its own code as data, but it also creates the von Neumann bottleneck, since only one item can travel along the bus at a time. Key special-purpose registers each have a distinct role in executing a program.
经典的冯·诺依曼架构将指令和数据存储在同一内存中,使用一条共享总线进行通信。这是一个基础性设计选择:由于指令与数据共用内存,程序可以把自身代码当作数据处理,但这也造成了"冯·诺依曼瓶颈"——同一时间总线上只能传输一项内容。各关键专用寄存器在执行程序时各司其职。
- Program Counter (PC) – holds the address of the next instruction to be fetched | 程序计数器 (PC) —— 保存下一条待取指令的地址
- Memory Address Register (MAR) – holds the address of the memory location to be read from or written to | 内存地址寄存器 (MAR) —— 保存要读或写的内存单元地址
- Memory Data Register (MDR) – stores the data being transferred to or from memory | 内存数据寄存器 (MDR) —— 存储与内存之间传输的数据
- Current Instruction Register (CIR) – holds the current instruction being executed, split into opcode and operand | 当前指令寄存器 (CIR) —— 保存正在执行的指令,分为操作码与操作数
- Accumulator (ACC) – stores the results of arithmetic and logic operations | 累加器 (ACC) —— 存储算术逻辑运算的结果
The Fetch-Decode-Execute (FDE) cycle repeats continuously while a program runs. In the fetch stage, the address in the PC is copied to the MAR, the instruction at that address is transferred via the data bus into the MDR and then into the CIR, and the PC is incremented. In the decode stage, the control unit splits the instruction into opcode and operand and works out what operation is required. In the execute stage, the relevant circuitry carries out the operation, often involving the ALU and the ACC.
程序运行时,取指-译码-执行 (FDE) 周期不断循环。取指阶段:PC 中的地址被复制到 MAR,该地址处的指令经数据总线传入 MDR,再进入 CIR,同时 PC 自增。译码阶段:控制单元将指令拆分为操作码与操作数,判断需要执行何种操作。执行阶段:相应电路完成该操作,通常涉及 ALU 与 ACC。
PC → MAR → Memory → MDR → CIR ; PC ← PC + 1 ; Decode ; Execute
Note the sequence carefully: it is the PC that is incremented during fetch, not after execute, and the MAR always holds an address while the MDR holds data or an instruction. Exam questions frequently ask students to describe why two registers are needed rather than one, and the answer is simply that an address and the contents of that address are different pieces of information that must be held simultaneously.
请留意顺序:是 PC 在取指阶段自增,而不是在执行之后;MAR 始终保存地址,而 MDR 保存的是数据或指令。考试常问"为什么需要两个寄存器而不是一个",答案很简单:地址与该地址中的内容是两类不同信息,必须同时保存。
2. Buses, Performance Factors and Types of Processor | 总线、性能影响因素与处理器类型
The system bus is made up of three distinct buses. The address bus is unidirectional and its width determines how many memory locations can be addressed, calculated as 2ⁿ where n is the number of address lines. The data bus is bidirectional and its width determines how much data can be transferred in one operation. The control bus is bidirectional and carries control signals such as read, write, clock and interrupt requests.
系统总线由三条不同的总线组成。地址总线是单向的,其宽度决定可寻址的内存单元数量,计算公式为 2ⁿ(n 为地址线数量)。数据总线是双向的,其宽度决定一次操作可传输的数据量。控制总线是双向的,传送读、写、时钟、中断请求等控制信号。
Performance is affected by several factors that students must be able to compare and justify.
性能受多个因素影响,学生必须能够比较并论证这些因素的作用。
- Clock speed – measured in GHz; more cycles per second generally means faster execution | 时钟频率 —— 以 GHz 计,每秒周期数越多通常执行越快
- Number of cores – allows parallel processing, but only if the task can be split into independent parts | 核心数量 —— 支持并行处理,但前提是任务可拆分为相互独立的部分
- Cache size and level – L1 is smallest and fastest, L3 is largest and slowest; cache reduces the need to access slower main memory | 缓存大小与层级 —— L1 最小最快,L3 最大最慢;缓存减少对较慢主存的访问
- Pipelining – overlapping the fetch, decode and execute stages of different instructions | 流水线 —— 让不同指令的取指、译码、执行阶段重叠进行
- Word length – a wider word length allows larger numbers to be processed in a single operation | 字长 —— 字长越宽,一次运算能处理的数值越大
RISC and CISC processors take different approaches. RISC uses a small set of simple instructions, generally one cycle per instruction, with more registers and heavy reliance on the compiler. CISC uses a large set of complex instructions, often multi-cycle, with fewer registers and more work done in hardware. A GPU is a specialised processor with many small cores designed for parallel processing, which makes it far more efficient than a CPU for tasks such as graphics rendering, machine learning and password cracking.
RISC 与 CISC 处理器采取不同思路。RISC 指令集小、指令简单,通常一条指令一个周期,寄存器较多,高度依赖编译器。CISC 指令集大而复杂,常需多个周期,寄存器较少,更多工作由硬件完成。GPU 是一种拥有大量小型核心、专为并行处理设计的处理器,因此在图形渲染、机器学习和密码破解等任务上远比 CPU 高效。
3. Input, Output and Storage Devices | 输入、输出与存储设备
Input devices convert real-world data into a digital form the computer can process; output devices convert digital data into a human-usable form. Students should be able to justify the choice of a device for a given scenario, considering factors such as accuracy, speed, cost, ease of use and the environment in which it will be used. For example, a touchscreen is appropriate for a self-service kiosk because it is durable, intuitive and requires no separate keyboard.
输入设备把现实世界的数据转换为计算机可处理的数字形式;输出设备把数字数据转换为人类可用的形式。学生应能针对特定场景论证设备选择的合理性,考虑准确性、速度、成本、易用性以及使用环境等因素。例如,自助服务终端适合采用触摸屏,因为它耐用、直观且无需单独的键盘。
| Storage type | 存储类型 | Characteristics | 特点 | Typical use | 典型用途 |
| Magnetic (HDD) 磁介质 | High capacity, low cost per GB, moving parts, vulnerable to shock 容量大、单位成本低、有机械部件、怕震动 | Desktop storage, servers 台式机、服务器 |
| Optical 光介质 | Low capacity, slow, cheap, durable media 容量小、速度慢、便宜、介质耐用 | Film, music, software distribution 影视、音乐、软件分发 |
| Solid state (SSD) 固态 | Fast, silent, shock resistant, limited write cycles, higher cost 速度快、无噪音、抗震、写入次数有限、成本较高 | Laptops, phones, USB drives 笔记本、手机、U 盘 |
RAM is volatile and stores currently running programs and data; ROM is non-volatile and holds the bootstrap loader and BIOS. Virtual memory uses a portion of secondary storage as an extension of RAM when physical memory is exhausted; it is organised into pages, and thrashing occurs when excessive paging makes the system slower than if virtual memory were absent. DRAM needs constant refreshing and is cheaper and denser; SRAM does not need refreshing and is faster and more expensive, which is why it is used for cache.
RAM 是易失性的,存储正在运行的程序与数据;ROM 是非易失性的,保存引导装载程序与 BIOS。当物理内存耗尽时,虚拟内存把部分二级存储当作 RAM 的扩展使用;它以"页"为单位组织,当频繁换页导致系统比不用虚拟内存时更慢,就发生了"抖动"(thrashing)。DRAM 需要不断刷新,更便宜、密度更高;SRAM 无需刷新,更快也更贵,因此被用作缓存。
4. Software, Operating Systems and Translators | 软件、操作系统与翻译程序
Software is divided into system software, which manages the hardware, and application software, which performs tasks for the user. The operating system is the most important piece of system software, and its main functions must be memorised precisely.
软件分为管理硬件的系统软件与为用户完成任务的应用程序软件。操作系统是最重要的系统软件,其主要功能必须准确记忆。
- Memory management – allocating RAM to processes and handling virtual memory | 内存管理 —— 为进程分配内存并处理虚拟内存
- Process scheduling – deciding which process uses the CPU and for how long | 进程调度 —— 决定哪个进程使用 CPU 以及使用多长时间
- Interrupt handling – responding to signals from hardware and software | 中断处理 —— 响应来自硬件与软件的信号
- File management – organising, naming, saving and deleting files | 文件管理 —— 组织、命名、保存和删除文件
- Input/output management – communicating with peripherals via drivers | 输入输出管理 —— 通过驱动程序与外设通信
- Security – user accounts, passwords and access rights | 安全 —— 用户账户、密码与访问权限
- User interface – providing a GUI or command line interface | 用户界面 —— 提供图形界面或命令行界面
Translators convert source code into machine code. An assembler translates assembly language into machine code, usually on a one-to-one basis. A compiler translates the whole program at once and produces an executable file, reporting all errors at the end, which makes it faster at run time. An interpreter translates and executes one line at a time, which makes debugging easier and is useful for teaching, but it is slower because translation happens every time the program runs.
翻译程序把源代码转换为机器码。汇编器把汇编语言逐条翻译为机器码,通常是一对一的。编译器一次性翻译整个程序并生成可执行文件,最后才报告全部错误,因此运行时更快。解释器逐行翻译并执行,调试更方便,适合教学,但每次运行都要重新翻译,所以速度较慢。
Compilation has several stages: lexical analysis (producing tokens and a symbol table), syntax analysis (producing an abstract syntax tree and reporting syntax errors), code generation, and optimisation. Linkers combine object files and library code into a single executable, while loaders place the executable into memory. Static linking copies library code into the executable, whereas dynamic linking references a shared library at run time, saving memory and allowing library updates without recompiling.
编译分为若干阶段:词法分析(生成记号与符号表)、语法分析(生成抽象语法树并报告语法错误)、代码生成与优化。链接器把目标文件与库代码合并为单个可执行文件,加载器则把可执行文件放入内存。静态链接把库代码复制进可执行文件,动态链接在运行时引用共享库,既节省内存,也允许库更新而无需重新编译。
5. Networks, Topologies and Protocols | 网络、拓扑与协议
A network is two or more devices connected together to share resources and communicate. A LAN covers a small geographic area and is usually owned by one organisation; a WAN covers a large area and typically uses infrastructure owned by third parties. In a client-server network, a central server provides services and controls security, which is easier to manage but expensive and creates a single point of failure. In a peer-to-peer network, all devices are equal, which is cheap and resilient but harder to secure and back up.
网络是两台或更多设备连接起来以共享资源、进行通信的系统。LAN 覆盖较小地理范围,通常由单一机构拥有;WAN 覆盖较大范围,通常使用第三方拥有的基础设施。在客户端-服务器网络中,中央服务器提供服务并控制安全,管理方便但成本高,且存在单点故障。在对等网络中,所有设备地位平等,成本低、抗故障,但安全与备份较难管理。
Protocols are sets of rules that allow devices to communicate, and the exam often requires a specific protocol for a specific purpose.
协议是允许设备相互通信的规则集合,考试常要求针对特定用途写出特定协议。
- TCP – splits data into packets, ensures reliable ordered delivery | TCP —— 把数据拆分为数据包,保证可靠有序地送达
- IP – handles addressing and routing of packets | IP —— 负责数据包的寻址与路由
- HTTP / HTTPS – transferring web pages; HTTPS adds encryption | HTTP / HTTPS —— 传输网页;HTTPS 增加了加密
- FTP – transferring files between client and server | FTP —— 在客户端与服务器之间传输文件
- SMTP – sending outgoing email; POP3 and IMAP – retrieving email | SMTP —— 发送邮件;POP3 与 IMAP —— 接收邮件
- DNS – converting domain names into IP addresses | DNS —— 把域名转换为 IP 地址
- DHCP – automatically assigning IP addresses to devices | DHCP —— 自动为设备分配 IP 地址
Topologies describe how devices are physically or logically arranged. In a star topology all devices connect to a central switch, giving high performance and easy fault isolation, but the switch is a single point of failure. In a bus topology all devices share one backbone cable, which is cheap but suffers collisions and is hard to troubleshoot. In a mesh topology every device connects to multiple others, providing excellent redundancy at high cost and complexity. Packet switching divides data into packets that may take different routes and are reassembled at the destination, which makes efficient use of the network.
拓扑描述设备的物理或逻辑连接方式。星型拓扑中所有设备连接到一个中央交换机,性能高、故障隔离容易,但交换机是单点故障。总线拓扑中所有设备共用一条主干电缆,成本低但易发生冲突且难以排障。网状拓扑中每台设备都与其他多台设备相连,冗余性极佳,但成本与复杂度很高。分组交换把数据拆成可能走不同路径的数据包,在目的地重新组装,从而高效利用网络。
6. Web Technologies | 网页技术
The web relies on a small number of core technologies. HTML defines the structure and content of a page using tags; CSS controls presentation and layout, separating style from content; JavaScript adds interactivity and is executed in the browser. Understanding who does the processing is a common exam theme.
万维网依赖少量核心技术。HTML 用标签定义页面的结构与内容;CSS 控制呈现与布局,把样式与内容分离;JavaScript 增加交互性,并在浏览器中执行。理解"处理发生在哪一端"是常见考点。
- Client-side processing – runs in the browser using JavaScript; fast response, reduces server load, but code is visible and results cannot be trusted | 客户端处理 —— 使用 JavaScript 在浏览器中运行;响应快、减轻服务器负担,但代码可见、结果不可完全信任
- Server-side processing – runs on the server using PHP, Python or similar; can access databases, code is hidden, but places load on the server | 服务器端处理 —— 使用 PHP、Python 等在服务器上运行;可访问数据库、代码隐藏,但增加服务器负担
Search engines work in three broad stages. Crawlers follow hyperlinks and download pages; indexing analyses the content, records keywords and builds an index; ranking uses algorithms such as PageRank, which treats links as votes and weights links from authoritative pages more heavily, along with factors such as keyword relevance, freshness and page load speed.
搜索引擎大致分三个阶段工作。爬虫跟踪超链接并下载页面;索引分析内容、记录关键词并建立索引;排序使用 PageRank 等算法——把链接视为投票,权威页面的链接权重更高——并结合关键词相关性、内容新鲜度和页面加载速度等因素。
Websites also rely on other technologies worth revising: cookies store small amounts of data on the client to remember state between requests; a session stores state on the server; SSL/TLS provides encrypted communication within HTTPS; and lossy and lossless compression reduce the volume of data transferred so pages load faster.
网页还依赖其他值得复习的技术:cookie 在客户端保存少量数据,用于在多次请求之间记住状态;session 在服务器端保存状态;SSL/TLS 在 HTTPS 中提供加密通信;有损与无损压缩减少传输的数据量,使页面加载更快。
7. Data Types, Units and Data Representation | 数据类型、单位与数据表示
All data in a computer is stored as binary. Students must be fluent in converting between binary, denary and hexadecimal, and in performing binary arithmetic including shifts and the effects of overflow. Units of storage build up in powers of 2, and the binary prefixes are sometimes confused with decimal ones.
计算机中的所有数据都以二进制存储。学生必须熟练掌握二进制、十进制与十六进制之间的转换,并进行二进制算术运算,包括移位以及溢出的影响。存储单位按 2 的幂递增,二进制前缀有时会与十进制前缀混淆。
yte = 8 bits → 1 KiB = 1024 bytes → 1 MiB = 1024 KiB → 1 GiB = 1024 MiB → 1 TiB = 1024 GiB
Representation of numbers depends on the scheme chosen. Unsigned binary represents only non-negative values. Two's complement is the standard for signed integers: the most significant bit carries a negative place value, giving a range of −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1 for n bits. To negate a two's complement number, invert all bits and add 1.
数值表示取决于所采用的方案。无符号二进制只能表示非负值。补码是带符号整数的标准表示:最高有效位具有负的位值,n 位时可表示范围为 −2ⁿ⁻¹ 到 2ⁿ⁻¹ − 1。要对补码取负,把所有位取反再加 1。
nt bit. The value is calculated as mantissa × 2^exponent. Increasing the number of mantissa bits increases precision; increasing the number of exponent bits increases range. A trade-off always exists, which is why exam questions ask students to compare two floating point formats.
实数采用浮点表示,必须进行规格化,使尾数以一个正的符号位及其后一位不同的位开头。其数值计算为:尾数 × 2^指数。增加尾数位数提高精度,增加指数位数扩大范围。两者始终存在权衡,这也是考试要求比较两种浮点格式的原因。
Character sets map binary codes to characters. ASCII uses 7 bits and can represent 128 characters, which is enough for English but not for other languages. Extended ASCII uses 8 bits for 256 characters. Unicode uses a variable number of bytes (commonly UTF-8, which is backward compatible with ASCII) and can represent characters from virtually every writing system, at the cost of more storage per character.
字符集把二进制编码映射到字符。ASCII 使用 7 位,可表示 128 个字符,足以处理英语但不足以覆盖其他语言。扩展 ASCII 使用 8 位,可表示 256 个字符。Unicode 使用可变字节数(常用 UTF-8,与 ASCII 向后兼容),几乎能表示所有书写系统的字符,代价是每个字符占用更多存储空间。
8. Data Structures and Abstract Data Types | 数据结构与抽象数据类型
A data structure is a way of organising data in memory so that it can be used efficiently. Choosing the right structure is a recurring exam theme, because the choice affects the speed of insertion, deletion and searching. The distinction between static and dynamic structures matters: static structures such as arrays have a fixed size decided at compile time, while dynamic structures such as linked lists can grow and shrink at run time.
数据结构是在内存中组织数据以便高效使用的方式。选择合适结构是反复出现的考点,因为这一选择会影响插入、删除与查找的速度。静态与动态结构的区别很重要:数组等静态结构在编译时确定固定大小,而链表等动态结构可在运行时增长或缩小。
- Array – fixed size, elements of the same type, direct access by index | 数组 —— 大小固定、元素类型相同、可通过下标直接访问
- Record – a collection of fields of different data types | 记录 —— 由不同数据类型的字段构成的集合
- List – an ordered, mutable collection that can store mixed types | 列表 —— 有序、可变的集合,可存储混合类型
- Tuple – an ordered, immutable collection | 元组 —— 有序且不可变的集合
- Linked list – nodes containing data and pointers; fast insertion and deletion, but sequential access only | 链表 —— 由存放数据和指针的结点组成;插入删除快,但只能顺序访问
