ch1操作系统引论
ch1.0操作系统概述

1.1 人造的操作系统
操作系统简单的说就是管理计算机的软硬件资源从 而让计算机协调正确地为用户工作。 操作系统的管理方法大都起源于人类社会,例如, 管理内存就像管理一个仓库一样。 如同人类社会中的管理方法并不唯一,操作系统中 的管理方法也是多样化的,这些方法没有对错,只 有不同的适用性和性能上的优劣之分。 操作系统是一个人造的系统,可以按照人造物的特 点来进行后续内容的学习,从而更好地理解和掌握 操作系统原理。
计算机的价格是极其昂贵的, CPU 的时间 是非常宝贵的,尽可能提高 CPU 的利用率 成为十分迫切的任务 摆脱人的手工操作,实现作业的自动过渡
24
1.3.2 批处理操作系统
批处理(batch processing)系统的工作过 程:用户将作业交交到机房,操作员将一 批作业输入到辅存(如磁带)上,形成一 个作业队列。当需要调入作业时,监督程 序(操作系统的雏形称为监督程序)从这 一批中选一道作业调入内存运行。当这一 作业完成时,监控程序调入另一道程序, 直到这一批作业全部完成。
1.1 1.2 1.3 1.4 1.5
人造的操作系统 什么是操作系统 操作系统的发展和分类 操作系统的基本特征 操作系统的结构
3
1.1 人造的操作系统
在学习计算机操作系统的具体原理前,首先 要了解的是:什么是计算机的根本特征? 所有的东西可以划分为两类:一类是本来就 存在于自然中,人类所做的只不过是发现--自然存在的事物;另一类是本来并不存在, 人类所做的是发明---人造事物。 从这个思维模式上看,计算机毫无疑问就是 人造事物。即计算机的根本特征是“人造”。
29
为了进一步提高资源的利用率和系统 中作业的吞吐量,在60年代中期,引 入了多道程序设计技术,由此而形成 了多道批处理(Multi-programmed batch processing)系统。
操作系统_第一章 操作系统引论

操作系统_第一章操作系统引论在我们日常使用的电脑和各种智能设备中,操作系统扮演着至关重要的角色。
它就像是一个幕后的大管家,默默地协调着硬件和软件的资源,为我们提供了一个稳定、高效、便捷的计算环境。
那么,操作系统到底是什么?它是如何工作的?又有哪些重要的功能和特点呢?让我们一起来揭开操作系统的神秘面纱。
首先,我们来谈谈操作系统的定义。
简单来说,操作系统是管理计算机硬件与软件资源的程序,同时也是计算机系统的内核与基石。
它负责控制和管理计算机的硬件设备,如处理器、内存、硬盘、输入输出设备等,同时为应用程序提供一个稳定、安全、高效的运行环境。
操作系统的主要功能可以概括为以下几个方面:进程管理是操作系统的核心功能之一。
在计算机中,多个程序可以同时运行,而操作系统需要合理地分配处理器资源,让每个程序都能得到适当的执行时间。
它通过进程调度算法,决定哪个进程先执行,哪个进程后执行,以及如何在多个进程之间切换,以确保系统的高效运行。
内存管理也至关重要。
计算机的内存是有限的,而操作系统需要合理地分配和管理内存空间,确保每个程序都能得到所需的内存,并且避免内存泄漏和内存冲突等问题。
它采用了虚拟内存技术,让程序看起来拥有比实际物理内存更大的内存空间。
文件管理是操作系统的另一个重要功能。
它负责管理计算机中的文件和目录,包括文件的创建、删除、读取、写入、存储等操作。
通过文件系统,我们可以方便地组织和管理数据,并且可以对文件进行权限设置,保护数据的安全性。
设备管理则负责管理计算机的各种输入输出设备,如键盘、鼠标、显示器、打印机等。
操作系统需要为设备驱动程序提供接口,使得设备能够正常工作,并且能够处理设备的中断和错误情况。
除了以上这些功能,操作系统还提供了用户接口,让用户能够方便地与计算机进行交互。
比如,图形用户界面(GUI)让我们可以通过点击图标和菜单来操作计算机,而命令行界面则适合那些熟悉计算机命令的用户。
接下来,让我们了解一下操作系统的分类。
计算机网络ch1-引言

