跳到主要内容

计算机系统与网络

AP 计算机科学原理 · 知识点 4

本主题的视频课程 打开视频页面
7:47

计算机系统与网络

人们称之为云。它不是云。这个盒子放在某人的家里:一个路由器,接收你手机的数据并转发。这个插头是另一端…

英语旁白 · 英中内嵌字幕

4.1

互联网

教学大纲

持久理解 (CSN-1): 计算机系统和网络促进数据的传输。

学习目标 CSN-1.A: 解释计算设备如何在网络中协同工作。[技能 5.A]

  • CSN-1.A.1 计算设备是一种可以运行程序的物理实体。示例包括计算机、平板电脑、服务器、路由器和智能传感器。
  • CSN-1.A.2 计算系统是一组为共同目标而协同工作的计算设备和程序。
  • CSN-1.A.3 计算机网络是一组互联的计算设备,能够发送或接收数据。
  • CSN-1.A.4 计算机网络是计算系统的一种类型。
  • CSN-1.A.5 计算机网络上两个计算设备(发送方和接收方)之间的路径是从发送方开始并以接收方结束的一系列直接相连的计算设备序列。
  • CSN-1.A.6 路由是寻找从发送方到接收方路径的过程。
  • CSN-1.A.7 计算机网络的带宽是指在固定时间内可以发送的最大数据量。
  • CSN-1.A.8 带宽通常以比特每秒为单位进行测量。

学习目标 CSN-1.B: 解释互联网的工作原理。[技能 5.A]

  • CSN-1.B.1 互联网是由使用标准化、开放(非专有)通信协议互联的网络组成的计算机网络。
  • CSN-1.B.2 访问互联网取决于将计算设备连接到已接入互联网的设备的能力。
  • CSN-1.B.3 协议是一套约定好的规则,用于规定系统的行为。
  • CSN-1.B.4 互联网使用的协议是开放的,这允许用户轻松地将额外的计算设备连接到互联网。
  • CSN-1.B.5 互联网上的路由通常是动态的;它不是预先指定的。
  • CSN-1.B.6 系统的可扩展性是指系统改变其大小和规模以满足新需求的能力。
  • CSN-1.B.7 互联网在设计时即考虑了可扩展性。

学习目标 CSN-1.C: 解释数据如何通过数据包经由互联网发送。[技能 5.A]

  • CSN-1.C.1 信息作为数据流在因特网上传递。数据流包含数据块,这些数据块被封装在数据包中。
  • CSN-1.C.2 数据包包含一个数据块以及用于在互联网上对数据包进行路由和重新组装元数据。
  • CSN-1.C.3 数据包可能按序到达目的地,也可能乱序到达,甚至根本不会到达。
  • CSN-1.C.4 IP、TCP 和 UDP 是在互联网上常用的协议。

学习目标 CSN-1.D: 描述互联网与万维网之间的区别。[技能 5.A]

  • CSN-1.D.1 万维网是一个由链接的页面、程序和文件组成的系统。
  • CSN-1.D.2 HTTP 是万维网使用的协议。
  • CSN-1.D.3 万维网使用互联网。

来源:College Board AP 课程与考试说明

English
An RJ45 Ethernet connector — physical links carry packets across the Internet
An RJ45 Ethernet connector — physical links carry packets across the Internet

The Internet 互联网 is a global network 网络 of networks. Data travels as packets 数据包 – small chunks that are sent separately and reassembled at the destination 目的地. Two ideas make it work at scale:

The internet is the worldwide network; the web is one service running on it
The internet is the worldwide network; the web is one service running on it
  • Protocols 协议 are agreed rules for communication. IP (Internet Protocol) addresses and routes 路由 packets; TCP reassembles them in order and re-requests lost ones; HTTP carries web pages; DNS translates a name like example.com into an IP address IP地址.
  • Redundancy 冗余 and routing: there are many possible paths between two points, so if one path fails, packets take another. This makes the Internet fault-tolerant 容错.

