《计算机系统结构2英.ppt》由会员分享,可在线阅读,更多相关《计算机系统结构2英.ppt(47页珍藏版)》请在三一办公上搜索。
1、Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem Design and Implementation,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtu
2、al MachinesSystem Design and Implementation,Common System Components,Process ManagementMain Memory ManagementSecondary-Storage ManagementI/O System ManagementFile ManagementProtection SystemNetworkingCommand-Interpreter System,Process Management,A process is a program in execution.A process needs ce
3、rtain resources,including CPU time,memory,files,and I/O devices,to accomplish its task.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
4、 for process synchronizationprocess communication,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.Main memory is a volatile storage device.It loses its contents in the case of s
5、ystem 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 nee
6、ded.,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
7、both programs and data.The operating system is responsible for the following activities in connection with disk managementFree space managementStorage allocationDisk scheduling,I/O System Management,The I/O system consists of:A buffer-caching systemA general device-driver interfaceDrivers for specif
8、ic hardware devices,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 dele
9、tion.Directory creation and deletion.Support of primitives原语 for manipulating files and directories.Mapping files onto secondary storage.File backup on stable(nonvolatile)storage media.,Protection System,Protection refers to a mechanism for controlling access by programs,processes,or users to both s
10、ystem and user resources.The protection mechanism mustdistinguish between authorized and unauthorized usage.specify the controls to be imposed.provide a means of enforcement.,Networking(Distributed Systems),A distributed system is a collection processors that do not share memory or a clock.Each proc
11、essor 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 增强可靠性,Co
12、mmand-Interpreter System,Many commands are given to the operating system by control statements which deal with:process creation and managementI/O handlingsecondary-storage managementmain-memory managementfile-system accessprotectionnetworking,Command-Interpreter System(Cont.),The program that reads
13、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.,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem Struc
14、tureVirtual MachinesSystem Design and Implementation,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.File-sy
15、stem 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
16、 computing by detecting errors in the CPU and memory hardware,in I/O devices,or in user programs.,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 o
17、r 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.,System Calls,System calls provide
18、 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 Three general methods are used to pass parameters between a running pr
19、ogram and the operating system.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.,Passing of Parameters As A Table 表格方式的
20、参数传递,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem Design and Implementation,System Calls(Cont.),Process controlFile managementDevice managementInformation maintenanceCommunications,System Call proces
21、s control,end,abortload,executecreate process,terminate processget process attributes,set process attributeswait for timewait event,signal eventAllocate and free memory,MS-DOS Execution,At System Start-up系统启动,Running a Program运行程序,UNIX Running Multiple Programs,System Call file management,create fil
22、e,delete fileopen,closeread,write,repositionget file attributes,set file attributes,System Call device management,request device,release deviceread,write,repositionget device attributes,set device attributeslogically attach or detach devices,System Call information management,get time or date,set ti
23、me or dateget system data,set system dataget process,file,or device attributesset process,file,or device attributes,System Call communications,create,delete communication connectionsend,receive messagestransfer status informationattach or detach remote devices,Communication Models,Msg Passing,Shared
24、 Memory,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem Design and Implementation,System Programs,System programs provide a convenient environment for program development and execution.They can be divid
25、ed into:File manipulationStatus informationFile modificationProgramming language supportProgram loading and executionCommunicationsApplication programs,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem De
26、sign and Implementation,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.With modularity,layers are selected such that each uses func
27、tions(operations)and services of only lower-level layers.,An Operating System Layer,Layered Structure of the THE OS,A layered design was first used in THE operating system.Its six layers are as follows:,Microkernels,Windows NT Client-Server Structure,Chapter 3 Operating-System Structures,System Comp
28、onentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem Design and Implementation,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.虚拟机是层
29、次化的逻辑结果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.操作系统创建了多个进程,每个进程在其处理器和(虚拟)内存执行,Virtual Machines(Cont.),The resources of the physica
30、l computer are shared to create the virtual machines.CPU scheduling can create the appearance that users have their own processor.Spooling and a file system can provide virtual card readers and virtual line printers.A normal user time-sharing terminal serves as the virtual machine operators console.
31、普通用户终端成为虚拟机操作员的控制台,System Models,Non-virtual Machine,Virtual Machine,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.A virtual-machine system is a perfect
32、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
33、the underlying machine.,The Java Virtual Machine,Java.class File on Cross Platforms跨平台的Java.class文件,Java Development Environment,Chapter 3 Operating-System Structures,System ComponentsOperating System ServicesSystem CallsSystem ProgramsSystem StructureVirtual MachinesSystem Design and Implementation
34、,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.,Mechanisms and Policies,Mechanisms determine how to d
35、o 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.,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.,Homework,P83 3.53.73.133.15,
链接地址:https://www.31ppt.com/p-6342671.html