HOST
T
T T
HOST
T
CCP CCP
T 通信子网
CCP
T
HOST
T
T
2012年3月17日
西安理工大学自动化学院
第1章 引论
计算机网络与通信
两层网络的概念结构
在通信子网上可有 多个资源子网, 多个资源子网,共 享通信子网的服务
H C H H C H 资源子网 C
通信子网
H
2012年3月17日
西安理工大学自动化学院
2012年3月17日
2学时 6学时 4学时 学时 6学时 4学时 4学时 2学时 4学时 4学时
西安理工大学自动化学院
第1章 引论
计算机网络与通信
第1章 计算机网络概论 章
1.1 计算机网络的产生与发展 1.2 计算机网络的概念 计算机网络的功能 1.3 计算机网络的功能 1.4 计算机网络的组成 计算机网络分类 1.5 计算机网络分类
2012年3月17日
西安理工大学自动化学院
第1章 引论
计算机网络与通信
例子: 例子: –因特网的前身 因特网的前身——ARPANET 因特网的前身 ARPANET •美苏冷战时期由美国军方建立的实验 美苏冷战时期由美国军方建立的实验 性网络 •最初4个节点→70 s的60多个节点 最初4 最初 个节点→70’s 60多个节点 •地域跨越美洲、欧洲 地域跨越美洲、 地域跨越美洲 •具有现代网络的许多特征,例如 具有现代网络的许多特征, 具有现代网络的许多特征 –分组交换 分组交换 –分层次的网络体系 分层次的网络体系 –较为完善的通信协议 较为完善的通信协议
2012年3月17日
高传善著 刘衍珩著 刘衍珩著 谢希仁
ch1操作系统

