3.1Applied Operating System Concepts
Module 3,Operating-System Structures
操作系统结构
System Components系统部件
Operating System Services操作系统服务
System Calls系统调用
System Programs系统程序
System Structure 系统结构
Virtual Machines虚拟机
System Design and Implementation系统设计和实现
System Generation系统生成
3.2Applied Operating System Concepts
Common System Components
系统部件
Process Management 进程管理
Main Memory Management主存管理
Secondary-Storage Management 二级储存器管理
I/O System Management I/O系统管理
File Management 文件管理
Protection System 保护系统
Networking 网络处理
Command-Interpreter System 命令解释器系统
3.3Applied Operating System Concepts
Process Management
进程管理
A process is a program in execution,A process needs certain
resources,including CPU time,memory,files,and I/O devices,to
accomplish its task.
进程是正在执行的程序。为了完成其任务,进程需要一定的资源,包括 CPU
时间,存储器,文件,以及 I/O设备
The operating system is responsible for the following activities in
connection with process management.
在同进程管理有关的活动中,操作系统负责下列事务:
– Process creation and deletion,进程创建和删除
– process suspension and resumption,进程挂起和恢复
– Provision of mechanisms for 可提供以下有关机制,
process synchronization 进程同步
process communication 进程通信
3.4Applied Operating System Concepts
Main-Memory Management
主存管理
Memory is a large array of words or bytes,each with its own address,It is
a repository of quickly accessible data shared by the CPU and I/O devices.
存储器是字或字节的一个大数组,每一字或字节有自己的地址。它是一个可被
CPU和 I/O 共享、可快速存取数据的存放地
Main memory is a volatile storage device,It loses its contents in the case
of system failure.主存储器是一个易失性存储设备。系统失败时,会丢失其内容
The operating system is responsible for the following activities in
connections with memory management:
在同存储管理有关的活动中,操作系统负责下列事务:
– Keep track of which parts of memory are currently being used and by
whom.
保持记录存储器的哪一部分当前被使用以及被谁使用
– Decide which processes to load when memory space becomes
available.当有可用存储空间时,决定调入哪个进程
– Allocate and deallocate memory space as needed.
需要时分配和收回存储空间
3.5Applied Operating System Concepts
Secondary-Storage Management
二级存储管理
Since main memory (primary storage) is volatile and too small to
accommodate all data and programs permanently,the computer system
must provide secondary storage to back up main memory.
由于主存(基本存储器)是易失性的,而且太小不足以永久保存所有的数据和程序,计算机系统必须提供二级存储器备份主存
Most modern computer systems use disks as the principle on-line storage
medium,for both programs and data,
多数现代计算机系统采用磁盘作为程序和数据的基本联机存储介质
The operating system is responsible for the following activities in
connection with disk management,
在同磁盘管理有关的活动中,操作系统负责下列事务:
– Free space management 空闲空间管理
– Storage allocation 存储器分配
– Disk scheduling 磁盘调度
3.6Applied Operating System Concepts
I/O System Management
I/O系统管理
The I/O system consists of,I/O 系统包括
– A buffer-caching system 缓冲区 -高速缓存系统
– A general device-driver interface 通用设备驱动器接口
– Drivers for specific hardware devices 用于特定硬件设备的驱动程序
3.7Applied Operating System Concepts
File Management
文件管理
A file is a collection of related information defined by its creator,
Commonly,files represent programs (both source and object forms)
and data.
文件是由其创建者定义的关联信息的一个收集器,通常文件表示程序(源程序和目标程序)和数据
The operating system is responsible for the following activities in
connections with file management:
在同文件管理有关的活动中,操作系统负责下列事务:
– File creation and deletion,文件创建和删除
– Directory creation and deletion,目录创建和删除
– Support of primitives for manipulating files and directories.
支持操作文件和目录的原语
– Mapping files onto secondary storage.
把文件映象到二级存储器
– File backup on stable (nonvolatile) storage media.
在稳定(非易失性)存储介质做文件副本
3.8Applied Operating System Concepts
Protection System
保护系统
Protection refers to a mechanism for controlling access by
programs,processes,or users to both system and user
resources.
保护是一种机制,控制程序、进程、或用户对系统和用户资源的访问
The protection mechanism must 保护机制必须,
– distinguish between authorized and unauthorized
usage,区分授权和非授权使用
– specify the controls to be imposed,确定要采用的控制
– provide a means of enforcement,提供强制手段
3.9Applied Operating System Concepts
Networking (Distributed Systems)
网络处理(分布式系统)
A distributed system is a collection processors that do not share
memory or a clock,Each processor has its own local memory.
分布式系统是一组不共享存储器或时钟的处理器集合,每个处理器有自己的内存
The processors in the system are connected through a communication
network.系统中的处理器通过通信网络连接
A distributed system provides user access to various system
resources.分布式系统提供用户访问各种系统资源的手段
Access to a shared resource allows:对共享资源的访问可以实现:
– Computation speed-up 加速运算
– Increased data availability 提高数据利用性
– Enhanced reliability 增强可靠性
3.10Applied Operating System Concepts
Command-Interpreter System
命令解释器系统
Many commands are given to the operating system by
control statements which deal with:
操作系统有许多命令,可以通过控制语句处理:
– process creation and management 进程创建和管理
– I/O handling 处理 I/O
– secondary-storage management 二级存储管理
– main-memory management 主存管理
– file-system access 文件访问
– protection 保护
– networking 网络
3.11Applied Operating System Concepts
Command-Interpreter System (Cont.)
命令解释器系统
The program that reads and interprets control statements is
called variously:
读入和解释控制语句的程序有各种名称
– control-card interpreter 控制卡解释器
– command-line interpreter 命令行解释器
– shell (in UNIX)
Its function is to get and execute the next command
statement,其功能是获得和执行下一个命令语句
3.12Applied Operating System Concepts
Operating System Services
操作系统服务
Program execution – system capability to load a program into memory and
to run it,程序执行 - 调入一个程序进内存并运行之的系统能力
I/O operations – since user programs cannot execute I/O operations directly,
the operating system must provide some means to perform I/O.
I/O操作 - 由于用户程序不能直接执行 I/O操作,操作系统必须提供手段完成 I/O操作
File-system manipulation – program capability to read,write,create,and
delete files,文件系统操作 - 读、写、创建和删除文件的能力
Communications – exchange of information between processes executing
either on the same computer or on different systems tied together by a
network,Implemented via shared memory or message passing.
通信 - 运行的进程在同一计算机或由网络连接的不同系统中交换信息。通过共享存储器或消息传递实现
Error detection – ensure correct computing by detecting errors in the CPU
and memory hardware,in I/O devices,or in user programs,出错检测 - 探测在 CPU与内存硬件中,在 I/O设备中,或在用户程序中的错误,确保正确运算
3.13Applied Operating System Concepts
Additional Operating System Functions
其他操作系统功能
Additional functions exist not for helping the user,but rather for ensuring
efficient system operations.
其他的功能不是用于帮助用户,而是为了系统效率:
Resource allocation – allocating resources to multiple users or
multiple jobs running at the same time.
资源分配 - 把资源分配给多个用户或多个同时运行的作业
Accounting – keep track of and record which users use how much
and what kinds of computer resources for account billing or for
accumulating usage statistics.
帐务 - 跟踪和记录用户对资源的使用,用于帐单和统计
Protection – ensuring that all access to system resources is
controlled.
保护 - 确保对资源的所有访问均在控制中
3.14Applied Operating System Concepts
System Calls
系统调用
System calls provide the interface between a running program and the
operating system.系统调用提供在运行程序和操作系统之间的接口
– Generally available as assembly-language instructions.
通常以汇编语言指令形式提供
– Languages defined to replace assembly language for systems
programming allow system calls to be made directly (e.g.,C,Bliss,
PL/360)替代汇编语言的、供系统编程的语言,允许直接使用系统调用
Three general methods are used to pass parameters between a running
program and the operating system.
3种常用方式用于在运行程序和操作系统之间的参数传递
– Pass parameters in registers,寄存器中的参数传递
– Store the parameters in a table in memory,and the table address is
passed as a parameter in a register,参数存在内存的一张表中,表地址作为寄存器的参数传递
– Push (store) the parameters onto the stack by the program,and pop off
the stack by operating system,程序把参数压入栈,由操作系统弹出
3.15Applied Operating System Concepts
Passing of Parameters As A Table
表格方式的参数传递
3.16Applied Operating System Concepts
MS-DOS Execution
MS-DOS运行
At System Start-up系统启动 Running a Program运行程序
3.17Applied Operating System Concepts
UNIX Running Multiple Programs
UNIX运行多个程序
3.18Applied Operating System Concepts
Communication Models
通信模式
Msg Passing消息传递 Shared Memory共享内存
3.19Applied Operating System Concepts
System Programs
系统程序
System programs provide a convenient environment for program
development and execution,They can be divided into:
系统提供程序开发和执行的便利环境。可划分为:
– File manipulation 文件操作
– Status information 状态信息
– File modification 文件修改
– Programming language support 程序设计语言支持
– Program loading and execution 程序调入和执行
– Communications 通信
– Application programs 应用程序
Most users’ view of the operation system is defined by system programs,
not the actual system calls,
操作系统的多数用户观点由系统程序定义而不是实际的用户调用
3.20Applied Operating System Concepts
System Structure – Simple Approach
系统结构 - 简单结构
MS-DOS – written to provide the most functionality in the
least space
MS-DOS-以最小的空间提供最多的功能
– not divided into modules 不划分模块
– Although MS-DOS has some structure,its interfaces
and levels of functionality are not well separated
尽管 MS-DOS有某种结构,其接口和功能层没有划分清楚
3.21Applied Operating System Concepts
MS-DOS Layer Structure
MS-DOS层次结构
3.22Applied Operating System Concepts
System Structure – Simple Approach (Cont.)
系统结构 - 简单结构
UNIX – limited by hardware functionality,the original UNIX operating
system had limited structuring,The UNIX OS consists of two separable
parts.
UNIX - 受硬件功能限制,早期 UNIX只是有限的结构化。 UNIX包括 2个分离的部分
– Systems programs 系统程序
– The kernel 内核
Consists of everything below the system-call interface and
above the physical hardware
包括了在物理硬件之上,系统调用之下的一切
Provides the file system,CPU scheduling,memory
management,and other operating-system functions; a large
number of functions for one level.
提供文件系统,CPU调度,存储管理,和其他操作系统功能 ;每一层有大量的功能
3.23Applied Operating System Concepts
UNIX System Structure
UNIX系统结构
3.24Applied Operating System Concepts
System Structure – Layered Approach
系统结构 - 层次化结构
The operating system is divided into a number of layers (levels),
each built on top of lower layers,The bottom layer (layer 0),is the
hardware; the highest (layer N) is the user interface.
操作系统划分为若干层,在低层上构建高层。底层( 0层)为硬件;最高层
( N层)为用户层
With modularity,layers are selected such that each uses functions
(operations) and services of only lower-level layers.
考虑模块化,层的选择是每层只使用低层次的功能和服务
3.25Applied Operating System Concepts
An Operating System Layer
操作系统层
3.26Applied Operating System Concepts
Layered Structure of the THE OS
THE OS的层次化结构
A layered design was first used in THE operating system,
Its six layers are as follows:
THE操作系统首先使用层次化设计。有如下六层:
la yer 5,use r prog rams
la yer 4,bu ffering for in pu t and ou tpu t
la yer 3,op erato r- con sol e d evi ce driv er
la yer 2,memory mana ge men t
la yer 1,C PU schedu ling
la yer 0,ha rdw are
3.27Applied Operating System Concepts
OS/2 Layer Structure
OS/2层次化结构
3.28Applied Operating System Concepts
Microkernels
微内核
Mach 首先使用微内核结构
通过划分系统程序和用户程序,把所有不必要的部件移出内核,
形成一个小内核
微内核提供最少量的进程管理、存储管理,以及通信功能
3.29Applied Operating System Concepts
Windows NT Client-Server Structure
Windows NT 客户机 -服务器结构
3.30Applied Operating System Concepts
Virtual Machines虚拟机
A virtual machine takes the layered approach to its logical conclusion,
It treats hardware and the operating system kernel as though they
were all hardware.
虚拟机是层次化的逻辑结果。它把硬件和操作系统看成都是硬件
A virtual machine provides an interface identical to the underlying
bare hardware.
虚拟机为裸机提供了统一的接口
The operating system creates the illusion of multiple processes,each
executing on its own processor with its own (virtual) memory.
操作系统创建了多个进程,每一个进程有自己的处理器和(虚拟)内存
3.31Applied Operating System Concepts
Virtual Machines虚拟机 (Cont.)
The resources of the physical computer are shared to create the virtual
machines.物理计算机的资源被共享,以创建虚拟机
– CPU scheduling can create the appearance that users have their
own processor,CPU调度使得用户好像有自己的处理器
– Spooling and a file system can provide virtual card readers and
virtual line printers,Spooling和文件系统提供了虚拟卡片阅读机和打印机
– A normal user time-sharing terminal serves as the virtual machine
operator’s console.普通用户终端成为虚拟机操作员的控制台
3.32Applied Operating System Concepts
System Models系统模式
Non-virtual Machine非虚拟机 Virtual Machine虚拟机
3.33Applied Operating System Concepts
Advantages/Disadvantages of Virtual Machines
虚拟机的优缺点
The virtual-machine concept provides complete protection of system
resources since each virtual machine is isolated from all other virtual
machines,This isolation,however,permits no direct sharing of
resources.
虚拟机概念提供对系统资源的完全保护,因为每个虚拟机同其他虚拟机隔离。
当然,隔离不允许直接共享资源
A virtual-machine system is a perfect vehicle for operating-systems
research and development,System development is done on the virtual
machine,instead of on a physical machine and so does not disrupt
normal system operation.
虚拟机是研发操作系统的完美载体。系统开发在虚拟机上而不是在物理硬件上完成,从而不会打扰正常系统运行
The virtual machine concept is difficult to implement due to the effort
required to provide an exact duplicate to the underlying machine.
由于需要对下面的机器进行精确的复制,所以虚拟机的概念实现困难
3.34Applied Operating System Concepts
Java
3.35Applied Operating System Concepts
The Java Virtual Machine
Java虚拟机
3.36Applied Operating System Concepts
The Java Platform
Java平台
3.37Applied Operating System Concepts
Java,class File on Cross Platforms
跨平台的 Java,class文件
3.38Applied Operating System Concepts
Java Development Environment
Java开发环境
3.39Applied Operating System Concepts
System Design Goals
系统设计目标
User goals – operating system should be convenient to use,
easy to learn,reliable,safe,and fast.
用户目标 - 操作系统应该便于使用,易学,可靠,安全并且快捷
System goals – operating system should be easy to design,
implement,and maintain,as well as flexible,reliable,error-
free,and efficient.
系统目标 - 操作系统应该容易设计、实现和维护,还要灵活、可靠
、无错误和高效
3.40Applied Operating System Concepts
Mechanisms and Policies
机制和策略
Mechanisms determine how to do something,policies
decide what will be done.
机制确定怎样做事,策略决定要做什么
The separation of policy from mechanism is a very important
principle,it allows maximum flexibility if policy decisions are
to be changed later.
把策略从机制中分离是非常重要的,如果策略在后期要改变,它允许最大的灵活性
3.41Applied Operating System Concepts
System Implementation
系统实现
Traditionally written in assembly language,operating systems can
now be written in higher-level languages.
传统上用汇编语言编写,现在可用高级语言编写
Code written in a high-level language:
用高级语言编写代码:
– can be written faster,编码快
– is more compact,更紧凑
– is easier to understand and debug,容易理解和调试
An operating system is far easier to port (move to some other
hardware) if it is written in a high-level language.
以高级语言编写的操作系统更容易移植
3.42Applied Operating System Concepts
System Generation (SYSGEN)
系统生成
Operating systems are designed to run on any of a class of machines; the
system must be configured for each specific computer site.
操作系统被设计在任何类型的机器上运行;系统必须能在每一特定的机器上配置
SYSGEN program obtains information concering the specific
configuration of the hardware system.
SYSGEN程序得到硬件系统特定配置的信息
Booting – starting a computer by loading the kernel.
自举 - 通过调入内核启动计算机
Bootstrap program – code stored in ROM that is able to locate the kernel,
load it into memory,and start its execution.
自举程序 - 存储在 ROM中的代码,能够定位内核,调入内存,并开始其运行
3.43Applied Operating System Concepts
3.01
3.44Applied Operating System Concepts
3.03
3.45Applied Operating System Concepts
3.04
3.46Applied Operating System Concepts
3.05
3.47Applied Operating System Concepts
3.06
3.48Applied Operating System Concepts
3.07
3.49Applied Operating System Concepts
3.08
3.50Applied Operating System Concepts
3.09
3.51Applied Operating System Concepts
3.10
3.52Applied Operating System Concepts
3.11
3.53Applied Operating System Concepts
3.12
3.54Applied Operating System Concepts
3.13
3.55Applied Operating System Concepts
3.14
3.56Applied Operating System Concepts
3.15
Module 3,Operating-System Structures
操作系统结构
System Components系统部件
Operating System Services操作系统服务
System Calls系统调用
System Programs系统程序
System Structure 系统结构
Virtual Machines虚拟机
System Design and Implementation系统设计和实现
System Generation系统生成
3.2Applied Operating System Concepts
Common System Components
系统部件
Process Management 进程管理
Main Memory Management主存管理
Secondary-Storage Management 二级储存器管理
I/O System Management I/O系统管理
File Management 文件管理
Protection System 保护系统
Networking 网络处理
Command-Interpreter System 命令解释器系统
3.3Applied Operating System Concepts
Process Management
进程管理
A process is a program in execution,A process needs certain
resources,including CPU time,memory,files,and I/O devices,to
accomplish its task.
进程是正在执行的程序。为了完成其任务,进程需要一定的资源,包括 CPU
时间,存储器,文件,以及 I/O设备
The operating system is responsible for the following activities in
connection with process management.
在同进程管理有关的活动中,操作系统负责下列事务:
– Process creation and deletion,进程创建和删除
– process suspension and resumption,进程挂起和恢复
– Provision of mechanisms for 可提供以下有关机制,
process synchronization 进程同步
process communication 进程通信
3.4Applied Operating System Concepts
Main-Memory Management
主存管理
Memory is a large array of words or bytes,each with its own address,It is
a repository of quickly accessible data shared by the CPU and I/O devices.
存储器是字或字节的一个大数组,每一字或字节有自己的地址。它是一个可被
CPU和 I/O 共享、可快速存取数据的存放地
Main memory is a volatile storage device,It loses its contents in the case
of system failure.主存储器是一个易失性存储设备。系统失败时,会丢失其内容
The operating system is responsible for the following activities in
connections with memory management:
在同存储管理有关的活动中,操作系统负责下列事务:
– Keep track of which parts of memory are currently being used and by
whom.
保持记录存储器的哪一部分当前被使用以及被谁使用
– Decide which processes to load when memory space becomes
available.当有可用存储空间时,决定调入哪个进程
– Allocate and deallocate memory space as needed.
需要时分配和收回存储空间
3.5Applied Operating System Concepts
Secondary-Storage Management
二级存储管理
Since main memory (primary storage) is volatile and too small to
accommodate all data and programs permanently,the computer system
must provide secondary storage to back up main memory.
由于主存(基本存储器)是易失性的,而且太小不足以永久保存所有的数据和程序,计算机系统必须提供二级存储器备份主存
Most modern computer systems use disks as the principle on-line storage
medium,for both programs and data,
多数现代计算机系统采用磁盘作为程序和数据的基本联机存储介质
The operating system is responsible for the following activities in
connection with disk management,
在同磁盘管理有关的活动中,操作系统负责下列事务:
– Free space management 空闲空间管理
– Storage allocation 存储器分配
– Disk scheduling 磁盘调度
3.6Applied Operating System Concepts
I/O System Management
I/O系统管理
The I/O system consists of,I/O 系统包括
– A buffer-caching system 缓冲区 -高速缓存系统
– A general device-driver interface 通用设备驱动器接口
– Drivers for specific hardware devices 用于特定硬件设备的驱动程序
3.7Applied Operating System Concepts
File Management
文件管理
A file is a collection of related information defined by its creator,
Commonly,files represent programs (both source and object forms)
and data.
文件是由其创建者定义的关联信息的一个收集器,通常文件表示程序(源程序和目标程序)和数据
The operating system is responsible for the following activities in
connections with file management:
在同文件管理有关的活动中,操作系统负责下列事务:
– File creation and deletion,文件创建和删除
– Directory creation and deletion,目录创建和删除
– Support of primitives for manipulating files and directories.
支持操作文件和目录的原语
– Mapping files onto secondary storage.
把文件映象到二级存储器
– File backup on stable (nonvolatile) storage media.
在稳定(非易失性)存储介质做文件副本
3.8Applied Operating System Concepts
Protection System
保护系统
Protection refers to a mechanism for controlling access by
programs,processes,or users to both system and user
resources.
保护是一种机制,控制程序、进程、或用户对系统和用户资源的访问
The protection mechanism must 保护机制必须,
– distinguish between authorized and unauthorized
usage,区分授权和非授权使用
– specify the controls to be imposed,确定要采用的控制
– provide a means of enforcement,提供强制手段
3.9Applied Operating System Concepts
Networking (Distributed Systems)
网络处理(分布式系统)
A distributed system is a collection processors that do not share
memory or a clock,Each processor has its own local memory.
分布式系统是一组不共享存储器或时钟的处理器集合,每个处理器有自己的内存
The processors in the system are connected through a communication
network.系统中的处理器通过通信网络连接
A distributed system provides user access to various system
resources.分布式系统提供用户访问各种系统资源的手段
Access to a shared resource allows:对共享资源的访问可以实现:
– Computation speed-up 加速运算
– Increased data availability 提高数据利用性
– Enhanced reliability 增强可靠性
3.10Applied Operating System Concepts
Command-Interpreter System
命令解释器系统
Many commands are given to the operating system by
control statements which deal with:
操作系统有许多命令,可以通过控制语句处理:
– process creation and management 进程创建和管理
– I/O handling 处理 I/O
– secondary-storage management 二级存储管理
– main-memory management 主存管理
– file-system access 文件访问
– protection 保护
– networking 网络
3.11Applied Operating System Concepts
Command-Interpreter System (Cont.)
命令解释器系统
The program that reads and interprets control statements is
called variously:
读入和解释控制语句的程序有各种名称
– control-card interpreter 控制卡解释器
– command-line interpreter 命令行解释器
– shell (in UNIX)
Its function is to get and execute the next command
statement,其功能是获得和执行下一个命令语句
3.12Applied Operating System Concepts
Operating System Services
操作系统服务
Program execution – system capability to load a program into memory and
to run it,程序执行 - 调入一个程序进内存并运行之的系统能力
I/O operations – since user programs cannot execute I/O operations directly,
the operating system must provide some means to perform I/O.
I/O操作 - 由于用户程序不能直接执行 I/O操作,操作系统必须提供手段完成 I/O操作
File-system manipulation – program capability to read,write,create,and
delete files,文件系统操作 - 读、写、创建和删除文件的能力
Communications – exchange of information between processes executing
either on the same computer or on different systems tied together by a
network,Implemented via shared memory or message passing.
通信 - 运行的进程在同一计算机或由网络连接的不同系统中交换信息。通过共享存储器或消息传递实现
Error detection – ensure correct computing by detecting errors in the CPU
and memory hardware,in I/O devices,or in user programs,出错检测 - 探测在 CPU与内存硬件中,在 I/O设备中,或在用户程序中的错误,确保正确运算
3.13Applied Operating System Concepts
Additional Operating System Functions
其他操作系统功能
Additional functions exist not for helping the user,but rather for ensuring
efficient system operations.
其他的功能不是用于帮助用户,而是为了系统效率:
Resource allocation – allocating resources to multiple users or
multiple jobs running at the same time.
资源分配 - 把资源分配给多个用户或多个同时运行的作业
Accounting – keep track of and record which users use how much
and what kinds of computer resources for account billing or for
accumulating usage statistics.
帐务 - 跟踪和记录用户对资源的使用,用于帐单和统计
Protection – ensuring that all access to system resources is
controlled.
保护 - 确保对资源的所有访问均在控制中
3.14Applied Operating System Concepts
System Calls
系统调用
System calls provide the interface between a running program and the
operating system.系统调用提供在运行程序和操作系统之间的接口
– Generally available as assembly-language instructions.
通常以汇编语言指令形式提供
– Languages defined to replace assembly language for systems
programming allow system calls to be made directly (e.g.,C,Bliss,
PL/360)替代汇编语言的、供系统编程的语言,允许直接使用系统调用
Three general methods are used to pass parameters between a running
program and the operating system.
3种常用方式用于在运行程序和操作系统之间的参数传递
– Pass parameters in registers,寄存器中的参数传递
– Store the parameters in a table in memory,and the table address is
passed as a parameter in a register,参数存在内存的一张表中,表地址作为寄存器的参数传递
– Push (store) the parameters onto the stack by the program,and pop off
the stack by operating system,程序把参数压入栈,由操作系统弹出
3.15Applied Operating System Concepts
Passing of Parameters As A Table
表格方式的参数传递
3.16Applied Operating System Concepts
MS-DOS Execution
MS-DOS运行
At System Start-up系统启动 Running a Program运行程序
3.17Applied Operating System Concepts
UNIX Running Multiple Programs
UNIX运行多个程序
3.18Applied Operating System Concepts
Communication Models
通信模式
Msg Passing消息传递 Shared Memory共享内存
3.19Applied Operating System Concepts
System Programs
系统程序
System programs provide a convenient environment for program
development and execution,They can be divided into:
系统提供程序开发和执行的便利环境。可划分为:
– File manipulation 文件操作
– Status information 状态信息
– File modification 文件修改
– Programming language support 程序设计语言支持
– Program loading and execution 程序调入和执行
– Communications 通信
– Application programs 应用程序
Most users’ view of the operation system is defined by system programs,
not the actual system calls,
操作系统的多数用户观点由系统程序定义而不是实际的用户调用
3.20Applied Operating System Concepts
System Structure – Simple Approach
系统结构 - 简单结构
MS-DOS – written to provide the most functionality in the
least space
MS-DOS-以最小的空间提供最多的功能
– not divided into modules 不划分模块
– Although MS-DOS has some structure,its interfaces
and levels of functionality are not well separated
尽管 MS-DOS有某种结构,其接口和功能层没有划分清楚
3.21Applied Operating System Concepts
MS-DOS Layer Structure
MS-DOS层次结构
3.22Applied Operating System Concepts
System Structure – Simple Approach (Cont.)
系统结构 - 简单结构
UNIX – limited by hardware functionality,the original UNIX operating
system had limited structuring,The UNIX OS consists of two separable
parts.
UNIX - 受硬件功能限制,早期 UNIX只是有限的结构化。 UNIX包括 2个分离的部分
– Systems programs 系统程序
– The kernel 内核
Consists of everything below the system-call interface and
above the physical hardware
包括了在物理硬件之上,系统调用之下的一切
Provides the file system,CPU scheduling,memory
management,and other operating-system functions; a large
number of functions for one level.
提供文件系统,CPU调度,存储管理,和其他操作系统功能 ;每一层有大量的功能
3.23Applied Operating System Concepts
UNIX System Structure
UNIX系统结构
3.24Applied Operating System Concepts
System Structure – Layered Approach
系统结构 - 层次化结构
The operating system is divided into a number of layers (levels),
each built on top of lower layers,The bottom layer (layer 0),is the
hardware; the highest (layer N) is the user interface.
操作系统划分为若干层,在低层上构建高层。底层( 0层)为硬件;最高层
( N层)为用户层
With modularity,layers are selected such that each uses functions
(operations) and services of only lower-level layers.
考虑模块化,层的选择是每层只使用低层次的功能和服务
3.25Applied Operating System Concepts
An Operating System Layer
操作系统层
3.26Applied Operating System Concepts
Layered Structure of the THE OS
THE OS的层次化结构
A layered design was first used in THE operating system,
Its six layers are as follows:
THE操作系统首先使用层次化设计。有如下六层:
la yer 5,use r prog rams
la yer 4,bu ffering for in pu t and ou tpu t
la yer 3,op erato r- con sol e d evi ce driv er
la yer 2,memory mana ge men t
la yer 1,C PU schedu ling
la yer 0,ha rdw are
3.27Applied Operating System Concepts
OS/2 Layer Structure
OS/2层次化结构
3.28Applied Operating System Concepts
Microkernels
微内核
Mach 首先使用微内核结构
通过划分系统程序和用户程序,把所有不必要的部件移出内核,
形成一个小内核
微内核提供最少量的进程管理、存储管理,以及通信功能
3.29Applied Operating System Concepts
Windows NT Client-Server Structure
Windows NT 客户机 -服务器结构
3.30Applied Operating System Concepts
Virtual Machines虚拟机
A virtual machine takes the layered approach to its logical conclusion,
It treats hardware and the operating system kernel as though they
were all hardware.
虚拟机是层次化的逻辑结果。它把硬件和操作系统看成都是硬件
A virtual machine provides an interface identical to the underlying
bare hardware.
虚拟机为裸机提供了统一的接口
The operating system creates the illusion of multiple processes,each
executing on its own processor with its own (virtual) memory.
操作系统创建了多个进程,每一个进程有自己的处理器和(虚拟)内存
3.31Applied Operating System Concepts
Virtual Machines虚拟机 (Cont.)
The resources of the physical computer are shared to create the virtual
machines.物理计算机的资源被共享,以创建虚拟机
– CPU scheduling can create the appearance that users have their
own processor,CPU调度使得用户好像有自己的处理器
– Spooling and a file system can provide virtual card readers and
virtual line printers,Spooling和文件系统提供了虚拟卡片阅读机和打印机
– A normal user time-sharing terminal serves as the virtual machine
operator’s console.普通用户终端成为虚拟机操作员的控制台
3.32Applied Operating System Concepts
System Models系统模式
Non-virtual Machine非虚拟机 Virtual Machine虚拟机
3.33Applied Operating System Concepts
Advantages/Disadvantages of Virtual Machines
虚拟机的优缺点
The virtual-machine concept provides complete protection of system
resources since each virtual machine is isolated from all other virtual
machines,This isolation,however,permits no direct sharing of
resources.
虚拟机概念提供对系统资源的完全保护,因为每个虚拟机同其他虚拟机隔离。
当然,隔离不允许直接共享资源
A virtual-machine system is a perfect vehicle for operating-systems
research and development,System development is done on the virtual
machine,instead of on a physical machine and so does not disrupt
normal system operation.
虚拟机是研发操作系统的完美载体。系统开发在虚拟机上而不是在物理硬件上完成,从而不会打扰正常系统运行
The virtual machine concept is difficult to implement due to the effort
required to provide an exact duplicate to the underlying machine.
由于需要对下面的机器进行精确的复制,所以虚拟机的概念实现困难
3.34Applied Operating System Concepts
Java
3.35Applied Operating System Concepts
The Java Virtual Machine
Java虚拟机
3.36Applied Operating System Concepts
The Java Platform
Java平台
3.37Applied Operating System Concepts
Java,class File on Cross Platforms
跨平台的 Java,class文件
3.38Applied Operating System Concepts
Java Development Environment
Java开发环境
3.39Applied Operating System Concepts
System Design Goals
系统设计目标
User goals – operating system should be convenient to use,
easy to learn,reliable,safe,and fast.
用户目标 - 操作系统应该便于使用,易学,可靠,安全并且快捷
System goals – operating system should be easy to design,
implement,and maintain,as well as flexible,reliable,error-
free,and efficient.
系统目标 - 操作系统应该容易设计、实现和维护,还要灵活、可靠
、无错误和高效
3.40Applied Operating System Concepts
Mechanisms and Policies
机制和策略
Mechanisms determine how to do something,policies
decide what will be done.
机制确定怎样做事,策略决定要做什么
The separation of policy from mechanism is a very important
principle,it allows maximum flexibility if policy decisions are
to be changed later.
把策略从机制中分离是非常重要的,如果策略在后期要改变,它允许最大的灵活性
3.41Applied Operating System Concepts
System Implementation
系统实现
Traditionally written in assembly language,operating systems can
now be written in higher-level languages.
传统上用汇编语言编写,现在可用高级语言编写
Code written in a high-level language:
用高级语言编写代码:
– can be written faster,编码快
– is more compact,更紧凑
– is easier to understand and debug,容易理解和调试
An operating system is far easier to port (move to some other
hardware) if it is written in a high-level language.
以高级语言编写的操作系统更容易移植
3.42Applied Operating System Concepts
System Generation (SYSGEN)
系统生成
Operating systems are designed to run on any of a class of machines; the
system must be configured for each specific computer site.
操作系统被设计在任何类型的机器上运行;系统必须能在每一特定的机器上配置
SYSGEN program obtains information concering the specific
configuration of the hardware system.
SYSGEN程序得到硬件系统特定配置的信息
Booting – starting a computer by loading the kernel.
自举 - 通过调入内核启动计算机
Bootstrap program – code stored in ROM that is able to locate the kernel,
load it into memory,and start its execution.
自举程序 - 存储在 ROM中的代码,能够定位内核,调入内存,并开始其运行
3.43Applied Operating System Concepts
3.01
3.44Applied Operating System Concepts
3.03
3.45Applied Operating System Concepts
3.04
3.46Applied Operating System Concepts
3.05
3.47Applied Operating System Concepts
3.06
3.48Applied Operating System Concepts
3.07
3.49Applied Operating System Concepts
3.08
3.50Applied Operating System Concepts
3.09
3.51Applied Operating System Concepts
3.10
3.52Applied Operating System Concepts
3.11
3.53Applied Operating System Concepts
3.12
3.54Applied Operating System Concepts
3.13
3.55Applied Operating System Concepts
3.14
3.56Applied Operating System Concepts
3.15