Paper 1 · Computer Systems 试卷一 · 计算机系统

4.1 · Types of software and interrupts

4.1 · 软件的类型与中断

Software and interrupts

软件与中断

The two kinds of software, the nine jobs an operating system does, why hardware needs firmware and an operating system before an app can run, and how an interrupt pulls the processor away and then hands control back.

软件的两大类别、操作系统承担的九项工作、为什么应用程序运行之前硬件需要固件和操作系统,以及中断如何把处理器"拉走"再把控制权交还回去。

Core for all candidates 所有考生均需掌握的核心内容 Covers 4.1.1 to 4.1.4 涵盖 4.1.1 至 4.1.4 Naming the exact interrupt event is marked 准确说出中断事件本身是评分要点

Explainer · 4.1.1

讲解 · 4.1.1

System software and application software

系统软件与应用软件

Open your phone. The messaging app, the camera, the games: each one is there to do a job for you. None of them could run if something underneath were not already managing the screen, the storage and the memory. That hidden layer is system software. The apps on top are application software.

打开你的手机。消息应用、相机、游戏:它们每一个都是为你做一件事而存在的。如果底层没有一个东西在管理屏幕、存储和内存,这些应用一个也运行不了。那个隐藏的层就是系统软件。上面的这些应用则是应用软件。

Df

System software provides the services the computer itself needs. It controls and manages the hardware, and gives other software a platform to run on. It is made up of the operating system and utility software (and device drivers).

系统软件提供计算机本身所需的服务。它控制和管理硬件,并为其他软件提供一个可以运行的平台。它由操作系统和实用程序软件(以及设备驱动程序)组成。

Df

Application software provides the services the user wants. It lets a person carry out one specific task, such as writing a letter, editing a photo or browsing the web. The user runs it when they choose to.

应用软件提供用户想要的服务。它让人完成某一项具体的任务,例如写一封信、修一张照片或浏览网页。用户想用的时候才运行它。

Application software应用软件 System software系统软件
word processor, spreadsheet, database, web browser, photo and video editors, games 文字处理软件、电子表格、数据库、网页浏览器、图片和视频编辑软件、游戏 the operating system; utility software (anti-virus, backup, disk defragmenter, file compression); device drivers 操作系统;实用程序软件(杀毒软件、备份、磁盘碎片整理、文件压缩);设备驱动程序
!

Asked for an example of system software, some candidates describe a function of the operating system instead. An example is a named piece of software (the operating system, a virus checker). A function is a job it does (managing memory). The question decides which one earns the mark.

被要求举出系统软件的一个例子时,有些考生却去描述操作系统的一项功能。例子是一个有名称的软件(操作系统、杀毒软件)。功能是它做的一件事(管理内存)。题目要求的是哪一个,分数就给哪一个。

Try it yourself

动手试试

Sort the software

给软件分类

Tap each item to tag it as system software or application software, then check.

点击每一项,把它标记为系统软件或应用软件,然后检查答案。

Explainer · 4.1.2

讲解 · 4.1.2

What an operating system does

操作系统的作用

The operating system (OS) is system software. It starts with the computer and keeps working out of sight the whole time the machine is on. It hides the complexity of the hardware and gives the user a way to work with the machine. The syllabus names nine functions it carries out.

操作系统(OS)是一种系统软件。它随计算机一起启动,并在机器开着的整段时间里在幕后持续工作。它隐藏了硬件的复杂性,并给用户一个操作这台机器的方式。考纲列出了它承担的九项功能。

Df

An operating system gives application software an environment to run in, and gives the user an interface for controlling the computer's hardware.

操作系统给应用软件一个可以运行的环境,并给用户一个控制计算机硬件的接口。

The interface 这个接口

The interface the OS provides takes one of two forms. A CLI (command line interface) has the user type commands. A GUI (graphical user interface) has the user select icons and windows with a pointer or a touch screen.

操作系统提供的接口有两种形式。CLI(命令行界面)让用户输入命令。GUI(图形用户界面)让用户用指针或触摸屏选择图标和窗口。

Try it yourself

动手试试

The nine functions

九项功能

Click each function to see what the operating system actually does.

点击每一项功能,看看操作系统实际上做了什么。

!