Chapter 1: Introduction1.2Chapter 1: IntroductionWhat Operating Systems Do Computer-System Organization Computer-System Architecture Operating-System Structure Operating-System Operations Process Management Memory Management Storage Management Protection and Security Computing Environments1.3ObjectivesTo provide a grand tour of the major operating systemscomponentsTo provide coverage of basic computer system organization1.4What is an Operating System?A program that acts as an intermediary between a user of acomputer and the computer hardware. Operating system goals:zExecute user programs and make solving user problems easier.zMake the computer system convenient to use.Use the computer hardware in an efficient manner.1.5Operating Systems Driven FactorsMuch of operating system history driven by relative cost factors ofhardware and people. Hardware started out fantastically expensive relative to people and the relative cost has been decreasing ever since. Relative costs drive the goals of the operating system.z In the beginning: Expensive Hardware, Cheap People Goal: maximize hardware utilization.zNow: Cheap Hardware, Expensive People Goal: make it easy for people to use computer.1.6Early Days of Computer UseComputers were huge machines that are expensive to buy, run andmaintain.Computers were used in single user, interactive mode.Programmers interact with the machine at a very low level -flickconsole switches, dump cards into card reader, etc. The interface is basically the raw hardware.1.7A Problem in Early Days of Computer UseProblem: Code to manipulate external I/O devices is very complex,and is a major source of programming difficulty.Solution: Build a subroutine library (device drivers) to manage theinteraction with the I/O devices. The library is loaded into the top of memory and stays there. This is the first example of something that would grow into an operating system.1.81st Problem when Computers are ExpensiveProblem: computer idles while programmer sets things up. Poorutilization of huge investment.Solution 1: Hire a specialized person to do setup. Faster thanprogrammer, but still a lot slower than the machine.Solution 2: Build a batch monitor. Store jobs on a disk (spooling),have computer read them in one at a time and execute them. Big change in computer usage: debugging now done offline from print outs and memory dumps.1.92nd Problem when Computers are ExpensiveProblem: At any given time, job is actively using either the CPU oran I/O device, and the rest of the machine is idle and therefore unutilized.Solution: Allow the job to overlap computation and I/O. Bufferingand interrupt handling added to subroutine library.1.103rd Problem when Computers are ExpensiveProblem: one job can't keep both CPU and I/O devices busy. (Havecompute-bound jobs that tend to use only the CPU and I/O-bound jobs that tend to use only the I/O devices.) Get poor utilization either of CPU or I/O devices.Solution: multiprogramming -several jobs share system.Dynamically switch from one job to another when the running job does I/O. Big issue: protection. Don't want one job to affect the results of another. Memory protection and relocation added tohardware, OS must manage new hardware functionality. OS starts to become a significant software system. OS also starts to take up significant resources on its own.1.111st Problem When Computers Became Cheaper, People Costs Become SignificantProblem: It becomes important to make computers easier touse and to improve the productivity of the people. One big productivity sink: having to wait for batch output . So, it is important to run interactively. But computers are still so expensive that you can't buy one for every person.Solution: interactive timesharing.1.122nd Problem When Computers Became Cheaper, People Costs Become SignificantProblem: Old batch schedulers were designed to run a job for aslong as it was utilizing the CPU effectively (in practice, until it tried to do some I/O). But now, people need reasonable response time from the computer.Solution: Preemptive scheduling.1.133rd Problem When Computers Became Cheaper, People Costs Become SignificantProblem: People need to have their data and programs aroundwhile they use the computer.Solution: Add file systems for quick access to data. Computerbecomes a repository for data, and people don't have to use card decks or tapes to store their data.1.144th Problem When Computers Became Cheaper, People Costs Become SignificantProblem: The boss logs in and gets terrible response time becausethe machine is overloaded.Solution: Prioritized scheduling. The boss gets more of themachine than the peons.1.15Hardware Becomes Cheaper and Users moreSophisticated.People need to share data and information with otherpeople.zComputers become more information transfer,manipulation and storage devices rather than machines that perform arithmetic operations.zNetworking becomes very important, and as sharing becomes an important part of the experience so does security.z Operating systems become more sophisticated.1.16Computer System StructureComputer system can be divided into four componentszHardware –provides basic computing resourcesCPU, memory, I/O deviceszOperating systemControls and coordinates use of hardware among variousapplications and userszApplication programs –define the ways in which the system resources are used to solve the computing problems of the usersWord processors, compilers, web browsers, databasesystems, video gameszUsersPeople, machines, other computers1.17Four Components of a Computer System1.18Operating System DefinitionOS is a resource allocatorz Manages all resourceszDecides between conflicting requests for efficient and fair resource useOS is a control programzControls execution of programs to prevent errors and improper use of the computer1.19Operating System Definition (Cont.)No universally accepted definition“Everything a vendor ships when you order an operating system”is good approximationzBut varies wildly“The one program running at all times on the computer”is thekernel. Everything else is either a system program (ships with the operating system) or an application program1.20Computer Startupbootstrap program is loaded at power-up or rebootzTypically stored in ROM or EPROM, generally known as firmwarez Initializates all aspects of systemzLoads operating system kernel and starts execution1.21Computer System OrganizationComputer-system operationzOne or more CPUs, device controllers connect through common bus providing access to shared memory zConcurrent execution of CPUs and devices competing for memory cycles1.22Common Functions of InterruptsInterrupt 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 interruptedinstruction.Incoming interrupts are disabled while another interrupt is beingprocessed to prevent a lost interrupt .A trap is a software-generated interrupt caused either by an erroror a user request.An operating system is interrupt driven.1.23Interrupt HandlingThe operating system preserves the state of the CPU by storingregisters and the program counter.Determines which type of interrupt has occurred:z pollingzvectored interrupt systemSeparate segments of code determine what action should be takenfor each type of interruptOn completion,the cpu resumes the interrupted computation.1.24Interrupt Timeline1.25I/O StructureAfter I/O starts, control returns to user program only upon I/Ocompletion.z Wait instruction idles the CPU until the next interrupt z Wait loop.zAt most one I/O request is outstanding at a time, no simultaneous I/O processing.After I/O starts, control returns to user program without waitingfor I/O completion.z System call –request to the operating system to allow user to wait for I/O completion.z Device-status table contains entry for each I/O device indicating its type, address, and state.zOperating system indexes into I/O device table to determine device status and to modify table entry to include interrupt.1.26Two I/O Methods Synchronous Asynchronous1.27Device -Status Table1.28Direct Memory Access StructureUsed for high-speed I/O devices able to transmit information atclose to memory speeds.Device controller transfers blocks of data from buffer storagedirectly to main memory without CPU intervention.Only one interrupt is generated per block, rather than the oneinterrupt per byte.1.29Storage StructureMain memory –only large storage media that the CPU can accessdirectly.Secondary storage –extension of main memory that provides largenonvolatile storage capacity.Magnetic disks –rigid metal or glass platters covered withmagnetic recording materialzDisk surface is logically divided into tracks , which are subdivided into sectors .1.30Storage HierarchyStorage systems organized in hierarchy.z Speed z Cost zVolatility1.31Storage -Device Hierarchy1.32Performance of Various Levels of Storage1.33CachingCaching –copying information into faster storage system; mainmemory can be viewed as a last cache for secondary storage. Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information istherez If it is, information used directly from the cache (fast)zIf not, data copied to cache and used there Cache smaller than storage being cachedz Cache management important design problem zCache size and replacement policy1.34Migration of Integer A from Disk to RegisterMultitasking environments must be careful to use most recentvalue , no matter where it is stored in the storage hierarchyMultiprocessor environment must provide cache coherency inhardware such that all CPUs have the most recent value in their cacheDistributed environment situation even more complexzSeveral copies of a datum can exist1.35Operating System StructureMultiprogramming needed for efficiencyz Single user cannot keep CPU and I/O devices busy at all timesz Multiprogramming organizes jobs (code and data) so CPU always has one to executez A subset of total jobs in system is kept in memoryz One job selected and run via job schedulingzWhen it has to wait (for I/O for example), OS switches to another jobTimesharing (multitasking)is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computingz Response time should be < 1 secondz Each user has at least one program executing in memory >process z If several jobs ready to run at the same time >CPU schedulingz If processes don’t fit in memory, swapping moves them in and out to runzVirtual memory allows execution of processes not completely in memory1.36Memory Layout for Multiprogrammed System1.37Operating -System OperationsInterrupt driven by hardwareSoftware error or request creates exception or trapzDivision by zero, request for operating system serviceOther process problems include infinite loop, processes modifyingeach other or the operating systemDual-mode operation allows OS to protect itself and other systemcomponentsz User mode and kernel mode zMode bit provided by hardwareProvides ability to distinguish when system is running usercode or kernel codeSome instructions designated as privileged , onlyexecutable in kernel modeSystem call changes mode to kernel, return from call resetsit to user1.38Transition from User to Kernel ModeTimer to prevent infinite loop / process hogging resourcesz Set interrupt after specific period z Operating system decrements counter z When counter zero generate an interruptzSet up before scheduling process to regain control or terminate program that exceeds allotted time1.39Process ManagementA 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 taskz CPU, memory, I/O, files z Initialization dataProcess termination requires reclaim of any reusable resourcesSingle-threaded process has one program counter specifying location of next instruction to executezProcess executes instructions sequentially, one at a time, until completionMulti-threaded process has one program counter per threadTypically system has many processes, some user, some operating system running concurrently on one or more CPUszConcurrency by multiplexing the CPUs among the processes / threads1.40Process Management ActivitiesThe operating system is responsible for the following activities inconnection with process management: Creating and deleting both user and system processes Suspending and resuming processesProviding mechanisms for process synchronization Providing mechanisms for process communication Providing mechanisms for deadlock handling1.41Memory ManagementAll data in memory before and after processing All instructions in memory in order to execute Memory management activitieszKeeping track of which parts of memory are currently being used and by whomzDeciding which processes (or parts thereof) and data to move into and out of memoryz Allocating and deallocating memory space as needed1.42Storage ManagementOS provides uniform, logical view of information storagez Abstracts physical properties to logical storage unit -file zEach 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)File-System managementz Files usually organized into directoriesz Access control on most systems to determine who can access whatzOS activities includeCreating and deleting files and directories Primitives to manipulate files and dirs Mapping files onto secondary storageBackup files onto stable (non-volatile) storage media1.43Mass -Storage ManagementUsually 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 importanceEntire speed of computer operation hinges on disk subsystem and its algorithmsOS activitiesz Free-space management z Storage allocation zDisk schedulingSome storage need not be fastz Tertiary storage includes optical storage, magnetic tape z Still must be managedzVaries between WORM (write-once, read-many-times) and RW (read-write)1.44I/O SubsystemOne purpose of OS is to hide peculiarities of hardware devicesfrom the userI/O subsystem responsible forzMemory 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)z General device-driver interface zDrivers for specific hardware devices1.45Protection and SecurityProtection –any mechanism for controlling access of processes orusers to resources defined by the OSSecurity –defense of the system against internal and externalattackszHuge range, including denial-of-service, worms, virusesSystems generally first distinguish among users, to determine whocan do whatz User identities (user IDs , security IDs) include name and associated number, one per userz User ID then associated with all files, processes of that user to determine access controlzGroup identifier (g roup ID ) allows set of users to be defined and controls managed, then also associated with each process, filezPrivilege escalation allows user to change to effective ID with more rights1.46Computing EnvironmentsTraditional computerzOffice environmentPCs connected to a network, terminals attached tomainframe or minicomputers providing batch and timesharingNow portals allowing networked and remote systemsaccess to same resourceszHome networksUsed to be single system, then modems Now firewalled, networked1.47Computing Environments (Cont.)Client-Server Computingz Dumb terminals supplanted by smart PCszMany systems now servers , responding to requests generated by clientsCompute-server provides an interface to client to request services (i.e. database)File-server provides interface for clients to store and retrieve files1.48Peer -to -Peer ComputingAnother model of distributed system P2P does not distinguish clients and serversz Instead all nodes are considered peers z May each act as client, server or both zNode must join P2P networkRegisters its service with central lookup service on network,orBroadcast request for service and respond to requests forservice via discovery protocol zExamples include Napster and Gnutella1.49Web -Based ComputingWeb has become ubiquitous PCs most prevalent devicesMore devices becoming networked to allow web access New category of devices to manage web traffic among similarservers: load balancersUse of operating systems like Windows 95, client-side, haveevolved into Linux and Windows XP, which can be clients and servers1.50Chapter 1: IntroductionWhat Operating Systems Do Computer-System Organization Computer-System Architecture Operating-System Structure Operating-System Operations Process Management Memory Management Storage Management Protection and Security Computing EnvironmentsEnd of Chapter 1。
计算机操作系统-操作系统引论

