Top Banner
1.1/57 个个个个 个个个个 杨杨杨 杨杨杨杨 杨杨杨杨 杨杨杨杨杨 、、 杨杨杨杨杨杨杨 杨杨杨杨杨杨杨杨杨 杨杨 杨杨杨 杨杨杨杨杨杨杨杨 杨杨杨杨杨杨杨杨杨 杨杨杨杨杨杨杨杨杨杨—杨杨杨杨杨杨杨杨杨杨杨杨 http://mla.sdu.edu.cn/ygp.html Email: [email protected] Phone:15865251995 Office: 杨杨杨 304
57

1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

Dec 26, 2015

Download

Documents

Eric Hunter
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.1/57

个人简介个人简介

杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员 智能信息处理研究中心—机器学习与数据挖掘实

验室 http://mla.sdu.edu.cn/ygp.html

Email: [email protected]

Phone:15865251995

Office: 学科楼 304

Page 2: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.2/57

关于课程关于课程

接触 OS 的四类人员: OS 设计者, OS 管理员,开发人员,一般用户 操作系统漫谈 关于实验、作业 、考勤 关于考核:考试 75%+ 实验 15%+( 作业 + 考勤 )10%

参考书: 西电出版社 汤子灜 计算机操作系统 该书中文版 郑扣根译

上课的重要性! 访问教务处课程中心!!!!!!

Page 3: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.3/57

教学内容教学内容

Part one : Overview

Part two : Process Management

Part three : Memory Management

Part four: Storage Management

Part five: Protection and Security

Page 4: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.4/57

Part onePart one :: OverviewOverview

An operating system acts as an intermediary between the user of a computer and the computer hardware.

The purpose of an operating system is to provide an environment in which a user can execute programs in a convenient and efficient manner.

An operating system is software that manages the computer hardware. The hardware must provide appropriate mechanisms to ensure the correct operation of the computer system and to prevent user programs from interfering with the proper operation of the system.

P2

Page 5: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

Chapter 1: IntroductionChapter 1: Introduction

Page 6: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.6/57

Chapter 1: IntroductionChapter 1: Introduction

What Operating Systems Do

Computer-System Organization

Operating-System Structure

Operating-System Operations

Process Management

Memory Management

Storage Management

Protection and Security

Page 7: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.7/57

ObjectivesObjectives

To provide a grand tour of the major operating systems components

To provide coverage of basic computer system organization

Page 8: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.8/57

What is an Operating System?What is an Operating System?

A program that acts as an intermediary between a user of a computer and the computer hardware.

The purpose of an operating system is to provide an environment in which a user can execute programs in a convenient and efficient manner.

操作系统的总体目标: 使计算机系统方便使用 convenient 使硬件能高效利用 efficient

P3

Page 9: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.9/57

不同类型的操作系统设计目标不同

An amazing aspect of operating system systems is how varied they are in accomplishing these tasks

Mainframe operating systems are designed primarily to optimize utilization of hardware

Personal Computer operating systems support complex games, business applications, and everything in between.

Operating systems for handheld computers are designed to provide an environment in which a user can easily interface with the computer to execute programs

Thus, some operating systems are designed to be convenient, others to be efficient, and others some combination of the two.

P3

Page 10: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.10/57

Four Components of a Computer SystemFour Components of a Computer System

Page 11: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.11/57

Computer System StructureComputer System Structure

Computer system can be divided into four components

Hardware – provides basic computing resources

Operating system

Application programs – define the ways in which the system resources are used to solve the computing problems of the users

Users

People, machines, other computers

P4

Page 12: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.12/57

OS in computer systemOS in computer system

Controls and coordinates use of hardware among various applications and users

We also view a computer system as consisting of hardware , software, and data. The operating system provides the means for proper use of these resources in the operation of the computer system

An operating system is similar to a government. It performs no useful function by itself. It simply provides an environment within which other programs can do useful work.

P4

Page 13: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.13/57

研究操作系统的两种观点研究操作系统的两种观点

User View

the user’s view of the computer varies according to the interface being used.

System View

From the computer’s point of view, the operating system is the program mostly intimately involved with hardware

P4

Page 14: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.14/57

User ViewUser View

PC: the operating system is designed mostly for ease of use, with some attention paid to performance and none paid to resource utilization

Mainframe or minicomputer: The operating system in such cases is designed to maximize resource utilization to assure that all available CPU time, memory, and I/O are used efficiently and that no individual user takes more than her fair share.

Page 15: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.15/57

