1.4 Basic Operating System Concepts
基本的操作系統概念
Each computer system includes a basic set of PRograms called the operating system. The most important program in the set is called the kernel. It is loaded into RAM when the system boots and contains many critical procedures that are needed for the system to operate. The other programs are less crucial utilities; they can provide a wide variety of interactive experiences for the user—as well as doing all the jobs the user bought the computer for—but the essential shape and capabilities of the system are determined by the kernel. The kernel provides key facilities to everything else on the system and determines many of the characteristics of higher software. Hence, we often use the term "operating system" as a synonym for "kernel."
任何一個計算機系統都包含一個基本的程序集,又稱為操作系統。在這個程序集中最重要的程序叫做kernel(內核)。當系統引導時,內核就被裝進RAM,它還包含許多能夠讓系統運行起來的關鍵規程;其它的程序相對來說并不是非常的重要;它們能為用戶提供各種各樣的交互式體驗----做這些工作也是用戶購買計算機的原因;但是內核決定了系統的本質形態以及做這些工作的能力;內核不僅為計算機系統提供關鍵設備資源,而且也決定著高層軟件的特征。因此,我們常用“操作系統“這個術語來代替”kernel(內核)“ ;
The operating system must fulfill two main objectives:
操作系統必須實現兩個主要目標:
· Interact with the hardware components, servicing all low-level programmable elements included in the hardware platform.
和硬件部件相結合,維護包括在硬件平臺上的所有底層的可編程元件;
· Provide an execution environment to the applications that run on the computer system (the so-called user programs).
為運行在操作系統上的應用程序(所謂的用戶程序)提供一個執行環境
Some operating systems allow all user programs to directly play with the hardware components (a typical example is MS-DOS). In contrast, a Unix-like operating system hides all low-level details concerning the physical organization of the computer from applications run by the user. When a program wants to use a hardware resource, it must issue a request to the operating system. The kernel evaluates the request and, if it chooses to grant the resource, interacts with the relative hardware components on behalf of the user program.
許多操作系統允許用戶程序直接的利用硬件部件;(一個典型的例子是MS-DOS)相反,類Unix系統隱藏了來自于用戶程序所涉及到的計算機物理組織的所有底層細節;但當一個程序想使用硬件資源時,它必須發送一個請求給操作系統;內核評估這個請求,如果相關的硬件部件支持用戶程序,內核就分配資源;
To enforce this mechanism, modern operating systems rely on the availability of specific hardware features that forbid user programs to directly interact with low-level hardware components or to access arbitrary memory locations. In particular, the hardware introduces at least two different execution modes for the CPU: a nonprivileged mode for user programs and a privileged mode for the kernel. Unix calls these User Mode and Kernel Mode, respectively.
為了這種機制的實施,現在的操作系統依賴于指定硬件可選件的有效性,如禁止用戶程序直接和底層硬件部件相結合或者是禁止用戶程序任意的存取內存單元.特別提出CPU至少要有兩種不同的執行模式:一種用戶程序使用的非特權模式和一種內核使用的特權模式;Unix分別稱它們為用戶模式和內核模式;
In the rest of this chapter, we introduce the basic concepts that have motivated the design of Unix over the past two decades, as well as linux and other operating systems. While the concepts are probably familiar to you as a Linux user, these sections try to delve into them a bit more deeply than usual to explain the requirements they place on an operating system kernel. These broad considerations refer to virtually all Unix-like systems. The other chapters of this book will hopefully help you understand the Linux kernel internals.
在這一章的最后,我們介紹一些基本概念,這些概念在過去的二十年間推動了像Linux,Unix和其它一些操作系統的設計.作為一個Linux的用戶,你也許相當熟悉這些概念,這些部分試圖鉆研一下這些概念,以便解釋它們在一個操作系統內核上放置了那些需求;這些概念的考慮涉及到了所有的類Unix系統.而這本書的其它章希望能幫助你理解Linux內核的內部構件;
1.4.1 Multiuser Systems
多任務系統
A multiuser system is a computer that is able to concurrently and independently execute several applications belonging to two or more users. Concurrently means that applications can be active at the same time and contend for the various resources such as CPU, memory, hard disks, and so on. Independently means that each application can perform its task with no concern for what the applications of the other users are doing. Switching from one application to another, of course, slows down each of them and affects the response time seen by the users. Many of the complexities of modern operating system kernels, which we will examine in this book, are present to minimize the delays enforced on each program and to provide the user with responses that are as fast as possible.
一個多任務系統是一個能夠同時并且獨立的執行屬于兩個和多個用戶的應用程序的計算機. 同時,意味著幾個應用程序能在同一時間處于執行態,并且能夠競爭諸如CPU,內存,硬磁盤等多種資源;獨立意味著每一個應用程序能完成它的工作而無需考慮其它用戶的應用程序正在做些什么;當然,從一個應用程序切換到另一個應用程序,會減慢它們的速度并且影響到達用戶的響應時間.當代的操作系統內核是非常復雜的,它們盡可能的減少每一個應用程序的延遲以及為用戶提供盡可能快的響應時間.我們將在這本書中考察這些知識;
Multiuser operating systems must include several features:
多任務操作系統必須包括的幾個特征:
· An authentication mechanism for verifying the user's identity
認證機制,用來檢驗用戶身份
· A protection mechanism against buggy user programs that could block other applications running in the system
保護機制,防止出錯的用戶程序阻礙在系統中其它應用程序的運行;
· A protection mechanism against malicious user programs that could interfere with or spy on the activity of other users
保護機制,阻止惡意的用戶程序妨礙或者監視其它用戶的活動
· An accounting mechanism that limits the amount of resource units assigned to each user
計數機制,限制分配給每個用戶的資源單元數目
To ensure safe protection mechanisms, operating systems must use the hardware protection associated with the CPU privileged mode. Otherwise, a user program would be able to directly access the system circuitry and overcome the imposed bounds. Unix is a multiuser system that enforces the hardware protection of system resources.
為了保證能實現這些安全保護機制,操作系統必須使用和硬件保護關聯的CPU特權模式.否則,用戶程序將能夠自己存取系統電路并且克服這些強加的限制;Unix是一個實施系統資源硬件保護的多任務系統;
新聞熱點
疑難解答