多道程序设计优点 提高CPU利用率(图1-5) 提高内存和I/O设备利用率 增加了系统吞吐量
特征 多道性、宏观上并行、 微观上串行
多道批处理优点 资源利用率高、系统吞吐率大
缺点 平均周转时间长、无交互能力(怎么办??)
第一章 操作系统引论
图1-5
第一章 操作系统引论
1.2 操作系统的发展过程
1.2.1 无操作系统的计算机系统
(第一代计算机)
1. 人工操作方式
如纸带输入机 特点:无任何软件、独占性、独占性、 串行性
缺点: (1) 用户独占全机 (2) CPU等待人工操作
第一章 操作系统引论
1.2.1 无操作系统的计算机系统
人工操作方式缺点:
机器 速度
作业在机器上 人工操 计算所需时间 作时间
1万次/秒 1小时 60万次/秒 1分钟
3分钟 3分钟
操作时间与机器 有效运行时间之比
1 :20 3 :1
导致人机矛盾、CPU和I/O设备速度不匹配
第一章 操作系统引论 2. 脱机输入/输出(Off-Line I/O)方式
引入I/O机的概念,解 决CPU和I/O设备
第一章 操作系统引论
第一章 操作系统引论
1.1 操作系统的目标和作用 1.2 操作系统的发展过程 1.3 操作系统的基本特性 1.4 操作系统的主要功能 1.5 操作系统的结构设计
第一章 操作系统引论
教学目的: 掌握操作系统的定义及其基本特性、主
要功能 了解操作系统的发展历史和几种类型的
操作系统 教学难重点: 操作系统的定义 操作系统的基本特征 OS结构设计
操作 文件管理:文件存取、共享和保护
操作系统课件:ch1-操作系统概论(Overview)

