Skip to content

Computer Systems and Networks

AP Computer Science Principles Topic 4 7:47 English narration · English + 中文 subtitles burned in

space play · ←/→ 5s · j/l 10s · f fullscreen · ,/. speed

Chapters

Transcript
People call it the cloud. 人们把它叫做云。
It is not a cloud. 它并不是云。
This box sits in somebody's home: a router, taking data from your phone and passing it on. 这个盒子放在某个人家里: 一台路由器,把你手机发出的数据接过来,再转发出去。
This plug is the other half — a cable carrying your data as electricity or light. 这个插头是另一半—— 一根线缆,用电或者光把你的数据带走。
Millions of these, joined up, are the Internet. 千千万万个这样的设备连起来,就是互联网。
Send a photo to a friend across the world. 给地球另一边的朋友发一张照片。
It does not travel as one piece. 它并不是作为一整块传过去的。
Your phone cuts it into small numbered pieces, and writes the same address on every one. 你的手机把它切成一小块一小块并编号,每一块都写上同一个地址。
They leave separately and take different roads. 它们分别出发,走不同的路。
Some arrive out of order, some never arrive at all. 有的到达时顺序是乱的,有的干脆没到。
Her phone puts them back in order and asks again for anything missing. 她的手机把它们重新排好顺序,并对缺失的部分再要一次。
That is the Internet, in one picture. 这就是互联网,浓缩成一幅图。
Start with the words. 先把词说清楚。
A computing device is any physical thing that runs a program — a laptop, a phone, a sensor. 计算设备是任何能运行程序的实体——笔记本、手机、传感器。
A computing system is a group of devices and programs with one shared purpose. 计算系统是一组有着同一个目的的设备和程序。
A computer network is a group of devices that can send or receive data. 计算机网络是一组能发送或接收数据的设备。
The line of connected devices from sender to receiver is called a path, and routing is the job of finding one. 从发送方到接收方,依次相连的这串设备叫做路径,而路由就是找到这样一条路径的工作。
Two words people mix up. 有两个词常被混淆。
Bandwidth is the most data a link can carry in a fixed time — a wide pipe against a narrow one. 带宽是一条链路在固定时间里最多能承载的数据量—— 就像宽管子和细管子的区别。
It is measured in bits per second: a bigger number, more data each second. 它用每秒多少位来衡量: 数字越大,每秒能过的数据越多。
Latency is the other one: how long the first bit takes to arrive. 延迟是另一回事: 第一个位到达那头需要多长时间。
A wider road does not make one car arrive sooner; it only lets more cars travel at once. 把路修宽,并不会让一辆车更早到, 只是能让更多车一起走。
So what is the Internet? 那么互联网到底是什么?
Not one machine, not one wire. 它不是一台机器,也不是一根线。
It is a network of networks: a school, a company, your home, joined by the same agreed rules. 它是网络的网络: 一所学校、一家公司、你的家,由同一套约定好的规则连在一起。
Those rules are called protocols, and they are open — published, so anyone can use them. 这些规则叫做协议,而且它们是开放的——公开发布,任何人都可以使用。
That is why the Internet grew from a handful of machines to billions. 正因如此,互联网才能从少数几台机器长到几十亿台。
We say it is scalable — that is scalability. 我们说它有可扩展性——它是可扩展的。
And every message crosses it in packets. 而每一条消息都是以数据包的形式穿过它的。
Watch a message cross that network. 看一条消息如何穿过这样的网络。
The data is broken into packets. 数据被拆成一个个数据包。
Each packet carries a chunk of the message plus what the network needs to know: where it came from, where it is going, and its place in the order. 每个数据包带着消息的一小块,再加上网络需要知道的信息: 它从哪里来、要到哪里去、在整体中排第几。
Routers pass them on hop by hop, and different packets take different paths — so they may arrive in order, out of order, or not at all. 路由器一跳一跳地把它们转发出去,不同的数据包走不同的路径—— 所以它们可能按顺序到达,可能顺序错乱,也可能根本没到。
Five protocol names, one job each. 五个协议名字,各司其职。
IP gives every device an address and moves each packet toward it. IP 给每台设备一个地址,并把每个数据包朝它推进。
TCP is the careful one: it puts packets back in order and asks again for anything lost. TCP 是谨慎的那个:它把数据包重新排好顺序,并对丢失的重新索要。
UDP is the fast one — it sends without checking, which suits live video. UDP 是快的那个——它发出去不做检查,适合直播视频。
HTTP carries web pages from a server to your browser. HTTP 把网页从服务器送到你的浏览器。
And DNS turns a name you type into a machine's address. DNS 则把你输入的名字变成一台机器的地址。
Look at that last one more closely. 我们把最后这个看得更细一点。
You type a website's name. 你输入一个网站的名字。
Your computer asks a resolver for the matching address; the resolver asks a name server that has it. 你的计算机向解析器询问对应的地址;解析器再去问一台知道答案的域名服务器。
The address travels back to you. 地址一路传回到你这里。
Only then does your browser connect to the website's own server and ask for the page. 到这时,你的浏览器才连上网站自己的服务器,去请求页面。
Two words that are not the same — and the exam checks it. 有两个词并不是一回事,而且考试会考。
The big box is the Internet: the worldwide network of cables, routers and computers. 外面这个大框是互联网:由线缆、路由器和计算机组成的全球网络。
Inside it sit services. 里面装着各种服务。
The World Wide Web is one of them: web pages, delivered by HTTP. 万维网只是其中之一:网页,通过 HTTP 传送。
Email and file transfer are others. 电子邮件和文件传输是另外的服务。
They use the Internet; they are not the Web. 它们都在用互联网,但都不是万维网。
A system is fault-tolerant when it keeps working even though a part of it has failed, and the Internet was built that way. 当一个系统的某个部分坏掉了它仍然能继续工作,我们就说它是容错的, 互联网从设计之初就是这样。
Redundancy means adding extra components on purpose — here, more than one path from sender to receiver. 冗余是指有意加入多余的部件—— 在这里,就是发送方和接收方之间不止一条路径。
Now cut the top cable. 现在把上面那根线剪断。
Nothing stops: the next packets go the other way, and the far end never notices. 什么都没有停下:接下来的数据包直接改走另一条路,另一端根本察觉不到。
Redundancy costs extra hardware, and buys reliability. 冗余要多花硬件,换来的是可靠性。
The exam also asks you to find the weak spot. 考试还会让你找出薄弱环节。
Here, every computer joins one central hub. 在这里,每台计算机都连到同一个中央集线器。
It works — until the hub fails, and nothing reaches anything. 它能用——直到集线器坏掉,那时什么都到不了任何地方。
One device sits on every path. 有一台设备位于每一条路径上。
Now this one. 再看这一个。
Every device links straight to the others, so cutting any link still leaves everyone connected. 每台设备都直接连到其他每一台, 所以剪断任何一条连接,大家仍然是连通的。
Ask yourself: is there one device, or one cable, that every path must use? 问问自己:有没有哪一台设备、哪一根线,是每条路径都必须经过的?
Now, how the work gets done. 再来看工作是怎么被执行的。
Sequential computing does the operations in order, one at a time — the total is the sum of the steps. 顺序计算按次序一次做一个操作—— 总时间就是各步骤之和。
Parallel computing splits the program and runs pieces of it at the same time, on processors inside one machine. 并行计算把程序拆开, 让其中几部分同时运行,用的是一台机器里面的多个处理器。
Distributed computing uses many separate machines. 分布式计算则用许多台各自独立的机器。
Speedup compares them: one-processor time divided by many-processor time. 加速比用来比较它们:单处理器时间除以多处理器时间。
This is parallel inside one machine. 这就是并行在一台机器内部的样子。
A control unit sends the same instruction to four processing units. 一个控制单元把同一条指令发给四个处理单元。
Each unit gets its own piece of data, and all four work in the same moment. 每个单元拿到属于自己的那份数据,四个单元在同一时刻一起工作。
One instruction, four results. 一条指令,四个结果。
Nothing runs faster here — more is simply done at once. 这里没有哪一步变快了——只是同时做的事情更多了。
So how long does each take? 那么各自要花多长时间?
A sequential solution takes as long as the sum of all its steps. 顺序解法所花的时间,就是它所有步骤之和。
Now split it. 现在把它拆开。
Part of the work must still run in order, and that part never gets faster. 有一部分工作仍然必须按次序运行,这一部分永远快不了。
The rest is shared out and runs at the same time on three processors. 其余的分给三个处理器,同时运行。
But nothing is finished until the slowest part is. 但只要最慢的那一部分还没做完,整件事就没做完。
So the parallel time is the ordered part plus the longest parallel task. 所以并行时间等于必须按次序的那一部分,加上最长的那个并行任务。
Now with numbers. 现在带上数字。
A task has forty seconds that must run in order, plus sixty seconds that can be split. 一个任务有四十秒必须按次序运行,另有六十秒可以拆开。
On one processor the whole thing takes forty plus sixty, one hundred seconds. 在一个处理器上,整件事要四十加六十,共一百秒。
Now share the sixty seconds over three processors: sixty divided by three is twenty. 现在把这六十秒分给三个处理器:六十除以三等于二十。
Add the two parts together: forty plus twenty is sixty seconds. 把两部分加起来:四十加二十,等于六十秒。
Finally, divide the sequential time by the parallel time — one hundred over sixty is about one point six seven. 最后,用顺序时间除以并行时间——一百除以六十,约等于一点六七。
Three processors — not three times faster. 三个处理器——却不是三倍快。
Here it is written down — and one more line matters. 这里把它写了出来——还有一句话很重要。
The forty seconds that must run in order is a floor. 那必须按次序运行的四十秒是一条底线。
Give the task ten processors, or a thousand, and the parallel part shrinks towards nothing, but those forty seconds never move. 给这个任务十个处理器,甚至一千个,可以并行的部分会缩到几乎为零, 但那四十秒纹丝不动。
It can never finish in under forty seconds, whatever you spend. 无论你花多少钱, 它都不可能在四十秒以内完成。
The sequential part sets the limit. 是顺序部分定下了这个极限。
Some problems are too big for one computer — too slow to finish, or too large to store. 有些问题对一台计算机来说太大了——要么慢得做不完,要么大得存不下。
This is the answer: rooms full of machines sharing one problem — distributed computing. 这就是答案:一屋子的机器分担同一个问题——这就是分布式计算。
Each machine takes a slice: a search engine indexing the web, a weather service running a forecast. 每台机器负责其中一片——搜索引擎为整个网络建索引,气象部门跑一次预报。
The price: the machines must keep sending results to each other. 代价是:这些机器之间必须不断互相传送结果。
Three habits to finish. 最后,三个习惯。
First, when asked why the Internet is fault-tolerant, say redundant paths, and say that packets reroute around the failure — both halves earn the mark. 第一,当题目问互联网为什么是容错的, 要说冗余路径,还要说数据包会绕开故障重新选路——两半都答到才拿满分。
Second, in a timing question, work out the parallel time first, the ordered part plus the longest task, and only then divide to get the speedup. 第二,遇到时间计算题,先算并行时间,即必须按次序的部分加上最长的任务, 然后才去相除,求出加速比。
Third: bandwidth is a rate in bits per second, latency is a delay, and the Web is not the Internet. 第三:带宽是每秒多少位的速率,延迟是等待的时间,而万维网不是互联网。
Also discuss the digital divide — uneven access to networks — and security basics like encryption and authentication, in plain terms. 还要讨论数字鸿沟——对网络的不均等接入——以及加密与身份验证等安全基础。

Log in or create account

IGCSE, A-Level & AP