📚 The Functions of Operating Systems | 操作系统的功能
An operating system (OS) is the most important piece of system software on any computer, smartphone or embedded device. It sits between the hardware and the application programs, managing resources such as the processor, memory, storage and input/output devices. Understanding the functions of an operating system is essential for Cambridge computing courses because it explains how a computer can run multiple tasks safely, efficiently and reliably.
操作系统是任何计算机、智能手机或嵌入式设备中最重要的系统软件。它位于硬件和应用程序之间,管理处理器、内存、存储器和输入/输出设备等资源。理解操作系统的功能对于剑桥计算机课程至关重要,因为它解释了计算机如何安全、高效、可靠地同时运行多个任务。
1. What is an Operating System? | 什么是操作系统
An operating system is a collection of programs that control the hardware and provide a platform for application software. Without an operating system, each application would have to include its own code to handle the display, keyboard, disk drives and network card, making software development extremely difficult. The OS hides these hardware details and offers a stable, consistent interface to both users and programs.
操作系统是一组控制硬件并为应用软件提供平台的程序。如果没有操作系统,每个应用程序都必须包含自己的代码来处理显示器、键盘、磁盘驱动器和网卡,这使得软件开发极其困难。操作系统隐藏了这些硬件细节,并为用户和程序提供了稳定、一致的接口。
Common examples include Microsoft Windows, macOS, Linux, Android and iOS. Each of these manages hardware differently, but they all perform the same fundamental functions: process management, memory management, file management, device management, security and user interface support. In a Cambridge exam, you may be asked to identify these functions or explain why an OS is required in a given scenario.
常见的例子包括 Microsoft Windows、macOS、Linux、Android 和 iOS。它们管理硬件的方式各不相同,但都执行相同的基本功能:进程管理、内存管理、文件管理、设备管理、安全性和用户界面支持。在剑桥考试中,你可能会被要求识别这些功能,或解释在特定场景中为什么需要操作系统。
2. Process Management | 进程管理
A process is a program in execution, together with its current values, program counter and resources. The operating system is responsible for creating, scheduling and terminating processes. Modern operating systems support multitasking, which means several processes appear to run at the same time even if the CPU has only one core, because the OS rapidly switches between them.
进程是正在执行的程序,以及它当前的值、程序计数器和资源。操作系统负责创建、调度和终止进程。现代操作系统支持多任务处理,这意味着即使 CPU 只有一个核心,多个进程看起来也像是在同时运行,因为操作系统在它们之间快速切换。
The OS maintains a process control block (PCB) for each process. The PCB stores information such as the process ID, state, priority, register values and memory allocation. A process may be in one of several states: new, ready, running, blocked or terminated. The scheduler decides which ready process should be given CPU time next.
操作系统为每个进程维护一个进程控制块(PCB)。PCB 存储进程 ID、状态、优先级、寄存器值和内存分配等信息。一个进程可以处于以下几种状态之一:新建、就绪、运行、阻塞或终止。调度程序决定接下来应该给哪个就绪进程分配 CPU 时间。
| State | 状态 | Meaning | 含义 |
|---|---|
| New | 新建 | The process is being created. |
| Ready | 就绪 | The process is waiting for CPU time. |
| Running | 运行 | Instructions are being executed by the CPU. |
| Blocked | 阻塞 | The process is waiting for an event, such as input from the user. |
| Terminated | 终止 | The process has finished execution. |
Good process management prevents one program from monopolising the CPU and ensures that high-priority tasks, such as real-time audio or video, receive enough processing time. It also handles inter-process communication and synchronisation so that processes can share data without corrupting it.
良好的进程管理可以防止某个程序独占 CPU,并确保高优先级任务(如实时音频或视频)获得足够的处理时间。它还处理进程间通信和同步,使进程能够共享数据而不会破坏数据。
3. Memory Management | 内存管理
Memory management controls how the computer's random access memory (RAM) is allocated to processes and the operating system itself. The OS must ensure that each process has enough memory to execute, while preventing one process from accessing another process's memory space. This isolation improves stability and security.
内存管理控制计算机随机存取存储器(RAM)如何分配给进程和操作系统本身。操作系统必须确保每个进程有足够的内存来执行,同时防止一个进程访问另一个进程的内存空间。这种隔离提高了稳定性和安全性。
Most modern operating systems use virtual memory, which combines RAM with a portion of secondary storage called a swap file or page file. When RAM becomes full, the OS moves inactive pages to disk and loads them back when needed. This allows the computer to run programs that require more memory than is physically available.
大多数现代操作系统使用虚拟内存,它将 RAM 与称为交换文件或页面文件的二级存储部分结合起来。当 RAM 已满时,操作系统将不活跃的页面移到磁盘,并在需要时重新加载。这使得计算机能够运行需要比物理内存更多的程序。
Memory allocation can be contiguous or non-contiguous. Paging divides memory into fixed-size blocks, while segmentation divides it into logical units such as functions or data structures. The OS also translates logical addresses used by programs into physical addresses in RAM using a memory management unit.
内存分配可以是连续的或不连续的。分页将内存划分为固定大小的块,而分段将内存划分为逻辑单元,如函数或数据结构。操作系统还使用内存管理单元将程序使用的逻辑地址转换为 RAM 中的物理地址。
4. File Management | 文件管理
The operating system organises data on storage devices into files and directories. It provides a logical view of storage, so users do not need to know the physical locations of data on a hard disk or solid-state drive. The OS handles file creation, deletion, reading, writing, renaming, copying and moving.
操作系统将存储设备上的数据组织成文件和目录。它提供了存储的逻辑视图,因此用户无需知道数据在硬盘或固态硬盘上的物理位置。操作系统处理文件的创建、删除、读取、写入、重命名、复制和移动。
A file system is the method used to store and retrieve files. Examples include NTFS for Windows, APFS for macOS, ext4 for Linux and FAT32 for removable drives. The file system records metadata such as file size, date modified, access permissions and the physical blocks occupied by each file.
文件系统是用于存储和检索文件的方法。示例包括 Windows 的 NTFS、macOS 的 APFS、Linux 的 ext4 和可移动驱动器的 FAT32。文件系统记录元数据,如文件大小、修改日期、访问权限以及每个文件占用的物理块。
The OS also manages directory structures, access paths and file permissions. It ensures that files opened by multiple users or processes do not become corrupted, often using file locking and access control lists. This function is critical for servers and multi-user systems.
操作系统还管理目录结构、访问路径和文件权限。它确保由多个用户或进程打开的文件不会损坏,通常使用文件锁定和访问控制列表。此功能对于服务器和多用户系统至关重要。
5. Device Management | 设备管理
Computers connect to a wide range of input, output and storage devices, such as keyboards, mice, printers, scanners, USB drives and graphics cards. The operating system manages these devices through special programs called device drivers. A driver acts as a translator between the hardware and the rest of the system.
计算机连接各种输入、输出和存储设备,如键盘、鼠标、打印机、扫描仪、USB 驱动器和显卡。操作系统通过称为设备驱动程序的特殊程序来管理这些设备。驱动程序充当硬件与系统其余部分之间的翻译器。
Device management includes input/output scheduling, buffering, caching and spooling. For example, when several documents are sent to one printer, the OS places them in a print queue and sends them one by one. Buffering temporarily stores data while the device is busy, helping to match the speed of fast processors with slower devices.
设备管理包括输入/输出调度、缓冲、缓存和假脱机。例如,当多个文档发送到同一台打印机时,操作系统会将它们放入打印队列并逐一发送。缓冲在设备忙时临时存储数据,帮助匹配快速处理器和较慢设备之间的速度差异。
Modern operating systems also support plug and play, which automatically detects newly connected hardware and installs or loads the correct driver. This simplifies the user's experience and reduces configuration errors.
现代操作系统还支持即插即用,它可以自动检测新连接的硬件并安装或加载正确的驱动程序。这简化了用户体验并减少了配置错误。
6. User Interface | 用户界面
The user interface is the way a person communicates with the computer. The operating system provides this interface so that users can start programs, manage files, change settings and monitor system performance. Without an interface, users would need to write machine code or use physical switches to control hardware.
用户界面是人与计算机通信的方式。操作系统提供此界面,使用户能够启动程序、管理文件、更改设置和监控系统性能。如果没有界面,用户将需要编写机器代码或使用物理开关来控制硬件。
There are three main types of user interface: command-line interface (CLI), graphical user interface (GUI) and menu-driven or touch-based interface. A CLI requires the user to type text commands, while a GUI uses windows, icons, menus and pointers. Touch interfaces are common on smartphones and tablets.
用户界面主要有三种类型:命令行界面(CLI)、图形用户界面(GUI)以及菜单驱动或基于触摸的界面。CLI 要求用户输入文本命令,而 GUI 使用窗口、图标、菜单和指针。触摸界面在智能手机和平板电脑上很常见。
- CLI: faster for expert users and uses fewer system resources. | 命令行界面:对专业用户更快,使用的系统资源更少。
- GUI: easier for beginners and supports visual multitasking. | 图形用户界面:对初学者更简单,并支持可视化多任务。
- Touch/voice interface: natural interaction for mobile and assistive technology. | 触摸/语音界面:移动设备和辅助技术的自然交互方式。
Many operating systems offer multiple interfaces, for example Windows has both a GUI and PowerShell, while Linux distributions may include a desktop environment and a terminal. The choice depends on the user's expertise and the task being performed.
许多操作系统提供多种界面,例如 Windows 同时具有 GUI 和 PowerShell,而 Linux 发行版可能包含桌面环境和终端。选择取决于用户的专业水平和正在执行的任务。
7. Security and Access Control | 安全与访问控制
An operating system must protect the hardware, software and data from unauthorised access, malware and accidental damage. Security functions include user authentication, access control, encryption, auditing and firewall support. The OS enforces rules about who can read, modify or execute each resource.
操作系统必须保护硬件、软件和数据免受未经授权的访问、恶意软件和意外损坏。安全功能包括用户身份验证、访问控制、加密、审计和防火墙支持。操作系统强制执行关于谁可以读取、修改或执行每个资源的规则。
User authentication commonly uses usernames and passwords, but modern systems may also use biometric data such as fingerprints or face recognition. Once a user is authenticated, the OS grants access based on permissions stored in an access control list. For example, a standard user may not be allowed to install system-wide software, while an administrator can.
用户身份验证通常使用用户名和密码,但现代系统也可能使用生物特征数据,如指纹或面部识别。一旦用户通过身份验证,操作系统会根据访问控制列表中存储的权限授予访问权限。例如,标准用户可能不被允许安装系统级软件,而管理员可以。
The OS also isolates processes so that a compromised application cannot easily read another application's memory or files. Features such as file encryption, secure boot and sandboxing further reduce the risk of data theft or system damage.
操作系统还会隔离进程,以便受到攻击的应用程序无法轻易读取另一个应用程序的内存或文件。文件加密、安全启动和沙箱等功能进一步降低了数据被盗或系统受损的风险。
8. Networking Support | 网络支持
Most computing devices are connected to networks, whether through Ethernet, Wi-Fi or mobile data. The operating system provides built-in networking support so applications can send and receive data over these connections. This includes implementing protocol stacks such as TCP/IP, managing network interfaces and handling errors.
大多数计算设备都通过网络连接,无论是以太网、Wi-Fi 还是移动数据。操作系统提供内置的网络支持,使应用程序能够通过这些连接发送和接收数据。这包括实现 TCP/IP 等协议栈、管理网络接口和处理错误。
When a web browser requests a page, the OS resolves the domain name, opens a socket, segments the data, adds headers and passes packets to the network card driver. The OS also reassembles incoming packets and checks for transmission errors. This hides the complexity of networking from applications.
当网络浏览器请求一个页面时,操作系统会解析域名、打开套接字、分割数据、添加报头,并将数据包传递给网卡驱动程序。操作系统还会重新组装传入的数据包并检查传输错误。这向应用程序隐藏了网络的复杂性。
Network file systems and shared printers are further examples of OS networking functions. They allow users to access remote resources as if they were local, which is essential for business and education environments.
网络文件系统和共享打印机是操作系统网络功能的进一步示例。它们允许用户像访问本地资源一样访问远程资源,这对于商业和教育环境至关重要。
9. Error Handling and Monitoring | 错误处理与监控
Hardware and software errors can occur at any time, such as a disk read failure, division by zero or a network timeout. The operating system must detect these errors and respond in a controlled way, rather than allowing the whole system to crash. This makes the computer more reliable and easier to maintain.
硬件和软件错误随时可能发生,例如磁盘读取失败、除以零或网络超时。操作系统必须检测这些错误并以受控方式响应,而不是让整个系统崩溃。这使得计算机更加可靠且易于维护。
The OS uses interrupts to signal that an event requires attention. For example, when the user presses a key, the keyboard sends an interrupt to the CPU, causing the OS to pause its current work and read the key. If a program attempts an illegal operation, the OS may raise an exception and terminate only that process, not the entire system.
操作系统使用中断来发出需要处理的事件信号。例如,当用户按下按键时,键盘会向 CPU 发送中断,导致操作系统暂停当前工作并读取该按键。如果程序尝试非法操作,操作系统可能会引发异常并仅终止该进程,而不是整个系统。
System logs record errors, warnings and security events. Administrators use these logs to diagnose faults and detect suspicious activity. Performance monitoring tools also display CPU usage, memory usage and disk activity in real time.
系统日志记录错误、警告和安全事件。管理员使用这些日志来诊断故障并检测可疑活动。性能监控工具还可实时显示 CPU 使用率、内存使用率和磁盘活动。
10. Resource Allocation and Accounting | 资源分配与记账
A computer has limited resources, including CPU time, memory, storage and bandwidth. The operating system must allocate these resources fairly among all processes and users. This is especially important in multi-user systems such as servers, where one user should not be able to consume all the processing power.
计算机的资源有限,包括 CPU 时间、内存、存储和带宽。操作系统必须在所有进程和用户之间公平分配这些资源。这在服务器等多用户系统中尤其重要,因为一个用户不应该能够消耗全部处理能力。
Resource allocation uses scheduling algorithms such as round-robin, priority scheduling and shortest-job-first. Each algorithm has advantages and disadvantages. For example, round-robin gives every process a small time slice, providing good responsiveness, while priority scheduling ensures critical tasks run first.
资源分配使用调度算法,如轮转调度、优先级调度和最短作业优先。每种算法都有优缺点。例如,轮转调度为每个进程分配一个小的时间片,提供了良好的响应性,而优先级调度确保关键任务优先运行。
Accounting means tracking how much of each resource a user or process consumes. It can be used for billing in cloud services, for setting usage limits, or for identifying programs that use too much memory. The OS collects statistics such as CPU time, pages swapped and bytes transferred.
记账是指跟踪用户或进程消耗了多少资源。它可用于云服务计费、设置使用限制或识别占用过多内存的程序。操作系统收集 CPU 时间、交换页数和传输字节数等统计数据。
11. Virtualisation and Abstraction | 虚拟化与抽象
Abstraction is the process of hiding the complex details of hardware behind a simple interface. The operating system abstracts the CPU, memory, storage and I/O devices so that programs can be written without knowing the specific hardware model. This makes software portable across different computers.
抽象是将硬件的复杂细节隐藏在简单接口后面的过程。操作系统抽象了 CPU、内存、存储和 I/O 设备,使程序无需了解具体的硬件型号即可编写。这使得软件可以在不同计算机之间移植。
Virtualisation extends this idea by allowing one physical machine to run multiple virtual machines, each with its own operating system. A hypervisor allocates physical resources to each virtual machine and isolates them from one another. This is widely used in data centres and cloud computing.
虚拟化扩展了这一思想,允许一台物理机器运行多个虚拟机,每个虚拟机都有自己的操作系统。虚拟机监控程序将物理资源分配给每个虚拟机,并将它们彼此隔离。这在数据中心和云计算中被广泛使用。
Containers are a lighter form of virtualisation. They share the host operating system kernel but isolate applications and their dependencies. This improves efficiency and speeds up deployment, making it popular for modern web services and microservices.
容器是一种更轻量的虚拟化形式。它们共享宿主操作系统内核,但隔离应用程序及其依赖项。这提高了效率并加快了部署速度,使其在现代 Web 服务和微服务中很受欢迎。
12. Booting and System Initialisation | 启动与系统初始化
Booting is the process of starting a computer and loading the operating system into memory. When the power is turned on, the CPU runs firmware such as BIOS or UEFI, which performs a power-on self-test and locates the boot loader. The boot loader then loads the OS kernel into RAM.
启动是开启计算机并将操作系统加载到内存中的过程。电源打开时,CPU 运行 BIOS 或 UEFI 等固件,执行开机自检并定位引导加载程序。然后引导加载程序将操作系统内核加载到 RAM。
Once the kernel is loaded, it initialises device drivers, mounts file systems and starts essential system processes. In Linux, this may be handled by init or systemd; in Windows, by the Session Manager and Service Control Manager. The operating system then presents the login screen or desktop to the user.
内核加载后,会初始化设备驱动程序、挂载文件系统并启动必要的系统进程。在 Linux 中,这可能由 init 或 systemd 处理;在 Windows 中,由会话管理器和服务控制管理器处理。然后操作系统向用户显示登录屏幕或桌面。
A boot failure can occur if system files are missing or corrupted. Recovery options include safe mode, last known good configuration and bootable repair media. Understanding the boot sequence helps technicians diagnose startup problems.
如果系统文件丢失或损坏,可能会发生启动失败。恢复选项包括安全模式、最后一次正确的配置和可启动修复介质。了解启动顺序有助于技术人员诊断启动问题。
Published by TutorHao | Computer Science / ICT Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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