OS的发展-主要动力
• 推动OS发展的主要动力
– 提高资源的利用率和系统性能:计算机发展的 初期,计算机系统昂贵,用作集中计算
– 方便用户,提供新的服务 :为适应用户的新 需求,扩展OS以提供新的服务。
– 器件的发展,硬件升级和新型硬件的出现: CPU的位宽度(指令和数据),OS都应能适应。
– 纠正错误:任何一个操作系统都有错误,在 使用一段时间后发现了错误就需要进行纠错。
X window是一个应用程序,Windows中的GUI工作 在内核态(所以速度很快)
原理是概括性的,具体系统中管理对象是实实在在的
CPU进程;磁盘文件;显示器窗口…
操作系统设计的主要思想?
• 软硬件协同解决问题 • 用系统的观点理解操作系统的设计 • 理解分而治之、分层实现在复杂软件系
统实现中的重要作用 • 用工程师的立场来看待操作系统的实现
管理的内容
– 资源的当前状态(数量和使用情况) – 资源的分配、回收和访问操作 – 相应管理策略
操作系统的定义
操作系统是计算机系统中的一个系统软件,是一些程 序模块的集合——
它们能以尽量有效、合理的方式组织和管 理计算机的软、硬件资源,合理的组织 计算机的工作流程,控制程序的执行并 向用户提供各种服务功能,使得用户能 够灵活、方便、有效的使用计算机,使 整个计算机系统能高效地运行。是计算 机与用户之间的接口。
1.1 • 什么是操作系统?
1.2 • 本课程的学习方法
1.3 • 操作系统的简史
1.4 • 操作系统引导过程分析
什么是操作系统
• 计算机的核心包括运算器和控 制器在内的中央处理单元(CPU)。
应用软件 中间件
• 计算机系统是由软硬件组成的 多级层次结构,由微程序级、 一般机器级、操作系统级、汇 编语言级、高级语言级组成。
CH1 操作系统引论复习

