Upload
magdalene-curtis
View
227
Download
1
Embed Size (px)
Citation preview
1
Operating System Overview
Chapter 2
2
Operating System
A program that controls the execution of application programs
An interface between applications and hardware
3
Operating System Objectives
Convenience( 方便 ) Makes the computer more convenient to use
Efficiency( 有效 ) Allows computer system resources to be used
in an efficient mannerAbility to evolve( 扩展的能力 )
It should have the capability to permit the effective development, testing & introduction of new system functions.
4
Layers of Computer System
5
Services Provided by the Operating System
Program development (程序开发) Editors (编辑器) and debuggers
(调试器) Program execution (程序运行) Access to I/O devices (访问 I/O 设备) Controlled access to files (控制访问文
件) System access (系统访问)
6
Services Provided by the Operating System
Error detection and response (错误检测和响应) Internal and external hardware errors
Memory errorDevice failure
Software errorsArithmetic overflowAccess forbidden memory locationsOperating system cannot grant request of
application
7
Operating System as Resource Manager
Responsible for managing resources Functions same way as ordinary computer
software
It is a program executed by the processor Operating system relinquishes control of
the processor
In fact, the OS is a computer program.
8
The OS directs the processor in the use of the other system resources and in the timing of its execution of other programs.
9
Kernel (核心程序)
Portion of operating system that is in main memory
Contains most frequently used functions
Also called the nucleus
10
Evolution of an Operating System
Hardware upgrades plus new types of hardware
New servicesFixes (修正)The system should be modular in
construction, with clearly defined interfaces between the modules.
11
Evolution of Operating Systems
Serial Processing (串行处理) No operating system Machines run from a console with display lights
( 显示灯 ), toggle switches (触发器) , input device, and printer
Computer systems were used in a serial fashion, meaning access to the computer was available in series.
Programmers were directly interacting with the computer system.
12
Evolution of Operating Systems
Schedule time( 调度 )imagine if some body has schedual to use it
for 3 hours and some how finished in 30 minute. Therefore, the remaining 2 hours 30 minute are wasted as nothing is schedual for that period.
Setup included loading the compiler, source program, saving compiled program (目标程序) , and loading and linking
13
Evolution of Operating Systems
Simple Batch Systems (简单批处理)( IBSYS )
Monitors(监控程序)Software that controls the sequence of eventsUser no longer has direct access to the machineBatch jobs together sequentially, and used by
the monitorProgram branches back to monitor when
finished
14
Two points to Simple Batch Systems
Monitor point The monitor is the one controlling every
thing. Much of the monitor must always be in
main memory and available for execution, it is called resident monitor.
When read in job, the control is passed to this job; when it is completed, it returns control to the monitor.
15
Two points to Simple Batch Systems
Processor point The processor is executing instructions from the
portion of main memory containing the monitor. When a job has been read in, the processor will
encounter a branch instruction in the monitor that instructs the processor to continue execution at the start of the user program.
When complete the job, the processor fetch its next instruction from the monitor program.
16
Hardware Features( 硬件功能 )
The batch OS relies on the ability of processor to fetch instructions from various portions of main memory.
Again, there are other hardware features: Memory protection (存储器保护)
Do not allow the memory area containing the monitor to be altered
Timer (计时器) Prevents a job from monopolizing (独
占) the system
17
Hardware Features
Privileged instructions (特权指令) Certain machine level instructions can
only be executed by the monitor. For example, I/O instructions
Interrupts Early computer models did not have
this capability
18
Memory Protection
User program executes in user mode Certain instructions may not be
executed Monitor executes in system mode
Kernel mode Privileged instructions are executed Protected areas of memory may be
accessed
19
Batch operating system
Machine time alternates between execution of user programs and execution of the monitor
Two sacrifices: Some main memory is now given over to
the monitor Some machine time is consumed by the
monitor
20
I/O Devices Slow
The computer spends over 96% of its time waiting for I/O devices to finish transferring
data
21
Uniprogramming( 单道程序 )
Processor must wait for I/O instruction to complete before preceding
22
Multiprogramming( 多道程序 )
When one job needs to wait for I/O, the processor can switch to the other job
23
Multiprogramming
24
Example
25
Utilization Histograms(利用率 )
26
Multiprogramming
The most notable additional feature that is useful for Multiprogramming is the hardware that supports I/O interrupts and DMA.
To have several jobs ready to run, they must be kept in main memory, requiring some form of memory management.
It also requires some algorithm for scheduling.
27
Time-Sharing Systems( 分时系统 )
Using multiprogramming to handle multiple interactive( 交互式 ) jobs
Processor’s time is shared among multiple users
Multiple users simultaneously access the system through terminals
The OS interleave the execution of each user program in a short time
28
Compatible Time-Sharing System (CTSS)
First time-sharing system developed at MIT
29
Some new problems
If multiple jobs are in memory, then they must by protected from interfering with each other
With multiple interactive users, the file system must be protected so that only authorized users have access to a particular file
Handle the contention for resources
30
Major Achievements
Processes (进程) Memory Management (存储器管理) Information protection and security
(信息保护和安全) Scheduling and resource
management (调度和资源管理) System structure (系统结构)
31
Difficulties with Designing System Software
Improper synchronization (不正确的同步) Ensure a process waiting for an I/O device
receives the signal Failed mutual exclusion (失败的互斥) Nondeterminate program operation (不确定的
程序操作) Program should only depend on input to it,
not on the activities of other programs Deadlocks (死锁)
32
Processes
A program in execution An instance of a program running on a
computer The entity that can be assigned to and
executed on a processor A unit of activity characterized by a single
sequential thread of execution (顺序的执行线程) , a current state (当前状态) , and an associated set of system resources (相关的系统资源)
33
Process
Consists of three components : An executable program Associated data needed by the
program Execution context of the program
All information the operating system needs to manage the process
34
Process
35
Memory Management
Process isolation (进程隔离) Automatic allocation and management
(自动分配和管理) Support of modular programming (支持
模块化程序设计) Protection and access control (保护和访
问控制) Long-term storage (长期存储)
36
Virtual Memory
Allows programmers to address memory from a logical point of view
Meet the requirement of having multiple user jobs reside in main memory concurrently
No hiatus (缝隙) between the execution of successive processes while one process was written out to secondary store and the successor (后继) process was read in
37
Virtual Memory
38
Virtual Memory Addressing
39
File System
Implements long-term storeInformation stored in named
objects called files
40
Information Protection and Security
Availability( 可用性 ) Concerned with protecting the system
against interruption
Confidentiality( 机密性 ) Assuring that users cannot read data
for which access is unauthorized
41
Information Protection and Security
Data integrity( 数据完整性 ) Protection of data from
unauthorized modificationAuthenticity( 认证 )
Concerned with the proper verification of the identity of users and the validity of messages or data
42
Scheduling and Resource Management
Fairness (公平性) Give equal and fair access to resources
Differential responsiveness (有差别的响应性) Discriminate among different classes of jobs
Efficiency (有效性) Maximize throughput, minimize response
time, and accommodate as many users as possible
43
Key Elements ofOperating System
44
System Structure
View the system as a series of levels Each level performs a related subset of
functions Each level relies on the next lower level to
perform more primitive functions This decomposes a problem into a number
of more manageable subproblems
45
Modern Operating Systems
Microkernel architecture (微内核结构) Assigns only a few essential functions to the
kernel Multithreading (多线程)
Process is divided into threads that can run concurrently, it is a collection of one or more threads
Thread:Dispatchable unit of workexecutes sequentially and is interruptable
46
Modern Operating Systems
Symmetric multiprocessing (SMP, 对称多处理 ) There are multiple processors These processors share same main
memory and I/O facilities All processors can perform the
same functions
47
Multiprogramming and Multiprocessing