The Internet is designed to be open 开放的 and scalable 可扩展的 – built on standards 标准 anyone can use, so it keeps working as billions of devices 设备 join. Bandwidth 带宽 is the amount of data a connection can carry per second.

How packets travel. A router 路由器 reads each packet's destination IP address and forwards it toward that address. Routing is dynamic: each packet takes whatever path is best at that moment, so packets of one message can take different paths and arrive out of order. TCP puts them back in order using their sequence numbers.

  • TCP aims to provide reliable 可靠的, ordered byte-stream delivery by detecting missing data and retransmitting it. A connection can still fail, so delivery is not guaranteed under every network failure.
  • UDP sends datagrams without built-in delivery acknowledgements, ordering or retransmission. It can avoid waiting for retransmission, but it is not always faster. An application may add its own reliability; time-sensitive video and games may prefer a missing update to a late one.
  • Protocols are layered 分层的: for example, HTTP/1.1 uses TCP over IP. Other HTTP versions can use a different transport. Each layer has a role.
  • Bandwidth is how much data a connection can carry per second; latency 延迟 is the delay for one packet to arrive.

Worked example: how many addresses? An IP address is a binary number of fixed length, so $n$ bits give $2^{n}$ different addresses.

  1. IPv4 uses 32 bits 位: $2^{32} \approx 4.3$ billion addresses — too few for every device on Earth.
  2. IPv6 uses 128 bits: $2^{128}$ addresses.
  3. IPv6 has $\dfrac{2^{128}}{2^{32}} = 2^{96}$ times as many addresses as IPv4.
  4. Each extra bit doubles the number of addresses: going from 32 to 33 bits gives $2 \times 2^{32}$ addresses, not $2^{32} + 1$.
探索

数据如何在互联网中以数据包形式传输

互联网将消息分割为编号的数据包,每个数据包独立寻址和路由(通常通过不同路径),然后在目的地重新组装。这种设计使其具有容错性——如果某条路由失败,数据包会选择其他路径。

词汇 训练
English 中文 拼音
Internet/ˈɪntənet/ 互联网 hù lián wǎng
network/ˈnetwɜːk/ 网络 wǎng luò
packets/ˈpækɪts/ 数据包 shù jù bāo
destination 目的地 mù dì dì
Protocols/ˈprəʊtəkɒlz/ 协议 xié yì
routes 路由 lù yóu
IP address/ˌaɪ ˈpiː əˈdres/ IP地址 IP dì zhǐ
Redundancy/rɪˈdʌndənsi/ 冗余 rǒng yú
fault-tolerant/fɒlt ˈtɒlərənt/ 容错 róng cuò
open 开放的 kāi fàng de
scalable 可扩展的 kě kuò zhǎn de
standards 标准 biāo zhǔn
devices 设备 shè bèi
Bandwidth/ˈbændwɪdθ/ 带宽 dài kuān
router/ˈruːtə/ 路由器 lù yóu qì
reliable/rɪˈlaɪəbl/ 可靠的 kě kào de
layered 分层的 fēn céng de
latency/ˈleɪtənsi/ 延迟 yán chí
bits/bɪts/ 位 wèi
4.2

容错

教学大纲

持久理解(CSN-1): 计算机系统和网络促进数据的传输。

学习目标 CSN-1.E: 对于容错系统,例如互联网: a. 描述容错性的优势。[技能 1.D] b. 解释给定系统是如何实现容错的。[技能 5.A] c. 识别系统中导致故障的脆弱点。[技能 1.D]

  • CSN-1.E.1 互联网经过设计具有容错性,包含用于路由和传输数据的抽象机制。
  • CSN-1.E.2 冗余是指包含额外的组件,以便在其他组件发生故障时能够缓解系统的整体失效。
  • CSN-1.E.3 实现网络冗余的一种方法是在任意两个已连接设备之间提供多条路径。
  • CSN-1.E.4 如果互联网上的特定设备或连接发生故障,后续数据将尽可能通过不同的路由发送。
  • CSN-1.E.5 当系统能够在支持故障的同时继续正常运作时,该系统被称为容错系统。这一点非常重要,因为复杂系统的组成部分往往在意外时间发生故障,且经常以群体形式出现;而容错性允许用户继续使用网络。
  • CSN-1.E.6 系统内部的冗余通常需要额外的资源,但可以提供容错的优势。
  • CSN-1.E.7 两点之间路由选项的冗余增加了互联网的可靠性,并帮助其扩展以支持更多的设备和用户。