User ViewUser View

Workstation: their operating system is designed to compromise between individual usability and resource utilization.

Handheld computers: Their operating systems are designed mostly for individual usability, but performance per amount of battery life is important as well.

Embedded computers: have little or no user view, are designed primarily to run without user intervention

Page 16: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.16/57

System ViewSystem View

OS is a resource allocator

Manages all resources

Decides between conflicting requests for efficient and fair resource use

the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly.

OS is a control program

Controls execution of programs to prevent errors and improper use of the computer

P5

Page 17: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.17/57

Operating System Definition Operating System Definition

No universally accepted definition

Operating systems exist because they offer a reasonable way to solve the problem of creating a usable computing system.

The fundamental goal of computer systems is to execute user programs and to make solving user problems easier.

Toward this goal, computer hardware is constructed. Since bare hardware alone is not particularly easy to use, application programs are developed.

These programs require certain common operations, such as those controlling the I/O devices. The common functions of controlling and allocating resources are then brought together into one piece of software: the operating system.

P5

Page 18: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.18/57

Operating System Definition (Cont.)Operating System Definition (Cont.)

“The one program running at all times on the computer” is the kernel. Everything else is either a system program (ships with the operating system) or an application program--A more common definition

The matter of what constitutes an operating system has become increasingly important. In 1998, the United States Department of Justice filed suit against Microsoft, in essence claiming that Microsoft included too much functionality in its operating systems and thus prevented application vendors from competing. For example: IE web browser.

操作系统是一组控制和管理计算机硬件和软件资源、合理地对各类作业进行调度以及方便用户的程序的集合。

Page 19: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.19/57

Computer System OrganizationComputer System Organization

Computer-system operation

One or more CPUs, device controllers connect through common bus providing access to shared memory

Concurrent execution of CPUs and devices competing for memory cycles

P6

Page 20: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.20/57

Computer StartupComputer Startup

bootstrap program is loaded at power-up or reboot

Typically stored in ROM or EPROM, generally known as firmware

Initializates all aspects of system

Loads operating system kernel and starts execution

Page 21: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.21/57

Computer-System OperationComputer-System Operation

I/O devices and the CPU can execute concurrently.

Each device controller is in charge of a particular device type.

Each device controller has a local buffer.

CPU moves data from/to main memory to/from local buffers

I/O is from the device to local buffer of controller.

Device controller informs CPU that it has finished its operation by causing an interrupt.

P7

Page 22: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.22/57

Common Functions of InterruptsCommon Functions of Interrupts

Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines.

Interrupt architecture must save the address of the interrupted instruction.

Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt.

A trap is a software-generated interrupt caused either by an error or a user request.

An operating system is interrupt driven.

Page 23: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.23/57

Interrupt HandlingInterrupt Handling

The operating system preserves the state of the CPU by storing registers and the program counter.

Determines which type of interrupt has occurred:

polling

vectored interrupt system

Separate segments of code determine what action should be taken for each type of interrupt

Page 24: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.24/57

Interrupt TimelineInterrupt Timeline

Page 25: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.25/57

Storage Structure

Computer programs must be in main memory (also called random-access memory or RAM) to be executed. Main memory is the only large storage area (millions to billions of bytes) that the processor can access directly.

A typical instruction-execution cycle, as executed on a system with a von Neumann architecture, first fetches an instruction from memory and stores that instruction in the instruction register. The instruction is then decoded and may cause operands to be fetched from memory and stored in some internal register.

most computer systems provide secondary storage as an extension of main memory. The main requirement for secondary storage is that it be able to hold large quantities of data permanently.

P8

Page 26: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.26/57

Storage-Device HierarchyStorage-Device Hierarchy

Page 27: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.27/57

I/O StructureI/O Structure

After I/O starts, control returns to user program only upon I/O completion. Wait instruction idles the CPU until the next interrupt Wait loop (contention for memory access). At most one I/O request is outstanding at a time, no

simultaneous I/O processing.

P10

Page 28: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.28/57

I/O StructureI/O Structure

After I/O starts, control returns to user program without waiting for I/O completion. System call – request to the operating system to allow

user to wait for I/O completion. Device-status table contains entry for each I/O device

indicating its type, address, and state. Operating system indexes into I/O device table to

determine device status and to modify table entry to include interrupt.

Page 29: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.29/57

Two I/O MethodsTwo I/O Methods

Synchronous Asynchronous

Page 30: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.30/57

Device-Status TableDevice-Status Table