Operating System
7.分时系统的特征 .
• 分时系统与多道批处理系统相比,具有非常明显的 不同特征,可以归纳成以下四个特点:
– (1) 多路性。允许在一台主机上同时联接多台联机终端, 系统按分时原则为每个用户服务。宏观上,是多个用户 同时工作,共享系统资源;而微观上,则是每个用户作 业轮流运行一个时间片。多路性即同时性,它提高了资 源利用率,降低了使用费用,从而促进了计算机更广泛 的应用。 – (2) 独立性。每个用户各占一个终端,彼此独立操作,互 不干扰。因此,用户所感觉到的,就像是他一人独占主 机。 – (3) 及时性。用户的请求能在很短的时间内获得响应。此 时间间隔是以人们所能接受的等待时间来确定的,通常 仅为1~3秒钟。 – (4) 交互性。用户可通过终端与系统进行广泛的人机对话。 其广泛性表现在:用户可以请求系统提供多方面的服务, 如文件编辑、数据处理和资源共享等。
应用软件 其它系统软件 操作系统 硬件
Operating System
1. 操作系统的目标
• 1.有效性
– (1) 提高系统资源利用率:使CPU和I/O设备由于能保持忙碌 状态而得到有效的利用,且可使内存和外存中存放的数据因 有序而节省了存储空间。 – (2) 提高系统的吞吐量:操作系统还可以通过合理地组织计 算机的工作流程,而进一步改善资源的利用率,加速程序的 运行,缩短程序的运行周期,从而提高系统的吞吐量。
Operating System
8. 操作系统的主要功能
• 处理机管理功能
– 进程控制、进程同步、进程通信、调度
• 存储器管理功能
– 内存分配、内存保护、地址映射、内存扩充
• 设备管理功能
– 缓冲管理、设备分配、设备处理
东北大学 Ch1操作系统概述061001

