Operating System 简明教程
Operating System - Services
操作系统为用户和程序提供服务。
An Operating System provides services to both the users and to the programs.
-
It provides programs an environment to execute.
-
It provides users the services to execute the programs in a convenient manner.
以下是操作系统提供的几种常见服务 −
Following are a few common services provided by an operating system −
-
Program execution
-
I/O operations
-
File System manipulation
-
Communication
-
Error Detection
-
Resource Allocation
-
Protection
Program execution
操作系统处理从用户程序到系统程序(如打印机后台程序、名称服务器、文件服务器等)的多种活动。这些活动中的每一个都封装为一个进程。
Operating systems handle many kinds of activities from user programs to system programs like printer spooler, name servers, file server, etc. Each of these activities is encapsulated as a process.
进程包括完整的执行上下文(要执行的代码、要处理的数据、寄存器、正在使用的操作系统资源)。以下是操作系统在程序管理方面的主要活动 −
A process includes the complete execution context (code to execute, data to manipulate, registers, OS resources in use). Following are the major activities of an operating system with respect to program management −
-
Loads a program into memory.
-
Executes the program.
-
Handles program’s execution.
-
Provides a mechanism for process synchronization.
-
Provides a mechanism for process communication.
-
Provides a mechanism for deadlock handling.
I/O Operation
I/O 子系统包含 I/O 设备及其相应的驱动程序软件。驱动程序向用户隐藏特定硬件设备的特性。
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers hide the peculiarities of specific hardware devices from the users.
操作系统对用户和设备驱动器之间的通信进行管理。
An Operating System manages the communication between user and device drivers.
-
I/O operation means read or write operation with any file or any specific I/O device.
-
Operating system provides the access to the required I/O device when required.
File system manipulation
一个文件表示收集起来的相关信息。计算机可以将文件存储在磁盘(二级存储)上,以作长期存储之用。存储介质的示例包括磁带、磁头磁盘和光盘驱动器,如 CD、DVD。这些介质每一种都有其自己的属性,如速度、容量、数据传输速率和数据访问方法。
A file represents a collection of related information. Computers can store files on the disk (secondary storage), for long-term storage purpose. Examples of storage media include magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has its own properties like speed, capacity, data transfer rate and data access methods.
文件系统通常被组织成目录,以便进行轻松导航和使用。这些目录可能包含文件和其他方向。以下是操作系统在文件管理方面的几个主要活动 −
A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. Following are the major activities of an operating system with respect to file management −
-
Program needs to read a file or write a file.
-
The operating system gives the permission to the program for operation on file.
-
Permission varies from read-only, read-write, denied and so on.
-
Operating System provides an interface to the user to create/delete files.
-
Operating System provides an interface to the user to create/delete directories.
-
Operating System provides an interface to create the backup of file system.
Communication
在分布式系统的情况下,该系统是处理器集合,不共享内存、外围设备或时钟,操作系统管理所有进程之间的通信。多个进程通过网络中的通信线路互相通信。
In case of distributed systems which are a collection of processors that do not share memory, peripheral devices, or a clock, the operating system manages communications between all the processes. Multiple processes communicate with one another through communication lines in the network.
操作系统处理路由和连接策略以及争用和安全问题。以下是操作系统在通信方面的几个主要活动 −
The OS handles routing and connection strategies, and the problems of contention and security. Following are the major activities of an operating system with respect to communication −
-
Two processes often require data to be transferred between them
-
Both the processes can be on one computer or on different computers, but are connected through a computer network.
-
Communication may be implemented by two methods, either by Shared Memory or by Message Passing.
Error handling
错误随时可能发生。错误可能发生在 CPU 中、在 I/O 设备中或在内存硬件中。以下是操作系统在错误处理方面的几个主要活动 −
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the memory hardware. Following are the major activities of an operating system with respect to error handling −
-
The OS constantly checks for possible errors.
-
The OS takes an appropriate action to ensure correct and consistent computing.
Resource Management
在多用户或多任务环境中,需要为每个用户或作业分配主存储器、CPU 周期和文件存储等资源。以下是操作系统在资源管理方面的主要活动−
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles and files storage are to be allocated to each user or job. Following are the major activities of an operating system with respect to resource management −
-
The OS manages all kinds of resources using schedulers.
-
CPU scheduling algorithms are used for better utilization of CPU.
Protection
对于具有多个用户且同时执行多个进程的计算机系统,必须保护各个进程免于彼此活动的影响。
Considering a computer system having multiple users and concurrent execution of multiple processes, the various processes must be protected from each other’s activities.
保护是指控制程序、进程或用户访问计算机系统所定义的资源的一种机制或方法。以下是操作系统在保护方面的主要活动−
Protection refers to a mechanism or a way to control the access of programs, processes, or users to the resources defined by a computer system. Following are the major activities of an operating system with respect to protection −
-
The OS ensures that all access to system resources is controlled.
-
The OS ensures that external I/O devices are protected from invalid access attempts.
-
The OS provides authentication features for each user by means of passwords.