来源:College Board AP 课程与考试说明

English
A Wi-Fi router: the local gateway that forwards packets toward the wider Internet
A Wi-Fi router: the local gateway that forwards packets toward the wider Internet

A system is fault-tolerant if it keeps working even when part of it fails. The Internet achieves this through redundant connections: because packets can be routed along multiple paths, the failure of one router or cable does not stop communication – traffic simply reroutes. Fault tolerance costs extra resources (the redundant paths) but greatly improves reliability 可靠性. A single path with no backup is not fault-tolerant.

Worked example: which failures break the network? In the network below, the lines are connections between computers.

A network of seven computers: A connects to B and C; B connects to C and D; C connects to E; D connects to E and F; E connects to F; F connects to G by a single line
  1. Can A still reach F if one connection fails? Yes. Every connection on one route has a backup route 备用路由: if A–B fails, A–C–E–F still works.
  2. Smallest number of failures that cut A off from F? Two: for example A–B and A–C, because those are A's only two connections.
  3. Is G fault-tolerant? No. G has one connection, F–G. If it fails, G cannot reach anyone, so F–G is a single point of failure 单点故障.

Exam skill: to find whether a failure disconnects two computers, cross out the failed connections and look for any remaining path between them.

Packet switching sends packets by independent routes, so the network tolerates a failed link
Packet switching sends packets by independent routes, so the network tolerates a failed link
词汇 训练
English 中文 拼音
reliability/rɪˌlaɪəˈbɪlɪti/ 可靠性 kě kào xìng
backup route 备用路由 bèi yòng lù yóu
single point of failure/ˈsɪŋɡl pɔɪnt ɒv ˈfeɪlɪə/ 单点故障 dān diǎn gù zhàng
4.3

并行与分布式计算

教学大纲

持久理解 (CSN-2): 并行和分布式计算利用多台计算机更快地解决复杂问题或处理大规模数据集。

学习目标 CSN-2.A: 针对顺序计算、并行计算和分布式计算: a. 比较问题解决方案。[技能 1.D] b. 确定解决方案的效率。[技能 1.D]

  • CSN-2.A.1 顺序计算 是一种计算模型,其中操作按顺序逐个执行。
  • CSN-2.A.2 并行计算 是一种计算模型,其中程序被分解为多个较小的顺序计算操作,其中一些操作同时进行。
  • CSN-2.A.3 分布式计算 是一种计算模型,其中使用多个设备来运行一个程序。
  • CSN-2.A.4 通过比较它们完成相同任务所需的时间,可以比较解决方案的效率。
  • CSN-2.A.5 顺序解决方案所花费的时间等于其所有步骤时间的总和。
  • CSN-2.A.6 并行计算解决方案所花费的时间等于其顺序任务时间加上其并行任务中最长的时间。
  • CSN-2.A.7 并行解决方案的“加速比”是通过用顺序完成该任务所需的时间除以并行完成该任务所需的时间来衡量的。

学习目标 CSN-2.B: 描述并行和分布式计算的优势与挑战。[技能 1.D]

  • CSN-2.B.1 并行计算由并行部分和顺序部分组成。
  • CSN-2.B.2 使用并行计算的解决方案比使用顺序计算的解决方案具有更好的可扩展性。
  • CSN-2.B.3 分布式计算使得原本因处理时间或存储需求而在单台计算机上无法解决的问题得以解决。
  • CSN-2.B.4 分布式计算能够比单台计算机更快地解决规模大得多的问题。
  • CSN-2.B.5 当在解决方案中增加并行计算的使用时,解决方案的效率仍受限于顺序部分。这意味着在某些时候,增加并行部分将不再能显著提高效率。

