📚 Types of Software and Interrupts | 软件类型与中断
Software is the invisible engine that brings computer hardware to life. It consists of programs and data that tell a computer what to do and how to do it. Without software, even the most advanced processor would be a useless collection of circuits. This article explores the two main categories of software — system software and application software — and then explains how interrupts allow the processor to respond instantly to external events, making modern multitasking and real-time interaction possible.
软件是唤醒计算机硬件的无形引擎,由程序和数据组成,告诉计算机该做什么以及如何去做。没有软件,即便是最先进的处理器也只是一堆无用的电路。本文将探讨软件的两大类别——系统软件和应用软件,并解释中断如何让处理器瞬间响应外部事件,从而使得现代多任务处理和实时交互成为可能。
1. What Is Software? | 什么是软件?
Software refers to a set of instructions, data, or programs used to operate computers and execute specific tasks. It is the non-tangible component of a computer system, in contrast to the physical hardware. Software can be broadly divided into system software and application software, though utilities and firmware sit in between. Understanding software is the first step to understanding how a computer functions at every level.
软件指用于操作计算机和执行特定任务的一组指令、数据或程序。它是计算机系统中无形的组成部分,与物理硬件相对应。软件可以广义地分为系统软件和应用软件,而实用程序和固件介于两者之间。理解软件是理解计算机各个层面如何运作的第一步。
2. System Software vs Application Software | 系统软件与应用软件
System software manages and controls the computer hardware so that application software can perform tasks. It includes the operating system, device drivers, and utility programs. Application software, on the other hand, is designed to help users accomplish specific tasks — such as writing a document, browsing the web, or editing a photo. The key difference is that system software runs in the background to support the computer's operation, while application software directly serves the end user.
系统软件管理和控制计算机硬件,以便应用软件能够执行任务。它包括操作系统、设备驱动程序和实用程序。另一方面,应用软件旨在帮助用户完成特定任务,例如撰写文档、浏览网页或编辑照片。关键区别在于系统软件在后台运行以支持计算机的操作,而应用软件直接为最终用户服务。
3. Operating Systems: The Core System Software | 操作系统:核心系统软件
An operating system (OS) is the most essential system software. It provides a user interface, manages memory and processes, handles input and output, and ensures security and access control. Examples include Windows, macOS, Linux, and Android. The OS abstracts the complexity of hardware so that applications can be written without knowing the specific details of the machine. It also schedules tasks, manages files, and communicates with device drivers. Without an operating system, no other program can run effectively.
操作系统(OS)是最重要的系统软件。它提供用户界面、管理内存和进程、处理输入和输出,并确保安全与访问控制。例如 Windows、macOS、Linux 和 Android。操作系统抽象了硬件的复杂性,使得应用程序无需了解机器的具体细节即可编写。它还负责任务调度、文件管理以及与设备驱动程序通信。没有操作系统,其他程序就无法有效运行。
4. Utility Software: Maintenance and Management | 实用程序:维护与管理
Utility software is a type of system software designed to help analyse, configure, optimise, and maintain the computer. Common utilities include antivirus scanners, disk defragmenters, backup software, file compression tools, and system monitors. These programs are not essential for the basic operation of the computer in the way an OS is, but they greatly enhance performance, security, and usability. Many operating systems come bundled with built-in utility tools.
实用程序是一类用于帮助分析、配置、优化和维护计算机的系统软件。常见的实用程序包括防病毒扫描器、磁盘碎片整理工具、备份软件、文件压缩工具和系统监视器。这些程序不像操作系统那样是计算机基本运行所必需的,但它们能极大地提高性能、安全性和可用性。许多操作系统都自带内置的实用工具。
5. Application Software: Tools for Users | 应用软件:用户工具
Application software is what most people think of when they hear the word 'software'. It includes word processors, spreadsheets, databases, web browsers, games, and multimedia players. Applications can be general-purpose, such as a presentation tool, or special-purpose, like an airline reservation system. They rely on the underlying system software to interact with the hardware. Modern applications often run on multiple platforms thanks to the abstraction provided by operating systems and virtual machines.
大多数人听到“软件”这个词时想到的就是应用软件。它包括文字处理器、电子表格、数据库、网页浏览器、游戏和多媒体播放器。应用程序可以是通用的,例如演示工具,也可以是专用的,如航空订票系统。它们依赖底层的系统软件来与硬件交互。由于操作系统和虚拟机提供的抽象层,现代应用程序通常可以跨多个平台运行。
6. Introduction to Interrupts | 中断简介
An interrupt is a signal sent to the processor that temporarily stops the current sequence of instructions so that a different, higher-priority task can be executed. Interrupts can originate from hardware devices (such as a keyboard key press, a mouse click, or a timer chip) or from software itself (for instance, a division by zero error). After the interrupting task is handled, the processor resumes its previous work. This mechanism is fundamental to responsive computing and multitasking.
中断是发送给处理器的一种信号,它会暂时停止当前的指令序列,以便执行一个不同的、更高优先级的任务。中断可以来自硬件设备(如键盘按键、鼠标点击或定时器芯片),也可以来自软件本身(例如除零错误)。当中断任务得到处理后,处理器会恢复先前的工作。这一机制是响应式计算和多任务处理的基础。
7. The Interrupt Handling Cycle | 中断处理周期
When an interrupt occurs, the processor completes the current machine cycle (fetch-decode-execute), saves the contents of its registers and program counter onto the stack, and then uses an interrupt vector to jump to the appropriate Interrupt Service Routine (ISR). The ISR is a special piece of code that handles the specific interrupt. Once the ISR finishes, the saved state is restored from the stack, and the original program continues as if nothing happened. This sequence is often called the 'interrupt handling cycle' or 'interrupt service cycle'.
当中断发生时,处理器先完成当前的机器周期(取指–译码–执行),将寄存器和程序计数器的内容保存到栈中,然后利用中断向量跳转到相应的中断服务程序(ISR)。ISR 是一段专门处理该特定中断的代码。一旦 ISR 执行完毕,就从栈中恢复保存的状态,原程序就像什么都没发生一样继续运行。这个序列常被称为“中断处理周期”或“中断服务周期”。
8. Types of Interrupts | 中断的类型
Interrupts are generally categorised as hardware interrupts and software interrupts. A hardware interrupt is generated by an external device, such as a disk drive signalling that data is ready, or a network card receiving a packet. A software interrupt is triggered by a program itself, either intentionally (system calls to request OS services) or due to an error (an exception). Additionally, a special timer interrupt, generated at regular intervals by an internal clock, allows the operating system to enforce time-slicing in multitasking environments.
中断通常分为硬件中断和软件中断。硬件中断由外部设备产生,例如磁盘驱动器发出数据就绪信号,或网卡接收到数据包。软件中断由程序自身触发,可以是有意的(系统调用来请求操作系统服务),也可以是因错误(异常)而产生的。此外,还有一种特殊的定时器中断,由内部时钟定期产生,使操作系统能够在多任务环境中实施时间片轮转。
9. Interrupt Priorities and Nested Interrupts | 中断优先级与嵌套中断
Not all interrupts are equally urgent. A power failure interrupt, for example, must be serviced immediately, while a printer completion signal can wait. Processors and interrupt controllers assign priority levels to different interrupt sources. When a high-priority interrupt occurs while a lower-priority ISR is running, nested interrupts can happen: the lower-priority ISR is itself interrupted so the processor can handle the more critical event. Proper priority management prevents data loss and ensures system stability.
并非所有中断都同样紧急。例如,电源故障中断必须立即响应,而打印机完成信号则可以稍后处理。处理器和中断控制器会为不同的中断源分配优先级。当正在运行较低优先级 ISR 时发生高优先级中断,就会出现嵌套中断:低优先级 ISR 自身被中断,以便处理器处理更关键的事件。合理的优先级管理能防止数据丢失并确保系统稳定性。
10. The Role of Interrupts in Modern Computing | 中断在现代计算中的作用
Interrupts make modern computing interactive and efficient. They allow a computer to respond immediately to user input without wasting processor cycles constantly checking each device (a technique called polling). Interrupts enable multitasking by allowing the OS to switch rapidly between processes using timer interrupts. Virtual memory management, real-time control systems, and even basic functions like copying files all rely on a continuous stream of handled interrupts. Without interrupts, computers would be slow, unresponsive, and incapable of running multiple applications simultaneously.
中断使现代计算具有交互性和高效性。它们让计算机能够立即响应用户输入,而无需浪费处理器周期不断轮询每个设备(这种技术称为轮询)。中断通过定时器中断使操作系统能在进程之间快速切换,从而实现多任务处理。虚拟内存管理、实时控制系统甚至复制文件等基本功能都依赖于连续不断的中断处理。没有中断,计算机将变得缓慢、反应迟钝,并且无法同时运行多个应用程序。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图