Asked to describe one function, many candidates just list several function names, or describe a different function from the one asked. Name the function asked for, then say what it actually involves. For memory management: allocating space in RAM, keeping track of the locations, and stopping two programs sharing the same location.

被要求描述一项功能时,许多考生只是罗列好几个功能的名称,或者描述了题目没有问的另一项功能。要点出题目问的那一项功能,然后说清楚它实际包含什么。以内存管理为例:在 RAM 中分配空间、记录这些位置、阻止两个程序共用同一个位置。

Explainer · 4.1.3

讲解 · 4.1.3

Hardware, firmware and the operating system

硬件、固件与操作系统

When you press the power button, nothing on the disk can run yet, not even the operating system. Something simpler, already built into the machine, has to start first and fetch the operating system. That something is firmware.

当你按下电源键时,磁盘上的任何东西都还不能运行,连操作系统也不能。必须有一个更简单的、已经内置在机器里的东西先启动,并把操作系统取出来。这个东西就是固件。

Df

Firmware is a small program that controls a device's hardware directly, at the lowest level. It is stored on a chip inside the device and is already there when the machine is switched on.

固件是一个直接在最底层控制设备硬件的小程序。它存储在设备内部的一块芯片上,机器开机时它就已经在那里了。

The bootloader is the firmware that starts a computer. On a PC it is called the BIOS (basic input/output system). It finds where the operating system is stored, loads part of it into RAM (random access memory, the computer's main working memory), and runs it.

引导加载程序就是启动计算机的那段固件。在个人电脑上它被称为 BIOS(基本输入/输出系统)。它找到操作系统存储的位置,把它的一部分加载到 RAM(随机存取存储器,即计算机的主工作内存)中,然后运行它。

Each layer runs on the one below it. An application cannot reach the hardware directly: it goes through the operating system, which was itself started by the firmware, which runs on the hardware.

每一层都运行在它下面的一层之上。应用程序不能直接访问硬件:它要经过操作系统,而操作系统本身是由固件启动的,固件又运行在硬件之上。

Try it yourself

动手试试

The software stack

软件层级

Click each layer to see what it is and what it runs on.

点击每一层,看看它是什么、运行在什么之上。

!

Firmware is answered wrongly more often than almost anything in this topic. It is not hardware, and "the BIOS" is not a definition: the BIOS is one example of firmware. Firmware is software: a small program giving low-level control, stored on a chip, and it is what loads the operating system when the machine starts.

在这个主题里,固件被答错的频率几乎是最高的。它不是硬件,而且"BIOS"也不是一个定义:BIOS 是固件的一个例子。固件是软件:一个提供底层控制的小程序,存储在芯片上,并且它就是机器启动时负责加载操作系统的那个东西。

Explainer · 4.1.4

讲解 · 4.1.4

Interrupts

中断

A processor works through instructions one after another. But things happen that cannot wait for it to finish: a key is pressed, a printer runs out of paper, a program tries to divide by zero. An interrupt is how the hardware or the software says "stop, deal with this now".

处理器一条接一条地执行指令。但有些事情不能等它做完:一个键被按下、打印机没纸了、一个程序试图除以零。中断就是硬件或软件说"停一下,现在处理这件事"的方式。

Df

An interrupt is a signal that a device or a piece of software sends to the processor (microprocessor) to tell it that something needs attention. The processor finishes the instruction it is on, then decides whether to deal with the interrupt now, based on the interrupt's priority.

中断是某个设备或某个软件发送给处理器(微处理器)的一个信号,用来告诉它有事情需要处理。处理器先执行完当前这条指令,然后根据这个中断的优先级决定是否现在就处理它。

Df

A hardware interrupt comes from a device. Examples: pressing a key on the keyboard, moving the mouse, a printer that is out of paper, a disk drive that needs more data.

硬件中断来自一个设备。例如:按下键盘上的一个键、移动鼠标、打印机没纸了、磁盘驱动器需要更多数据。

A software interrupt comes from a running program, usually because it hit an error it cannot handle. Examples: trying to divide a number by zero, or two processes trying to use the same memory location.

软件中断来自一个正在运行的程序,通常是因为它遇到了自己无法处理的错误。例如:试图把一个数除以零,或者两个进程试图使用同一个内存单元。

How an interrupt is handled

一个中断是如何被处理的

Follow one interrupt: you press a key while a file is downloading in the background.

跟踪一个中断:一个文件正在后台下载时,你按下了一个键。

Step步骤 What happens发生的过程
11 The interrupt signal reaches the processor. The processor finishes the instruction it is currently on. 中断信号到达处理器。处理器先把当前正在执行的这条指令做完。
22 The interrupt's priority is checked against the running task. A higher-priority interrupt is serviced now; a lower-priority one waits in an interrupt queue. 把这个中断的优先级与正在运行的任务作比较。优先级更高的中断现在就处理;优先级较低的则在中断队列里等待。
33 The processor saves where it is up to: it writes a copy of the program counter and every other register into memory, so the task can later start again from the exact same place. 处理器保存它的进度:把程序计数器和其他每一个寄存器的一份副本写入内存,这样任务之后能从完全相同的位置重新开始。
44 The processor loads the start address of the interrupt service routine, the ISR, into the program counter, and the ISR begins. The ISR is the software that deals with this type of interrupt: here it reads the key's character and adds it to the document. 处理器把中断服务程序(ISR)的起始地址加载到程序计数器中,ISR 开始运行。ISR 就是处理这一类中断的软件:这里它读取被按下的键对应的字符,并把它加入文档。
55 When the ISR has finished, the saved register contents are copied back, so the processor returns to the exact point it was interrupted. ISR 执行完毕后,把之前保存的寄存器内容复制回去,使处理器回到它被中断的确切位置。
66 The processor carries on with the download as if nothing had happened. 处理器继续进行下载,就像什么都没发生过一样。

What happens as a result: the event is dealt with without losing the original work, and the user gets the impression that many things happen at once (typing while downloading while music plays), because the processor switches between tasks very quickly.

结果是:这件事被处理了,而原来的工作没有丢失;用户会觉得很多事情在同时发生(一边打字、一边下载、一边放音乐),因为处理器在多个任务之间切换得非常快。

!

"Keyboard" or "mouse" on their own are devices, not interrupts. The interrupt is the event: pressing a key on the keyboard, moving the mouse. An interrupt also does not "tell the user there is a problem" and does not always produce a message; it signals the processor. And it does not simply "stop" the current program: that task is paused and then resumed.

单说"键盘"或"鼠标"是设备,不是中断。中断是那个事件:按下键盘上的一个键、移动鼠标。中断也不会"告诉用户出了问题",也不一定会产生消息;它是给处理器发信号。而且它不是简单地"停止"当前程序:那个任务是被暂停,然后被恢复的。

Try it yourself

动手试试

Servicing an interrupt

处理一个中断

Step through the six stages. A key press arrives while a download is running.

逐步走过这六个阶段。一次按键在下载进行时到达。

Check your understanding

检验你的理解

Which one of these is system software?

下面哪一个是系统软件?

Check your understanding

检验你的理解

Which of these is a function of an operating system?

下面哪一项是操作系统的功能?

Check your understanding

检验你的理解

When a computer is switched on, what does the firmware do?

计算机开机时,固件做什么?

Check your understanding

检验你的理解

A running program tries to divide a number by zero. What kind of interrupt does this cause?

一个正在运行的程序试图把一个数除以零。这会引起哪一种中断?

Common mistakes

常见错误

Markers reported these patterns for 4.1.1 to 4.1.4 考官针对 4.1.1 至 4.1.4 报告了以下模式

RecurringFirmware is very often answered wrongly. Candidates call it hardware, or give "the BIOS" as the whole definition. Firmware is a small program, stored on a chip, that controls a device's hardware at the lowest level; the BIOS or bootloader is one example of it, and at start-up it is what loads the operating system.

反复出现固件经常被答错。考生把它说成硬件,或者用"BIOS"当作整个定义。固件是一个存储在芯片上的小程序,在最底层控制设备的硬件;BIOS 或引导加载程序是它的一个例子,而且在开机时它就是负责加载操作系统的那个东西。

For interrupt examples, candidates write "keyboard" or "mouse". Those are devices. The interrupt is the event: pressing a key on the keyboard, moving the mouse.

举中断的例子时,考生写"键盘"或"鼠标"。那些是设备。中断是那个事件:按下键盘上的一个键、移动鼠标。

On what an interrupt does, common wrong answers are that it "signals to the user that there is a problem", "produces an error message" (a message may come from the interrupt handler, but not always), or "stops the current program" (the task is paused and then resumed, and many interrupts do not disturb it noticeably). An interrupt signals the processor that its attention is needed.

关于中断做什么,常见的错误答案是:它"向用户发出信号说有问题"、"产生一条错误消息"(消息可能来自中断处理程序,但不一定),或"停止当前程序"(任务是被暂停然后被恢复的,而且许多中断并不会明显打扰它)。中断是向处理器发信号,说需要它来处理。

Asked how an interrupt is serviced, most answers stay vague. The marked points are: the current registers (including the PC) are saved, the ISR runs, the saved registers are restored, and the interrupt is given a priority (or placed in a queue).

被问到中断是如何被处理的时候,大多数答案都很含糊。得分要点是:当前的寄存器(包括 PC)被保存、ISR 运行、被保存的寄存器被恢复,以及这个中断被赋予一个优先级(或放入一个队列)。

On operating systems, candidates list function names or describe a function other than the one asked. Name the function asked for, then describe what it involves.

关于操作系统,考生罗列功能名称,或描述了题目没问的另一项功能。要点出题目问的那一项功能,然后描述它包含什么。

✕

Interrupt example: "The keyboard is an interrupt that stops the processor."

中断的例子:"键盘是一个中断,它会停止处理器。"

✓

Right: "Pressing a key on the keyboard sends an interrupt signal to the processor. The processor saves its registers, runs the interrupt service routine, then restores the registers and continues."

正确:"按下键盘上的一个键会向处理器发送一个中断信号。处理器保存它的寄存器,运行中断服务程序,然后恢复寄存器并继续。"

✕

Firmware: "Firmware is the hardware inside the computer that holds the BIOS."

固件:"固件是计算机内部保存 BIOS 的那块硬件。"

✓

Right: "Firmware is a small program, stored on a chip, that controls a device's hardware at the lowest level. The BIOS is one example; at start-up it loads the operating system into RAM."

正确:"固件是一个存储在芯片上的小程序,在最底层控制设备的硬件。BIOS 是一个例子;开机时它把操作系统加载到 RAM 中。"

Go deeper

深入练习

Paper 1

Write the interrupt sequence from memory

凭记忆写出中断的处理顺序

From memory, write the six steps of servicing an interrupt in order, naming the program counter and the interrupt service routine. Then check each step against the table in 4.1.4.

凭记忆按顺序写出处理一个中断的六个步骤,点出程序计数器和中断服务程序。然后对照 4.1.4 中的表格核对每一步。

Try the revision questions 做一做复习题

Revision questions

复习题

Past-paper style. Write an answer, then reveal the marking points and mark yourself.

采用历年真题风格。写下答案,然后展开评分要点给自己打分。

Question 1 · 2 marks 第 1 题 · 2 分

[2]State the difference between system software and application software.

[2]陈述系统软件与应用软件的区别。

Question 2 · 6 marks 第 2 题 · 6 分

[6]Describe three functions of an operating system. Do not include handling interrupts.

[6]描述操作系统的三项功能。不要包括处理中断。

Question 3 · 3 marks 第 3 题 · 3 分

[3]Explain what is meant by firmware, and describe its role when a computer is switched on.

[3]解释固件是什么意思,并描述计算机开机时它的作用。

Question 4 · 5 marks 第 4 题 · 5 分

[5]Describe how the processor services an interrupt, from the signal arriving to the original task continuing.

[5]描述处理器如何处理一个中断,从信号到达一直到原来的任务继续。

Question 5 · 4 marks 第 5 题 · 4 分

[4]Give one example of a hardware interrupt and one example of a software interrupt. For each, state what causes it.

[4]各举一个硬件中断和一个软件中断的例子。对每一个,说明是什么引起了它。

Flashcards

记忆卡片

Active recall for this subtopic’s key terms.

针对本子主题关键术语的主动回忆练习。

Prototype render · content grounded in the Cambridge IGCSE 0478 syllabus and real 0478 examiner-report data for 4.1 · not yet wired to live routes