Saltar al contenido

Hardware y Software

IGCSE Ciencias de la Computación Tema 4 8:28 Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar

espacio reproducir · ←/→ 5s · j/l 10s · f pantalla completa · c subtítulos · ,/. velocidad

Capítulos

Transcripción
Here is a brand new computer. 这里有一台全新的电脑。
Every physical part works — the processor, the memory, the screen, the keyboard. 每一个物理部件都是好的——处理器、内存、屏幕、键盘。
Switch it on, and nothing happens. 打开电源,却什么也没发生。
No desktop, no cursor, nothing at all. 没有桌面,没有光标,什么都没有。
Because hardware on its own cannot do anything useful. 因为硬件光靠自己,做不成任何有用的事。
It needs instructions. 它需要指令。
Software is those instructions — and between the bare metal and the app you actually use, there are several layers, each one running on the layer below it. 软件就是这些指令——而在裸露的机器和你真正在用的应用之间, 还有好几个层次,每一层都跑在它下面那一层之上。
Today we take that stack apart. 今天我们就把这一整摞拆开来看。
Hardware, software, and the layers between them. 硬件、软件,以及它们之间的那些层。
Today: hardware versus software, system and application software, the layer stack, what the operating system does, interrupts, high-level and low-level languages, compilers, interpreters and assemblers, and the IDE. 今天我们讲:硬件与软件的区别、系统软件与应用软件、 层次结构、操作系统都做些什么、中断、高级语言与低级语言、编译器、解释器和汇编器, 以及集成开发环境。
Let's begin. 让我们开始吧。
Start with the split. 先从这个区分说起。
Hardware is the physical parts — the parts you can actually touch. 硬件是物理的部件——你真的可以摸到的那些东西。
The processor — the central processing unit — the memory, the keyboard, the screen, the hard disk. 处理器、内存、键盘、屏幕、硬盘。
Software is the programs: the instructions that control the computer and tell the hardware what to do. 软件则是程序:那些控制计算机、告诉硬件该做什么的指令。
And here is the key sentence for the exam. 而下面这句话,是考试的关键句。
Hardware cannot do anything useful on its own, and software needs hardware to run on. 硬件光靠自己做不成任何有用的事,而软件也需要硬件才能运行。
You need both. 两者缺一不可。
Software splits into two types. 软件分成两类。
System software controls the computer itself and gives other programs a base to run on — the operating system, device drivers that let the operating system control a piece of hardware, utility software like anti-virus and backup tools, and the compilers and linkers that turn programs into a runnable form. 系统软件控制计算机本身,并为其他程序提供一个运行的基础—— 操作系统、让操作系统能控制某个硬件的设备驱动程序、像杀毒和备份这样的实用程序, 还有把程序变成可运行形式的编译器和链接器。
Application software lets the user do a useful task — word processing, spreadsheets, a database management system, a web browser. 应用软件则让用户完成一件有用的事—— 文字处理、电子表格、数据库管理系统、网页浏览器。
The clean way to tell them apart: system software serves the computer, in the background; application software serves the user, directly. 区分它们最干净的办法是: 系统软件在后台服务于计算机;应用软件则直接服务于用户。
Now stack them up. 现在把它们摞起来。
At the bottom, hardware — the physical machine. 最底下是硬件——那台物理的机器。
Just above it, firmware: software stored permanently on ROM or flash, which runs the moment you switch the power on. 紧挨着它上面是固件: 永久存放在 ROM 或闪存里的软件,一通电它就开始运行。
The BIOS and the bootloader are firmware — they test the hardware, then load the operating system. BIOS 和引导程序都属于固件—— 它们先检测硬件,然后把操作系统加载起来。
Above that sits the operating system itself. 再往上就是操作系统本身。
And on top of that, the application software, and finally you, the user. 而在操作系统之上,是应用软件,最上面才是你,也就是用户。
Each layer runs on the layer below it. 每一层都跑在它下面那一层之上。
That is why the machine seemed dead a moment ago: with no software, the stack has only its bottom step. 这也正是刚才那台机器像是坏了的原因:没有软件,这一摞就只剩最底下那一级。
So what does the operating system actually do? 那么操作系统究竟在做什么呢?
Eight roles, and the exam can ask for any of them. 有八项职责,考试可能问到其中任何一项。
It manages files — saving, opening, naming, moving and deleting them. 它管理文件——保存、打开、命名、移动和删除。
It handles interrupts. 它处理中断。
It provides a user interface so you can control the machine. 它提供用户界面,让你能操作这台机器。
It manages memory, deciding what stays in RAM and where. 它管理内存,决定什么留在 RAM 里、放在哪儿。
It manages peripherals and their drivers, like printers. 它管理外围设备和它们的驱动程序,比如打印机。
It manages multitasking, letting several programs run at once. 它管理多任务处理,让好几个程序同时运行。
It provides a platform for application software to run on. 它为应用软件提供一个运行的平台。
And it manages security — user accounts, passwords and access rights. 而且它还管理安全——用户账户、密码和访问权限。
Without an operating system, a computer is very hard to use. 没有操作系统,一台计算机会非常难用。
One of those roles deserves its own look: handling interrupts. 这些职责里,有一项值得单独看看:处理中断。
An interrupt is a signal sent to the processor, saying that something needs attention right now. 中断是发送给处理器的一个信号, 告诉它有件事现在就需要处理。
It can come from three places. 它可能来自三个地方。
From hardware — a key is pressed, or a printer runs out of paper. 来自硬件——比如有人按了一个键, 或者打印机没纸了。
From software — a program tries to divide by zero. 来自软件——比如某个程序试图除以零。
Or from the user — somebody presses cancel. 或者来自用户——比如有人按了取消。
And here is what the processor does, in order. 而处理器接下来会按顺序做这几件事。
It stops what it is doing. 它停下手上正在做的事。
It saves its place. 它保存自己的位置。
It services the interrupt — runs the routine that deals with it. 它服务这个中断——也就是运行处理它的那段例程。
Then it restores its place, and carries on exactly where it left off. 然后它恢复原来的位置, 从刚才停下的地方继续往下做。
That save-and-restore is what lets a computer react instantly without losing its work. 正是这个"保存再恢复",让计算机能够立刻响应,却不会丢掉手上的工作。
Programs are written in a programming language, and there are two kinds. 程序是用编程语言写出来的,而编程语言有两类。
A high-level language is written in words that look a bit like English — Python, for example. 高级语言用的词看上去有点像英语——比如 Python。
It is easy for people to read, write and fix, and it is independent of the computer, so the same program can run on different types of machine. 它对人来说容易读、容易写、也容易改,而且它独立于具体的计算机, 所以同一个程序可以在不同类型的机器上运行。
A low-level language is close to what the hardware actually uses. 低级语言则贴近硬件真正使用的东西。
That means machine code — instructions in binary, which the processor runs directly — and assembly language, which is machine code written with short word codes, called mnemonics, instead of binary. 它包括机器码——用二进制写的指令,处理器可以直接执行——以及汇编语言, 也就是把机器码写成简短的助记符,而不是二进制。
A low-level language is tied to one specific type of processor, so a program written for one may not run on another. 低级语言和某一种特定型号的处理器绑在一起, 所以为一种处理器写的程序,在另一种上可能跑不了。
You use it when you need full control of the hardware, or very fast, very small code. 当你需要完全掌控硬件,或者需要非常快、非常小的代码时,才会用它。
But the processor can only run machine code, so a high-level program has to be translated first. 但处理器只能运行机器码,所以高级语言写的程序必须先被翻译。
The software that does that is called a translator, and there are two of them for high-level code. 做这件事的软件叫翻译程序, 针对高级代码的有两种。
A compiler translates the whole program into machine code before it is run. 编译器在程序运行之前,把整个程序一次性翻译成机器码。
Translation happens once, in full. All the errors are reported together at the end. And the finished program runs fast and does not need the compiler present in order to run. 翻译只发生一次、而且是整体的;所有错误会在最后一起报出来; 翻译好的程序运行得快,而且运行时不需要编译器在场。
An interpreter translates and runs the program one line at a time. 解释器则是一次一行地边翻译边运行。
It stops at the very first error it finds, which is a real help while you are testing. The program runs more slowly, because it is translated again every time. And the interpreter has to be there every single time the program runs. 它一遇到第一个错误就停下来,这在你调试的时候非常有帮助; 程序运行得更慢,因为每次运行都要重新翻译一遍;而且每一次运行程序,解释器都必须在场。
The third translator is the assembler, and it belongs in a different box from the other two. 第三种翻译程序是汇编器,它和另外两种不属于同一类。
It takes assembly language — a LOW-level program written in mnemonics like L D A and A D D — and turns it into machine code. 它接受的是汇编语言——用 L D A、A D D 这类助记符写成的低级程序—— 并把它变成机器码。
And the translation is one-to-one: each mnemonic becomes exactly one machine instruction. 而且这种翻译是一一对应的:每一个助记符恰好变成一条机器指令。
That is unlike a compiler or an interpreter, which both work on HIGH-level code, where a single line can expand into many machine instructions. 这和编译器、解释器都不同,那两者处理的是高级代码, 其中一行可以展开成很多条机器指令。
So when a question asks you to distinguish the three translators, the assembler is separated by what it takes IN, not just by how it works. 所以当题目要求区分这三种翻译程序时, 汇编器的区别在于它的输入是什么,而不只是它怎么工作。
A team is writing a program. 一个团队正在开发一个程序。
While developing it they want to find and fix errors quickly; when they ship it they want customers to run it fast without seeing the source code. 开发过程中他们希望快速找到并修正错误; 发布时他们希望客户运行得快,而且看不到源代码。
Which translator suits each stage? 每个阶段各适合哪种翻译程序?
While developing, use an interpreter: it translates and runs one line at a time and stops at the first error, so a mistake is easy to locate. 开发阶段用解释器:它一次翻译并运行一行,遇到第一个错误就停下来, 所以错误很容易定位。
To ship, use a compiler: it translates the whole program once into machine code, which then runs quickly with no translator present, and the customer receives only the executable rather than the source. 发布时用编译器:它把整个程序一次性翻译成机器码, 之后运行得很快,也不需要翻译程序在场, 而客户拿到的只是可执行文件,不是源代码。
The two are not rivals. 这两者不是对手。
Name the STAGE and give the reason, because "a compiler is faster" on its own earns nothing. 要说出阶段并给出理由, 因为光说"编译器更快"是拿不到分的。
Last, the tool you write it all in: an integrated development environment, or IDE. 最后是你用来写这一切的那个工具:集成开发环境,简称 IDE。
It gathers the useful tools into one place. 它把有用的工具都集中到一个地方。
A code editor for typing your program. 代码编辑器,用来输入你的程序。
A run time environment, for running it to test it. 运行时环境,用来运行程序做测试。
A translator — a compiler or an interpreter. 翻译程序——编译器或者解释器。
Error diagnostics: messages that help you find and understand your mistakes. 错误诊断:帮你找到并理解自己错在哪里的提示信息。
Auto-completion and auto-correction, which finish or fix code as you type. 自动补全和自动纠错, 在你打字的同时帮你补完或改正代码。
And prettyprinting, which lays the code out neatly, with colour and indentation, so it is easy to read. 还有美化打印,把代码用颜色和缩进整整齐齐地排好, 让它读起来轻松。
Four marks to lock in. 四个要拿稳的分。
First, system software runs the computer, while application software does a task for the user. 第一,系统软件负责运行这台计算机,而应用软件替用户完成某项任务。
Second, a compiler translates the whole program at once and the result runs fast; an interpreter goes line by line and stops at the first error. 第二,编译器把整个程序一次性翻译完,翻译出来的程序运行得快; 解释器一行一行地来,遇到第一个错误就停。
Third, high-level languages run on any computer, while low-level languages are tied to one type of processor. 第三,高级语言在任何计算机上都能运行, 而低级语言绑定在某一种处理器上。
Fourth, an interrupt makes the processor stop, save its place, service the event, then carry on. 第四,中断会让处理器停下、保存位置、 服务这个事件,然后再继续。
Nail these, and this topic is yours. 掌握这些,这个专题就是你的了。

Comentarios

    Iniciar sesión o crear cuenta

    IGCSE, A-Level & AP