OS——OS structure

OS structure

1. BEFORE:

The goals of the system being well defined is important.
- points:services, interface, components and interconnections.

2. services:

  • user interface
    • command-line interface: in kernel, system programs or shells
      • two ways commands can be implemented: built-in or system programs
    • batch interface
    • GUI
  • program execution
  • IO operations
  • File-system manipulation
  • communications : shared memory or message passing
  • error detection
  • resource allocation
  • accounting
  • protection and security

3. system calls

Typically written in a high-level language (C or C++).
-Mostly accessed by programs via a high-level Application Program
Interface (API) rather than direct system call use
-The API specifies a set of functions available to an application
programmer, including the parameters passed to each function and
the return values the programmer can expect.
-Three most common APIs are
——Win32 API for Windows
—— POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X)
——POSIX:Portable Operating System Interface for computer environment
——Java API for the Java virtual machine (JVM)
A programmer accesses an API via a library of code provided by the operating system. (e.g. libc )
Why using API rather than invoking system calls?
portability, easier to use.
Three general ways to pass parameters to OS :
*registers, *Memory block, *stack
在这里插入图片描述

4. Types of system calls:

Process control

  • end, abort
  • load, execute
  • create process, terminate process
  • get process attributes, set process attributes
  • wait for time
  • wait event,signal event
  • allocate and free memory

File management

  • Create file, delete file
  • open, close file
  • read, write, reposition
  • get file attributes, set file attributes

Device management

  • Request device, release device
  • read, write, reposition
  • get device attributes, set device attributes
  • logically attach or detach devices

Information management

  • Get time or date, set time or date
  • get system data, set system data
  • get process, file, or device attributes
  • set process, file, or device attributes

Communication

  • Create, delete communication connection
  • send, receive messages if message passing model to host name or process name
    – From client to server
  • Shared-memory model create and gain access to memory regions
  • transfer status information
  • attach or detach remote devices
  • two common models of communication
    – message-passing model:
    information is exchanged through an interprocess-communication facility (IPC) provided by the operating system.
    – Shared-memory model: process use map memory system call to gain access to regions
    of memory owned by other processes.

protection

  • Control access to resources
  • Get and set permissions
  • Allow and deny user access

5.system programs:

  • File management
  • Status information
  • File modification
  • Programming
  • language support
  • Program loading and execution
  • Communications
  • Background services
  • Application programs

6 OS Design and Implementation:

Start by defining goals and specifications

  • User goals and System 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

Important principle to separate Policy(策略) from Mechanism (机制)

7. Operating system structure:

  • Simple structure: MS-DOS, the original operating system]

  • Layered Approach:
    – the bottom layer (layer 0) is the hardware
    – the highest (layer N) is the user interface
    An OS layer is an implementation of an abstract object made up of data and the operations that can manipulate those data.
    Advantages: simplicity of construction and debugging.
    major difficulty:
    – careful definition of the layers.
    – The disk driver and the memory-management routines
    – The disk driver and the CPU schedule
    – less efficient than other types
    在这里插入图片描述

  • Microkernel :
    Microkernel Contains only essential Oses functions
    • Memory management
    • CPU scheduling
    • IPC
    The main function of the microkernel is to provide a communication between the client program and the various services that are also running in user space.
    Communication is provided through message passing.
    More extensibility
    – Allows the addition of new services
    More flexibility
    – New features added
    – Existing features can be subtracted
    More portability
    – easier to port from one hardware design to another
    – fewer changes needed, is changed in the microkernel
    More Security and Reliability
    – Modular design
    – Small microkernel can be rigorously tested

  • Mach ,Tru64 UNIX, Mac OS X kernel (Darwin) , QNX

  • The performance of microkernels can suffer due to increased system-function overhead.

  • Modules:
    The kernel has a set of core components and links in additional services via modules, either at boot time or during run time.
    resembles a layered system
    – each kernel section has defined protected interfaces
    – more flexible, any module can call any other module.
    similar to microkernel approach
    – the primary module has only core functions and knowledge of how to load and communicate with other modules
    – more efficient, modules do not need to invoke message passing in order to communicate

  • Hybrid Systems:
    Most modern operating systems are actually not one pure model
    – Hybrid combines multiple approaches to address performance, security, usability needs
    Linux and Solaris
    – Monolithic, the kernel in a single address space
    – Modular, new functionality can be dynamically added to the kernel
    Windows
    – mostly monolithic
    – plus microkernel for different subsystem personalities, run as user-mode processes.
    – Provide support for dynamically loadable kernel module

8.Operating-System Generation

  • Booting – starting a computer by loading the kernel
  • Bootstrap program – code stored in ROM that is able to locate the kernel, load it into memory, and start its execution.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值