Page 31: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.31/57

Direct Memory Access StructureDirect Memory Access Structure

Used for high-speed I/O devices able to transmit information at close to memory speeds.

Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention.

Only one interrupt is generated per block, rather than the one interrupt per byte.

P11

Page 32: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.32/57

Operating System StructureOperating System Structure

Multiprogramming needed for efficiency Single user cannot keep CPU and I/O devices

busy at all times Multiprogramming organizes jobs (code and

data) so CPU always has one to execute A subset of total jobs in system is kept in

memory One job selected and run via job scheduling When it has to wait (for I/O for example), OS

switches to another job

P15

Page 33: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.33/57

Memory Layout for Multiprogrammed SystemMemory Layout for Multiprogrammed System

Page 34: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.34/57

Operating System StructureOperating System Structure

Multiprogrammed systems provide an environment in which the various system resources (for example, CPU, memory, and peripheral devices) are utilized effectively, but they do not provide for user interaction with the computer system.

Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing

As the system switches rapidly from one user to the next, each user is given the impression that the entire computer system is dedicated to his use, even though it is being shared among many users.

P16

Page 35: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.35/57

带来的问题带来的问题 Job scheduling

CPU scheduling

Memory management

File system/Disk management

provide a mechanism for protecting resources from inappropriate use

provide mechanisms for job synchronization and communication

ensure that jobs do not get stuck in a deadlock, forever waiting for one another P17

Page 36: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.36/57

Operating-System OperationsOperating-System Operations

Modern operating systems are interrupt driven. If there are no processes to execute, no I/O devices to service, and no users to whom to respond, an operating system will sit quietly, waiting for something to happen.

Events are almost always signaled by the occurrence of an interrupt or a trap.

A trap (or an exception) is a software-generated interrupt caused either by an error (for example, division by zero or invalid memory access) or by a specific request from a user program that an operating-system service be performed.

P17-18

Page 37: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.37/57

Operating-System OperationsOperating-System Operations

Since the operating system and the users share the hardware and software resources of the computer system, we need to make sure that an error in a user program could cause problems only for the one program that was running.

With sharing, many processes could be adversely affected by a bug in one program. For example, if a process gets stuck in an infinite loop, this loop could prevent the correct operation of many other processes.

Page 38: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.38/57

Operating-System OperationsOperating-System Operations

More subtle errors can occur in a multiprogramming system, where one erroneous program might modify another program, the data of another program, or even the operating system itself.

Without protection against these sorts of errors, either the computer must execute only one process at a time or all output must be suspect. A properly designed operating system must ensure that an incorrect (or malicious) program cannot cause other programs to execute incorrectly.

Page 39: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.39/57

Dual-mode operationDual-mode operation

In order to ensure the proper execution of the operating system, we must be able to distinguish between the execution of operating-system code and user defined.

Dual-mode operation allows OS to protect itself and other system components

kernel mode(0) and User mode(1)

Mode bit provided by hardware

Provides ability to distinguish when system is running user code or kernel code

P18

Page 40: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.40/57

Transition from User to Kernel ModeTransition from User to Kernel Mode

When the computer system is executing on behalf of a user application, the system is in user mode. However, when a user application requests a service from the operating system (via a system call), it must transition from user to kernel mode to fulfill the request.

Page 41: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.41/57

Transition from User to Kernel ModeTransition from User to Kernel Mode

At system boot time, the hardware starts in kernel mode. The operating system is then loaded and starts user applications in user mode. Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode (that is, changes the state of the mode bit to 0). Thus, whenever the operating system gains control of the computer, it is in kernel mode. The system always switches to user mode (by setting the mode bit to 1) before passing control to a user program.

Page 42: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.42/57

Transition from User to Kernel ModeTransition from User to Kernel Mode

The dual mode of operation provides us with the means for protecting the operating system from errant users-and errant users from one another. We accomplish this protection by designating some of the machine instructions that may cause harm as privileged instructions.

The hardware allows privileged instructions to be executed only in kernel mode.

Page 43: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.43/57

Transition from User to Kernel ModeTransition from User to Kernel Mode

The instruction to switch to user mode is an example of a privileged instruction. Some other examples include I/O control, timer management, and interrupt management.

System calls provide the means for a user program to ask the operating system to perform tasks reserved for the operating system on the user program's behalf.

Page 44: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.44/57

TimerTimer

We must ensure that the operating system maintains control over the CPU. We must prevent a user program from getting stuck in an infinite loop or not calling system services and never returning control to the operating system.