来源:College Board AP 课程与考试说明

English
Data-centre server racks: distributed computing spreads work across many machines
Data-centre server racks: distributed computing spreads work across many machines
  • Sequential computing 顺序计算 runs one operation at a time.
  • Parallel computing 并行计算 splits a task into parts that run at the same time on multiple processors 处理器, finishing faster.
  • Distributed computing 分布式计算 uses many computers connected by a network to work on one problem – essential for problems too big for a single machine.
Parallel computing: many processors work at the same time
Parallel computing: many processors work at the same time

A parallel solution's speedup 加速比 is the sequential time divided by the parallel time. Speedup is limited: parts that must run in sequence cannot be sped up by adding processors, so doubling the processors rarely doubles the speed.

Worked example. A task has a part that must run sequentially, taking $40$ seconds, plus a parallelizable part that takes $60$ seconds on one processor – so on a single processor the whole task takes $40+60=100$ seconds. Spread the parallel part across $3$ processors and it takes $\tfrac{60}{3}=20$ seconds, so the total parallel time is $40+20=60$ seconds and the speedup is $\tfrac{100}{60}\approx1.67$. The $40$-second sequential part is a floor: even with infinitely many processors the task can never finish in under $40$ seconds.

Worked example: two processors, three independent processes. Processes P, Q and R take $50$, $40$ and $30$ seconds and do not depend on each other. Each processor runs one process at a time.

  1. Sequentially (one processor): $50 + 40 + 30 = 120$ seconds.
  2. With two processors, try each split and take the longer processor's time: $\{50\}, \{40, 30\} \to 70$; $\{50, 30\}, \{40\} \to 80$; $\{50, 40\}, \{30\} \to 90$.
  3. The best split finishes in 70 seconds: one processor runs P while the other runs Q then R.
  4. Speedup $= \dfrac{120}{70} \approx 1.71$.

Exam skill: given the times for the sequential and parallel portions of a task, be able to calculate the total parallel time and the speedup.

词汇 训练
English 中文 拼音
Sequential computing/siːˈkwenʃl kəmˈpjuːtɪŋ/ 顺序计算 shùn xù jì suàn
Parallel computing/ˈpærəlel kəmˈpjuːtɪŋ/ 并行计算 bìng xíng jì suàn
processors/ˈprəʊsesəz/ 处理器 chǔ lǐ qì
Distributed computing/ˈdɪstrɪbjuːtɪd kəmˈpjuːtɪŋ/ 分布式计算 fēn bù shì jì suàn
speedup/ˈspiːdʌp/ 加速比 jiā sù bǐ
4.3

考试技巧

English
  • Describe how data travels in packets over a redundant, fault-tolerant network of independent routers.
  • Know that protocols (IP, TCP, HTTP) are agreed rules, and that open standards let different systems interoperate 互操作.
  • Explain scalability 可扩展性 and how the Internet grows without central control 集中控制.
  • Contrast bandwidth (rate) with latency (delay), and describe the DNS name-to-address lookup.
  • Discuss the digital divide 数字鸿沟 and security basics (encryption 加密, authentication 身份验证) in plain terms.
词汇 训练
English 中文 拼音
interoperate 互操作 hù cāo zuò
scalability/ˌskeɪləˈbɪlɪti/ 可扩展性 kě kuò zhǎn xìng
central control 集中控制 jí zhōng kòng zhì
digital divide/ˈdɪdʒɪtl dɪˈvaɪd/ 数字鸿沟 shù zì hóng gōu
encryption/enˈkrɪpʃn/ 加密 jiā mì
authentication/ɔːˌθentɪˈkeɪʃn/ 身份验证 shēn fèn yàn zhèng

该知识点的互动课程

逐步完成,配合即时检查练习。

历年真题

更多 AP 计算机科学原理 知识点

登录或创建账户

IGCSE, A-Level & AP