1 / 52

Chapter 1 Operating System Overview

Chapter 1 Operating System Overview. Contents. Operating System Objectives and Functions The Evolution of Operating System Major Achievements Characteristics of Modern OS Examples ( NT 、 UNIX ). 1.1 Objectives and Functions (p45). 1.1.1 Overview

morrisonc
Download Presentation

Chapter 1 Operating System Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1 Operating System Overview

  2. Contents Operating System Objectives and Functions The Evolution of Operating System Major Achievements Characteristics of Modern OS Examples(NT、UNIX)

  3. 1.1 Objectives and Functions (p45) 1.1.1 Overview 1.1.2 The Operating System as a User/Computer Interface 1.1.3 The Operating System as Resource Manager 1.1.4 Ease of Evolution of an Operating System

  4. An operating system is a program that manages the computer, controls the execution of application programs and acts as an interface(接口) between the user of a computer and the computer hardware. Objectives Convenience(方便) Efficiency(有效) Ability to evolve(易扩展) 1.1.1 Overview

  5. 1.1.2 OS as a User/Computer Interface (I) End User Programmers Operating System Designer Applications Programs Utilities (Compiler, Database…) Operating System Computer Hardware Figure 2.1 Layers and Views of a Computer System

  6. The operating system masks(隐藏) the details of the hardware from the programmer,and provides the programmer with a convenient interface for using the system. The types of system interface Command interface: system command (internal、external) Graphics interface: windows Programmer interface: system call, c-lib OS as a User/Computer Interface (II)

  7. Services of the Operating System (I) Program creation Such as: fork (unix)、CreateProcess (win) Program execution Such as: execl, execp Access to I/O devices Such as: read/write Controlled access to files Such as: read/write

  8. Services of the Operating System (II) • System access • Provide protection and authorized • Error detection and response • Such as: error • Accounting

  9. 1.1.3 OS as Resource Manager (I)(p47) Types of Resource: CPU、Memory、Devices CPU: chapter 3.4.5.6.9.10 Memory: chapter 7.8 I/O Devices: chapter 11.12

  10. OS as Resource Manager (II) As a control mechanism is unusual in two respects The OS functions in the same way as ordinary computer software; that is, it is a program executed by the processor. The OS frequently relinquishes control (释放控制)and must depend on the processor to allow it to regain control(获取控制).

  11. OS as Resource Manager (III Figure 2.2) Management of CPU Management of I/O Device Management of Memory Management of Files Concept: Kernel、Nucleus(内核): Always in main memory, contains the most-frequently-used functions

  12. 1.1.4 Ease of Evolution(p49) Reasons for evolution hardware upgrades Exp: support paging new services fixes Implements software engineering: modules、layer、object design

  13. 1.2 The Evolution of Operating Systems 1.2.1 Serial Processing 1.2.2 Simple Batch Systems 1.2.3 Multiprogrammed(多道) Batch Systems 1.2.4 Time-Sharing Systems

  14. 1.2.1 Serial Processing(p50串行处理) Example Input  Calculate  Print Problems Scheduling: The estimated time is not accurate Setup time: Between the setup procedure, if an error occurred, then must go back to the beginning of the setup sequence Contradiction between human and machine

  15. 1.2.2 Simple Batch System Objectives:Solution contradiction between human and machine User submits the job on cards or tape to a computer operator (use JCL(job control language)) Implement: Monitor

  16. From the Point of View of the Monitor (p51) • Monitor is responsible for the running of every job • Controls are transferred between monitor and other user programs Interrupt processing Device Drivers monitor Job Sequencing Control Language Interpreter User Program Area Memory layout for a resident(驻留) monitor

  17. From the Point of View of the Processor When CPU runs command of monitor, the monitor gains the control. When CPU runs command of user program, the user program gains the control. Transfer the control: First monitor gains the control, when user program load in, it gains the control, when the user program finish or error, the monitor regains(重获) the control.

  18. JCL (Job Control Language) $JOB //begin $FTN //using Fortran compile and link …Fortran //instructions $LOAD //load in runable modules $RUN //running. $END //finish do the job

  19. Other Hardware Feature Desirable(p53) Memory protection(内存保护): User space and system space are independent. E.g. Hardware can detect outside accessing error. Timer interrupt(时钟中断): When the timer expires, an interrupt occurs. Privileged instructions(特权指令): Can be executed only by the monitor. Interrupts: Improvement efficiency Easy for relinquishing(释放) and regaining control

  20. 1.2.3 Multiprogrammed Batch Systems Read one record 0.0015 seconds Execute 100 instructions 0.0001 seconds Write one record 0.0015 seconds TOTAL 0.0031 seconds Percent CPU Utilization = 0.0001/0.0031=3.2% Figure 2.4 System Utilization Example • Uniprogramming(单道) has low efficiency(效率): • CPU---I/O contradiction

  21. Multiprogramming/Multitasking There are many user programs in the memory. Hardware need for Multiprogramming. Interruption For example: p55 Fig2.5

  22. Example of Multiprogramming • 256k available memory • Notes: not consider the resource competition Table 2.1 Sample Program Execution Attributes

  23. Analysis

  24. Analysis • Single • Processor use=5/(5+15+10)=17% • Memory use=[(50*5+100*15+80*10)/256/30] =33% • Disk use=10/30=33% • Printer use=10/30=33% • Total time= 5+15+10=30 • Throughput =6 job/hour • Mean response time=(5+20+30)/3=18

  25. Analysis • Multiprogramming • Processor use=5/15=33% • Memory use=[(50+100+80)*5+(100+80)*5+100*5]/256/15 =65% • Disk use=10/15=67% • Printer use=10/15=67% • Total time=15 • Throughout =12job/hour • Mean response time=(5+10+15)/3=10

  26. Sophisticated(复杂性) of Multiprogramming (p57) Memory management Scheduling Algorithm(算法): The processor(处理器) must decide which one to run.

  27. 1.2.4 Time-Sharing Systems Multiple users simultaneously(同时) access the system through terminals(终端) Concepts: time slice(时间片): q user num(用户数): n response time(响应时间): t t=n×q Mode: multi-terminals、multi-windows

  28. Batch Multiprogramming vs Timer Sharing

  29. Reducing the Swapping Loads by Partial Swapping(p59) Reducing the spending for accessing disk

  30. 1.3 Major Achievements(p60) 1.3.1 Processes(进程) 1.3.2 Memory management 1.3.3 Information protection and security 1.3.4 Scheduling and resource management 1.3.5 System structure

  31. 1.3.1 Processes A program in execution The animated spirit(活动精灵) of a program The entity(实体) that can be assigned(分派) to and executed on a processor Three major types of computer system Multiprogramming batch operation Time sharing Real-time transaction(处理) systems

  32. Errors May Happen in Multiprogramming Improper synchronization(同步): Signals being lost or duplicate(重复) signals being received. Failed mutual exclusion(失败的互斥) Nondeterminate(不确定)program operation: The result is not unique Deadlocks(死锁) To solute these problems, introduce process concept

  33. Process entity(实体) An executable program The associated data needed by the program The execution context(上下文) of the program

  34. Process Image and Process Switch(切换)(p63)

  35. 1.3.2 Memory Management Process isolation(隔离) Automatic allocation and management Support of modular(模块化) programming Virtually memory Long-term storage Protection and access control(访问控制)

  36. Fig 2.10 Two Views of a Storage System Files Virtual Memory Virtual Processor Read, Write Copy Long-term Store (a) User’s View Real Processor Mapper (Address Translate) Main Memory Auxiliary Memory Virtual Address Memory Address Swapping (b) Operating System Designer’s View

  37. 1.3.3 Information Protection and Security Access control: for various resources in the system Information flow control(信息流控): to guarantee the data to send to destination Certification(认证)

  38. 1.3.4 Scheduling and Resource Management(p66) Three factors must be consider Fairness Differential responsiveness(区分服务): e.g. If a process is waiting for the use of an I/O device, the operating system may wish to schedule that process for execution as soon as possible in order to free up the device for later demands from other processes. Efficiency: Maximize throughput(吞吐量), minimize response time, accommodate(容纳) as many users as possible

  39. Short-term queue Algorithm used to use: round robin(轮转) Long-term queue Algorithm used to use: FIFO Interrupt handler: the method for get the control Service call handler(系统服务处理): the entry point into the operating system Some Concepts(p67)

  40. Fig 2.11 Key elements of an Operating System for Multiprogramming OS Long-term Queue Short-term Queue Service Call Handler I/O queue Interrupt Handler Short-Term Scheduler

  41. Modules(模块化) structure: only suitable for small system; for complex system, difficult for debug Hierarchical(层) structure Level n provides service for level n+1 System Structure(p68系统结构)

  42. Hierarchy (Table 2.4) Level Name Objects Example Operations 13 Shell User programming Statements in shell language environment 12 User processes User processes Quit, kill, suspend, resume 11 Directories Directories Create, destroy, attach, detach, search, list 10 Devices External devices Open, close, as printer, displays read, write and keyboards 9 File system Files Create, destroy, open, close read, write 8 Communications Pipes Create, destroy, open, close, read, write

  43. Hierarchy Level Name Objects Example Operations 7 Virtual Memory Segments, pages Read, write, fetch 6 Local secondary Blocks of data, device Read, write, allocate, free store channels 5 Primitive processes Primitive process, Suspend, resume, wait, semaphores, ready signal list

  44. Hierarchy (Hardware) • Level Name Objects Example Operations • 4 Interrupts Interrupt-handling Invoke, mask, unmask, retry • programs • Procedures Procedures, call stack, Mark stack, call, return • display • 2 Instruction Set Evaluation stack, micro- Load, store, add, subtract • program interpreter, branch • scalar and array data • 1 Electronic circuits Registers, gates, buses, Clear, transfer, activate, • etc. complement

  45. 1.4.1 Microkernel architecture(微内核结构) 1.4.2 Multithreading(多线程) 1.4.3 Symmetric multiprocess(对称多处理) 1.4.4 Distributed operating systems(分布式系统) 1.4.5 Object-oriented design(对象设计) 1.4 Characteristics of Modern OS (p71)

  46. Assigns only a few essential(必要的) functions to the kernel, including address spaces, interprocess communication(IPC)(进程间通信), and basic scheduling. Simplifies implementation, provides flexibility(伸缩性)and well suited to a distributed environment. 1.4.1 Microkernel

  47. 1.4.2 Multithreading Thread:a dispatchable(分派) unit of work Process:a collection of one or more threads and associated(相关) system resources Introduce thread for improve the concurrence degree(并发度) E.g.:a database server accept many connection request and use multithread for process

  48. 1.4.3 Symmetric Multiprocessing (SMP p73) A computer hardware architecture and also to the operating system behavior that reflects that architecture. Multiple processors These processors share the same main memory and I/O facilities, interconnected by a bus or other internal connection scheme. All processors can perform the same functions(hence the term symmetric)

  49. SMP vs Single Processor Performance: parallel and concurrence(并行与并发) Reliability/Availability(可靠性/可用性) Incremental growth(可伸展性): enhance the performance of a system by adding an additional processor

  50. SMP vs Single Processor (Figure 2.12)

More Related