OS Review Chapter 3: Operating-System Structures

Chapter 3: Operating-System Structures

Common System Components

  • Process Management : A process is a program in execution

    Process creation and deletion.

    process suspension and resumption.

    Provision of mechanisms for: (1)process synchronization (2)process communication (3)deadlock handling

  • Main 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.

  • File Management

  • I/O System Management :

    A buffer-caching system

    A general device-driver interface

    Drivers for specific hardware devices

  • Secondary-Storage Management

  • Networking

  • Protection System

  • Command-Interpreter System

Operating System Services

  • Program execution
  • I/O operations
  • File-system manipulation
  • Communications
  • Error detection

Additional Operating System Functions ( not for helping the user, but rather for ensuring efficient system ):

  • Resource allocation
  • Accounting
  • Protection

System Calls

System calls provide the interface between a running program and the operating system.

在这里插入图片描述

System Call Implementation

Typically, a number associated with each system call :System-call interface maintains a table indexed according to these numbers (系统调用表)

The caller need know nothing about how the system call is implemented :

  • Just needs to obey API and understand what OS will do as a result call
  • Most details of OS interface hidden from programmer by API

API – System Call – OS Relationship

一个API可以有多个System call

在这里插入图片描述

System Call Parameter Passing

Three general methods used to pass parameters to the OS:

  • Simplest: pass the parameters in registers : In some cases, may be more parameters than registers
  • Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register
  • Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system

Communication Models

Communication may take place using either message passing (pipeline) or shared memory.

在这里插入图片描述

System Programs

Simple Structure

MS-DOS – written to provide the most functionality in the least space :

  • Not divided into modules
  • Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated

在这里插入图片描述

UNIX

limited by hardware functionality, the original UNIX operating system had limited structuring

  • Systems programs
  • The kernel

在这里插入图片描述

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 functions (operations) and services of only lower-level layers.

优点:

  • 低层和高层可分别实现(便于扩充);
  • 高层错误不会影响到低层,便于调试、利于功能的增删改;
  • 调用关系清晰(高层对低层单向依赖),避免递归调用, 有利于保证设计和实现的正确性

缺点:

  • 系统中所有进程的控制转移、通讯等任务全部 交给系统的核心去管理,要花费一定的代价
  • 效率低
  • 分层时引发混淆

Microkernels

Moves as much from the kernel into “user” space .

Communication takes place between user modules using message passing.

在这里插入图片描述

Benefits:

  • Easier to extend a microkernel
  • Easier to port the operating system to new architectures
  • More reliable (less code is running in kernel mode)
  • More secure

Detriments:

Performance overhead of user space to kernel space communication(性能开销太大,效率低)

Windows NT Client-Server Structure

在这里插入图片描述

Virtual Machines

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.

在这里插入图片描述

Java Virtual Machine

WORE : write once, run everywhere.

在这里插入图片描述

Operating System Design and Implementation

Start by defining goals and specifications .Affected by choice of hardware, type of system.

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: What will be done?

Mechanism: How to do it?

The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later.

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

System Boot

发布了38 篇原创文章 · 获赞 11 · 访问量 3833

猜你喜欢

转载自blog.csdn.net/qq_43721475/article/details/104846186