现代UNIX结构
a.out coff 可执行 格式 开关表 虚存 框架 vnode/ vfs 接口 elf
NFS
FFS
文件映射
设备映射 匿名映射
s5fs
RFS
公共 text 例程
磁盘驱动程序 磁带驱动程序
块设备 开关表
调度 框架
分时进程 实时进程
流
系统
Windows NT体系结构
简化的Windows2000体系结构
简化的Windows2000体系结构
6. 操作系统的设计和实现
1)Design Goals设计目标 User goals – OS should be convenient to use, easy to learn, reliable, safe, and fast 用户目标 - 操作系统应该便于使用,易学,可靠, 安全并且快捷 System goals – OS should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. 系统目标 - 操作系统应该容易设计、实现和维护, 还要灵活、可靠、无错误和高效
……
I/O任务
第二层
磁盘 终端 时钟 系统 以太网 任务 任务 任务 任务 任务
第一层
进程管理
系统核心
Minix系统结构图
第四层
Init 用户 用户 用户 用户 进程 进程 进程 进程 进程 内存 管理器 文件 系统 网络 服务器
……
用户进程
第三层
服务器进程
……
第二层
第一层
磁盘 终端 时钟 系统 以太网 …… 包含向用户进程提供有用服 任务 任务 任务 任务 任务 务的进程,特权级较低,不 能直接访问IO端口, 进程管理
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
OS作为用户与计算机硬件系统之间的接口, 最终用户与硬件的接口:命令、图形界面。 程序员与硬件的接口:系统调用 OS作为计算机系统资源的管理者。 OS用作扩充机器:提供给用户一台覆盖了软件的, 使用方便的虚拟机。
第一章
操作系统引论
1.1 操作系统的目标和作用 1.1.3 操作系统的层次模型 OS分为三个层次:
第一章 操作系统引论
1.4 操作系统的功能
1.4.1 存储器管理的功能 二 、内存保护 1、 内存保护的任务: 是确保每道用户程序都在自己的内存空间中运行,互不干 扰。 2、 内存保护的实现 设置两个界限寄存器,分别存放正在执行程序的上界和下 界,以便对程序进行越界检查。
第一章 操作系统引论
1.4 操作系统的功能
一个实际的OS可以同时具有批处理、分时和实时的特点,如Windows NT
第一章 操作系统引论
1.3 操作系统的特征和服务
1.3.1 OS的特征(指支持多任务的OS)
并发:两个或多个事件在同一时间间隔内发生。 共享: 系统中的资源可供内存中多个并发执行的进程
共同使用 虚拟: 通过某种技术把一个物理实体变成若干逻辑上 的对应物 异步性:程序的执行不连续,呈现间断性。
第一章 操作系统引论
1.4 操作系统的功能
1.4.1 存储器管理的功能 一、内存分配 2 、0S实现内存分配的两种方式:
静态分配方式 动态分配方式
第一章 操作系统引论 1.4 操作系统的功能
1.4.1 存储器管理的功能
一、内存分配 3、内存分配功能的实现 为了实现内存分配,需要以下的数据结构和功能。 ☻内存分配数据结构 ☻内存分配功能 ☻内存回收功能
第一章
本章主要内容:
操作系统引论
操作系统的目标、作用(单处理机、多任务) 操作系统的发展 操作系统的服务 操作系统的功能
第一章
操作系统引论
1.1 操作系统的目标和作用
1.1.1 OS的目标――开发OS的 目标 方便性 有效性 可扩充性 开放性
第一章
操作系统引论
1.1 操作系统的目标和作用
第一章 操作系统引论
1.4 操作系统的功能
1.4.1 存储器管理的功能 四、内存扩充
1、内存扩充:内存扩充的任务是借助于虚拟存储技术, 从逻辑上扩充内存容量,使系统能够提供比物理内存 大的容量。 2、为了能从逻辑上扩充内存,系统必须具有内存扩充 机 制, 以实现下述功能: 请求调入功能 置换功能
闲内存、磁盘空间大小。
第一章 操作系统引论
1.4 操作系统的功能
本节简单介绍操作系统的五个主要功能
存储器管理功能 处理机管理功能 设备管理功能 文件管理功能 用户接口
第一章 操作系统引论
1.4 操作系统的功能
1.4.1 存储器管理的功能 存储器管理的主要任务是为多道程序的运行 提供良好的环境,方便用户使用存储器,提高存 储器的利用率,以及能从逻辑上来扩充内存,为 此,存储器管理应具有以下功能:
1.4.1 存储器管理的功能 三、地址映射
1、相对地址与物理地址 一个应用程序经编译后,通常会形成若干个目标程序, 这些目标程序再经过链接而形成可装入程序。这些程序的地 址都是从“0”开始的,程序中的其它地址都是相对于起始地 址计算的;由这些地址所形成的地址范围称为“地址空间”, 其中的地址称为“逻辑地址”或“相对地址”。此外,由内 存中的一系列单元所限定的地址范围称为“内存空间”,其 中的地址称为“物理地址”。
系 统 调 用 实 例
系统调用C调用命令如open( ),fork( ) ↓ 系统调用展开,发int 0x80中断命令 ( - syscall N( ) (include/asm.i386/unistd.h)
↓ 调int ox80中断服务程序system—call (arch/i386/kernd/entry.s)
1.2 操作系统的发展
1.2.2各种OS的特点 三、分时系统 2、分时系统实现中的关键问题 及时接收:及时接收用户的命令或数据 及时处理:及时处理用户命令。应该使所有的用 户作业都直接进入内存;在很短的时间内使每个 作业都运行一次。
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点
4、 缺点:
※平均周转时间长。 ※缺乏交互能力
5、多道批处理系统需要解决的问题: 处理机管理、内存管理、I/O设备管理、文件 管理、作业管理。
第一章 操作系统引论
1.2 操作系统的发展 1.2.2各种OS的特点
三、分时系统
1、分时系统的产生 人机交互 共享主机 便于用户上机
第一章 操作系统引论
内存分配; 内存保护; 地址映射; 内存扩充。
第一章 操作系统引论
1.4 操作系统的功能
1.4.1 存储器管理的功能
一、内存分配 1、内存分配的任务 内存分配的主要任务是为每道程序分配内存空间,使它们 “各得其所”,提高存储器的利用率,以减少不可用的内 存空间,允许正在运行的程序申请附加的内存空间,以适 应程序和数据动态增长的需要。
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点 四、实时系统 3、实时系统与分时系统的比较 多路性 独立性 及时性* 交互性 可靠性*
第一章 操作系统引论
1.2 操作系统的发展
小结:
无OS ↓ 单道批处理 ↓ 多道批处理 ↓ 分时系统 ↓ 实时系统 技术的发展与 应用的要求推 动了OS的发展
1.2.1 OS的发展
第一代计算机(1945—1955):真空管与插件板 第二代计算机(1955-1965):晶体管和批处理系统 第三代计算机(1965-1980):集成电路芯片和多道程序 系统 第四代计算机(1980—1990):个人计算机 实时系统的出现
第一章 操作系统引论
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种பைடு நூலகம்S的特点
四、实时系统 有较强的实时处理能力,可以“抢占”CPU使用权。 1、实时系统的引入 ♣实时控制 ♣实时信息处理
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点
四、实时系统
2、实时任务的类型 周期性实时任务 非周期性实时任务 硬实时任务 软实时任务
第一章
操作系统引论
1.1 操作系统的目标和作用 1.1.3 操作系统的层次模型
三、用户接口 为方便用户使用OS,利用OS所提供的各种功能和 服务,OS通常向用户提供一下三种类型的接口: 1、命令接口:是OS与用户的接口 2、程序接口:是应用程序与OS的接口 3、图形用户接口
第一章 操作系统引论
1.2 操作系统的发展
三、分时系统 3、分时系统的实现方法
单道分时系统 具有“前台”和“后台”的分时系统 多道分时系统
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点
三、分时系统 4、分时系统的特点:
多路性:允许在一台主机上同时联结多台连机终端; 独立性:各终端彼此独立操作,互不干扰; 及时性:用户请求能在很短的时间内获得响应; 交互性:用户可以通过终端与系统进行广泛的人机对 话。
第一章 操作系统引论
用户接口 对对象操纵和管理的软件集合 操作系统对象
第一章
操作系统引论
1.1 操作系统的目标和作用 1.1.3 操作系统的层次模型
一、OS对象 OS对象就是OS操纵和管理的对象,包括:处理器、存储 器系统、各类I/O设备、文件、作业。 二、对对象操纵和管理的软件集合 对对象操纵和管理的软件集合是OS的核心部分,包括: 处理机管理、存储系统管理、文件管理和设备管理。
1.2 操作系统的发展
1.2.2各种OS的特点 一、单道批处理系统(Simple Batch system) 单道批处理系统内存中只有一道作业,可以成批 处理作业。
ڱ特点:自动性、顺序性、单道性 ڱ优点:减少等待人工操作的时间。 ڱ缺点:作业独占CPU,CPU等待I/O使得CPU利用率低。
单道批处理系统的处理流程
开始
还有下一个 作业吗?
是
把下一个作业的源程 序转换为目标程序
否 停止 是 源程序有 错吗? 否 运行目标程序
装配目标程序
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点 二、多道批处理系统
在多道批处理系统中,用户所提交的作业都先存放在 外存上并排成一个队列,该队列被称为“后备队列”,然 后由作业调度程序按一定策略从后备队列中选择若干个作 业调入内存,使它们共享CPU和系统中的各种资源,以达 到提高资源利用率和系统吞吐量的目的。与单道批处理系 统相比:1、多道程序驻留内存;2、CPU不再空闲等待I/O。
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点 二、多道批处理系统
1、多道批处理系统的引入
提高CPU的利用率 提高内存和I/O设备利用率 增加系统吞吐量
第一章 操作系统引论
1.2 操作系统的发展
1.2.2各种OS的特点 二、多道批处理系统
2、特点:
多道性 无序性 调度性 复杂性
第一章 操作系统引论
1.3操作系统的特征和服务
1.3.2操作系统的服务
二 、系统调用
2、 用户态执行与核心态执行 (1)用户态执行: 用户空间是指用户所启动的进程在存储 器中执行的位置,一个用户进程不能访问其他进程的用户 空间,只有核心程序所启动的进程才能存取其他用户空间, 当一个进程在用户空间执行时,称该进程在用户态执行。 (2)系统态执行:系统核心空间是指含有一切系统核心代 码的存储器空间,当进程处于具有执行系统核心代码的权 力之状态时,称为进程处于系统态执行。