To accomplish this goal, we can use a timer.

A timer can be set to interrupt the computer after a specified period.

The operating system sets the counter.

Every time the clock ticks, the counter is decremented.

When the counter reaches 0, an interrupt occurs.

we can use the timer to prevent a user program from running too long.

P20

Page 45: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.45/57

Process ManagementProcess Management

A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an active entity.

Process needs resources to accomplish its task CPU, memory, I/O, files Initialization data

Process termination requires reclaim of any reusable resources

Page 46: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.46/57

Process ManagementProcess Management

Single-threaded process has one program counter specifying location of next instruction to execute Process executes instructions sequentially, one

at a time, until completion Multi-threaded process has one program counter

per thread Typically system has many processes, some user,

some operating system running concurrently on one or more CPUs Concurrency by multiplexing the CPUs among

the processes / threads

P21

Page 47: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.47/57

Process Management ActivitiesProcess Management Activities

The operating system is responsible for the following activities in connection with process management:

Creating and deleting both user and system processes

Suspending and resuming processes

Providing mechanisms for process synchronization

Providing mechanisms for process communication

Providing mechanisms for deadlock handling

Page 48: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.48/57

Memory ManagementMemory Management

All data in memory before and after processing

All instructions in memory in order to execute

Memory management determines what is in memory when

Optimizing CPU utilization and computer response to users

Memory management activities

Keeping track of which parts of memory are currently being used and by whom

Deciding which processes (or parts thereof) and data to move into and out of memory

Allocating and deallocating memory space as neededP22

Page 49: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.49/57

Storage ManagementStorage Management

OS provides uniform, logical view of information storage Abstracts physical properties to logical storage

unit - file Each medium is controlled by device (i.e., disk

drive, tape drive) Varying properties include access speed,

capacity, data-transfer rate, access method (sequential or random)

P22

Page 50: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.50/57

Storage ManagementStorage Management

File-System management Files usually organized into directories Access control on most systems to determine

who can access what OS activities include

Creating and deleting files and directories Primitives to manipulate files and dirs Mapping files onto secondary storage Backup files onto stable (non-volatile) storage

media

Page 51: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.51/57

Mass-Storage ManagementMass-Storage Management

Usually disks used to store data that does not fit in main memory or data that must be kept for a “long” period of time.

Proper management is of central importance

Entire speed of computer operation hinges on disk subsystem and its algorithms

OS activities

Free-space management

Storage allocation

Disk scheduling

Some storage need not be fastP23

Page 52: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.52/57

CachingCaching

Caching is an important principle of computer systems. Information is normally kept in some storage system (such as main memory). As it is used, it is copied into a faster storage system----the cache---on a temporary basis.

When we need a particular piece of information, we first check whether it is in the cache. If it is, we use the information directly from the cache; if it is not, we use the information from the source, putting a copy in the cache under the assumption that we will need it again soon.

P24

Page 53: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.53/57

CachingCaching

in a multitasking environment, where the CPU is switched back and forth among various processes, extreme care must be taken to ensure that, if several processes wish to access A, then each of these processes will obtain the most recently updated value of A.

Page 54: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.54/57

I/O SubsystemI/O Subsystem

One purpose of OS is to hide peculiarities of hardware devices from the user

I/O subsystem responsible for

Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)

General device-driver interface

Drivers for specific hardware devices

Only the device driver knows the peculiarities of the specific device to which it is assigned.

P26

Page 55: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.55/57

Protection and SecurityProtection and Security

Mechanisms ensure that files, memory segments, CPU, and other resources can be operated on by only those processes that have gained proper authorization from the operating system.

Protection – any mechanism for controlling access of processes or users to resources defined by the OS

A system can have adequate protection but still be prone to failure and allow inappropriate access. Consider a user whose authentication information (her means of identifying herself to the system) is stolen. Her data could be copied or deleted, even though file and memory protection are working.

P26

Page 56: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

1.56/57

Protection and SecurityProtection and Security

Security – defense of the system against internal and external attacks Huge range, including denial-of-service, worms,

viruses, identity theft, theft of service

Protection and security require the system to be able to distinguish among all its users.

Page 57: 1.1/57 个人简介 杨公平 工学博士、副教授、硕士生导师 中国计算机学会 多值逻辑和模糊逻辑 专委会委员 中国人工智能学会 机器学习专委会委员

Homework:1,2,3,4,10,17Homework:1,2,3,4,10,17

End of Chapter 1End of Chapter 1