Chapter 2-3 Operating-System Structure

  1. View an OS from several vantage points
    • Services it provides
    • Interface available to users and programmers
    • Components and their interconnections
  2. OS services for users
    • User interface
    • Program execution(essential)
    • I/O operation
    • File-system manipulation
    • Communications
      • Shared memory
      • Message passing
    • Error detection
      • Ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs
  1. OS ensures efficient system operations:
    • Resource allocation
    • Accounting
    • Protection
      • ensuring that all access to system resources is controlled
  2. User operating-system interface
    • Command Interpreter(shells): The main function of the command interpreter is to get and execute the next user-specified command
    • Graphical user interfaces
  3. System calls
    • Interface between a running program and the OS
    • 通过陷入(trap)或异处理机构进行系统调用(通过子程序的入口地址表)
    • Methods used to pass parameters betwwn a running program and the OS
      • In registers
      • Store the parameters in a table in memory, and the table address is passed as a parameter in a register
      • Stack: push the parameters onto the stack by the program, and pop off the stack by OS
  1. System programs: system programs provide a convenient environment for program development and execution
    • File management
    • Status information
    • File modification 
    • Programming language support
    • Program loading and execution
    • Communications
    • Application programs
  2. Common system components
    • Process management
      • A process is a program in execution
      • 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 for
          • Process synchronization
          • Process communication
        • Providing mechanisms for deadlock handling
    • Main memory management
      • 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 needed
        • Protection
    • Secondary-storage management
      • The operating system is responsible for the following activities in connections with disk management
        • Free space management
        • Storage allocation
        • Disk scheduling
    • I/O system management
    • File management
      • The operating system is responsible for the following activities in connections with file management
        • File creation and deletion
        • 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
      • Must:
        • Distinguish between authorized and unauthorized usage
        • Specify the controls to be imposed
        • Provide a means of enforcement
    • Networking
      • Access to a shared resource allows
        • Computation speed-up
        • Increased data availability
        • Enhanced reliability
    • Command-Interpreter system
      • Many commands are given to the operating system by control statements which deal with:
        • process creation and management
        • I/O handling
        • secondary-storage management
        • main-memory management
        • file-system access
        • protection
        • networking
  3. System structure
    • Simple approach
      • MS-DOS
        • Not divided into modules
        • Interfaces and levels of functionality are not well separated
      • UNIX
        • System programs
        • The kernel
      • Layered approach: the bottom layer is the hardware, the highest layer is the user interface. Layers are selected such that each uses functions and services of only lower0level layers
        • 分层的基本原则:
          • 每一层都使用其底层所提供的功能和服务,以便于系统调试和验证。
        • 困难
          • 层次的划分和安排,要保证不出现双向依赖关系
        • The first design used in the OS
        • 优点
          • 低层和高层可分别实现(便于扩充);
          • 高层错误不会影响到低层,便于调试、利于功能的增删改;
          • 调用关系清晰(高层对低层单向依赖),避免递归调用,有利于保证设计和实现的正确性
        • 缺点
          • 系统中所有进程的控制转移、通讯等任务全部交给系统的核心去管理,要花费一定的代价
  4. Microkernel
    • 基于微内核结构的OS和传统OS相比的特点
      • 内核精巧
      • 面向多处理机和分布式系统
        • 引入线程
      • 基于客户/服务器体系结构
    • 优点:
      • 易于扩充,易于移植
      • 提高系统的可靠性:
      • 提供多种操作环境
      • 便于实现分布计算:以同样的调用形式,在下层可通过核心中的网络传送到远方服务器上  (RPC, Remote Procedure Call)
    • 缺点:
      • 消息传递方式增加开销,使响应变慢
  5. Virtual machines
    • The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.
    • 实现方式: 分时,共享
    • The resources of the physical computer are shared to create the vitual machines
      • CPU scheduling can create the appearance that users have their own processor
      • Spooling and a file system can provide virtual card reader and virtual line printers
      • A normal user time-sharing terminal serves as the virtual machine operator's console
  6. 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
  7. Mechanisms and policies
    • The separation of policy from mechanism is a vital principle, it allows maximum flexibility if policy decisions are to be changed later
  8. System implementation
    • Traditionally written in assembly language, now HLL
    • OS written in HLL
      • Can be written faster
      • More compact
      • Easier to understand and debug
      • Easier to port(move to some other hardware)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值