(单词翻译:单击)
Do you remember when you first realized that your computer was more than just a monitor and keyboard?
还记得你是什么时候第一次发现你的计算机不仅仅只是一个显示器和键盘的吗?
That between the mouse click and the video playing,
从鼠标的点击到视频播放,
there was something that captured your intention, understood it, and made it real?
这之间有什么东西捕捉到了你的意图,理解了它,并将其变为现实?
What is that something? Is it gremlins?
这个东西到底是什么?难道是小妖精?
Let's imagine that we can shrink down to the size of an electron and inject ourselves into a click of a mouse.
让我们假想一下自己可以缩小到和一个电子那么大,并把自己注入到鼠标的一次点击中去。
If you took your mouse apart, you'd see that it's really a very simple machine.
如果你把鼠标拆解了,你会看到其实它是一个非常简单的机械设备。
It has a couple buttons and a system for detecting motion and distance.
它有一对按键和一个用于检测动作和距离的系统。
You might have an optical mouse that makes these measurements with lights and sensors,
你用的可能是光电鼠标,它借助光以及传感器来完成这些检测,
but older ones did this with a hard rubber ball and some plastic wheels. Same concept.
但老款鼠标则是通过一个硬橡胶球和几个塑料轮子来完成。同样的原理。
When you click the button on your mouse, it sends a message to the computer with information about its position.
当你点击鼠标上的按键时,它会发向电脑发出一个包含其位置信息的消息。
When your mouse click is received, it's handled by the basic input/output subsystem.
当你的鼠标点击消息被收到,它会被基本输入/输出子系统来处理。
This subsystem acts like the eyes and ears and mouth and hands of the computer.
这个子系统的作用就像是计算机的眼睛,耳朵,嘴和手一样。
Basically, it provides a way for the computer to interact with its environment.
它主要给计算机提供了一个与其外界环境交互的途径。
But it also acts like a buffer to keep the CPU from being overwhelmed by distractions.
但它也同时起到了缓冲的作用,以保证中央处理器不至于被干扰信息所淹没。
In this case, the I/O subsystem decides that your mouse click is pretty important so it generates an interrupt to the CPU.
这里,输入输出子系统决定你的鼠标点击信息非常重要,所以它生成了一个打断信号并发给了中央处理器。
"Hey, CPU! Got a click here."
“嘿,中央处理器!这儿有一个点击信息。”
The CPU, or central processing unit, is the brains of the whole computer.
CPU,全称是中央处理器,是整个计算机的大脑。
Just like your brain doesn't take up your whole body, the CPU doesn't take up the whole computer, but it runs the show all the same.
就像你的大脑不会占据你的整个身体一样,中央处理器也不会占据整个计算机,但尽管如此,它还是操控着整个计算机。
And the CPU's job, its whole job, is fetching instructions from memory and executing them.
中央处理器的任务,也是它的全部任务,就是从内存里获取指令并执行计算。
So, while you're typing, typing, typing, maybe really fast, like 60 words a minute,
所以,当你在不断地敲击键盘,速度可能真的很快,比如一分钟60个字,
the CPU is fetching and executing billions of instructions a second.
中央处理器也在获取和执行每秒数以亿计的的指令。
Yes, billions every second: instructions to move your mouse around on the screen,
是的,每秒数以十亿计:这些指令包括你在屏幕上挪动鼠标,
to run that clock widget on your desktop, play your internet radio,
在桌面上运行一个时钟组件,运行网络收音机,
manage the files you're editing on the hard drive, and much, much more.
管理你在硬盘上编辑的文件,还有很多很多。
Your computer's CPU is one heck of a multitasker!
你计算机的中央处理器是个真正的处理多任务的能手!
"But oh my gosh there's a very important mouse click coming through now!
“但我的天啊,现在有一个非常重要的鼠标点击信息正传进来!
Let's drop everything now and deal with that!"
让我们先把其他的事情放一放来处理它!”
There are programs for everything that the CPU does.
中央处理器处理每个任务都有其对应的程序。
A special program for the mouse, for the clock widget, for the internet radio, and for dealing with letters sent by the keyboard.
一个专门的鼠标程序,专门的时钟组件的程序,专门的网络收音机的程序和专门的用于处理键盘打出的字母的程序。
Each program was initially written by a human in a human-readable programming language, like Java, C++, or Python.
每个程序最开始都是人们用人类可读的编程语言来编写的,像Java语言,C++语言或者Python语言。
But human programs take up a lot of space and contain a lot of unnecessary information to a computer,
但人工程序会占据很大的空间,而且包含很多的对计算机来说不必要的信息,
so they are compiled and made smaller and stored in bits of ones and zeros in memory.
所以它们会通过编译被缩小,并记录在许多由0和1二进制位组成的信息里存入内存。
The CPU realizes that it needs instructions for how to deal with this mouse click,
中央处理器意识到他需要指令来明白如何去处理这次鼠标点击,
so it looks up the address for the mouse program and sends a request to the memory subsystem for instructions stored there.
所以它去查询鼠标程序的地址,并向内存子系统发出一个请求来获取存储在相应位置的指令。
Each instruction in the mouse device driver is duly fetched and executed.
每个在鼠标设备驱动器里的指令都会被及时的获取并加以执行。
And that's not nearly the end of the story!
可这还远远没有结束!
Because the CPU learns that the mouse was clicked when the cursor was over a picture of a button on the monitor screen,
因为中央处理器得知鼠标在被点击的时候,光标是在显示器屏幕里的一个按钮图片上的,
and so, the CPU asks memory for the monitor program to find out what that button is.
所以,中央处理器会从内存里获取显示程序来弄清这个按钮是什么。
And then the CPU has to ask memory for the program for the button,
接着,中央处理器会从内存中获取这个按钮的程序,
which means that the CPU needs the monitor program again to show the video associated with the button, and so it goes.
这意味着中央处理器需要再次调用显示程序来显示与这个按钮相关联的视频,这样视频才能得以播放。
And let's just say there are a lot of programs involved before you even see the button on the screen light up when you clicked it.
可以说,甚至在你点击屏幕上的这个按钮使其高亮之前,已经有很多的相关程序被调用了。
So, just the simple task of clicking your mouse means visiting all of the critical components of your computer's architecture:
所以,仅仅一个简单的点击鼠标的任务,意味着要访问你计算机架构里所有的重要组成部分:
peripherals, the basic input-output system, the CPU, programs, and memory, and not one gremlin.
外设,基本输入-输出系统,中央处理器,程序和内存,这和小妖精一点儿关系没有。