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.

Insert picture description here

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

An API can have multiple System calls

Insert picture description here

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.

Insert picture description here

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

Insert picture description here

UNIX

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

  • Systems programs
  • The kernel

Insert picture description here

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.

advantage:

  • Low-level and high-level can be realized separately (easy to expand);
  • High-level errors will not affect the low-level, easy to debug, conducive to the addition, deletion and modification of functions;
  • The call relationship is clear (the high-level one-way dependence on the low-level), to avoid recursive calls, which is conducive to ensuring the correctness of the design and implementation

Disadvantages:

  • Tasks such as control transfer and communication of all processes in the system are all handed over to the core of the system to manage, which costs a certain price
  • low efficiency
  • Confusion when layering

Microkernels

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

Communication takes place between user modules using message passing.

Insert picture description here

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 (performance overhead is too high, efficiency is low)

Windows NT Client-Server Structure

Insert picture description here

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.

Insert picture description here

Java Virtual Machine

WORE : write once, run everywhere.

Insert picture description here

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

Principle to separate Important (separation mechanism and strategy)

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

Published 38 original articles · won 11 · views 3833

Guess you like

Origin blog.csdn.net/qq_43721475/article/details/104846186