Operating System Overview Operating System Chapter One Knowledge Point Summary

Series of articles

Chapter 2 Process Description and Control
Chapter 2 Process Scheduling

Chapter 1 Overview

1.1 Objectives and functions

1.1.1

operating system:
  • The program that controls the application
  • Interface between application and hardware
Three goals:
  • Convenience: user use
  • Effective: use system resources
  • Expansion: develop, test, introduce new system functions

The first layer of software above the hardware in a computer is the foundation of application software and system software.

service:

1. 程序开发:提供编辑器、调试器等应用程序开发工具  
2. 程序运行:程序的加载、空间分配等工作
3. I/O访问:隐藏I/O细节,统一I/O接口
4. 文件访问:隐藏物理介质细节,保护访问
5. 系统访问:控制对共享系统的访问,避免资源冲突
6. 错误检测和响应:检测、响应错误并清除错误条件
7. 记账:记录资源利用率和性能

The above seven items are the first goal of the operating system: convenience

1.1.2 OS as a resource manager

A computer is a group of resources, which are managed by the OS
The OS has the same function as ordinary software, which is a program or a group of programs executed by the processor

The OS often releases control (complete scheduling). At this time, the CPU stops running the OS program and shifts to perform more useful tasks (single core), and then the OS resumes control

As a resource manager
  1. Allocate and manage memory (paging, segmentation)
  2. I/O access (mutual exclusion, etc.)
  3. Access control and use of file resources
  4. Allocation of processors

Part of the OS is in memory: the kernel program and the
other part is in external memory: controlling I/O access

1.1.3 Easy scalability

Adapt to hardware upgrades (such as paging requires hardware support), fix errors, new services, etc.

Therefore, modular design is adopted: easy to add and modify module functions

1.2 OS history

1.2.1 Serial processing (processing mechanism)

There is no operating system in this fashion, and users access computers sequentially.

Problem: Hard copy (use the notebook) to schedule machine time is wasted; compilation, loading, and linking before the program runs also take a lot of time.

1.2.2 Simple batch processing

The first operating system was a batch processing system, which was born in the mid-1950s

Monitoring program (early operating system): processing a batch of programs at a time (playlist, one group of songs at a time, but one by one)

After the program is processed, it returns to the monitoring program, and the monitoring program automatically loads the next program

Monitoring program function:
  • Automatic renewal of work
  • Memory protection: protect the memory area where the monitoring program is located
  • Timer: Prevent a job from monopolizing the system
  • Privileged instructions: instructions that can only be executed by the monitoring system
  • Interrupt

It is the emergence of memory protection and privileged instructions that introduced the operating mode, and different modes have different access rights

  • User mode: user programs are executed in this mode, some memory areas are protected, and privileged instructions are not allowed to be executed
  • Kernel mode: The monitor program is executed in this mode and can execute privileged instructions
Disadvantages of simple batch processing: the processor is often idle, because I/O is too slow for the processor

1.2.3 Multi-pass batch processing

When a job is waiting for I/O, another job can be executed first.
Because the job to be run needs to be stored in memory, memory management is required

Multi-program design can improve the utilization of system equipment:
  • Store multiple jobs in memory
  • Multiple jobs can be executed concurrently
  • Job scheduler
Hardware support: hardware that supports I/O interrupt and DMA
Multi-channel batch processing features: multi-channel, scheduling, disorder, no interactive ability
Concurrency and parallelism: Concurrency means that multiple programs are running at the same time within a period of time, but it may still be one running after another. If running at the same time in the case of multiple cores, it will become parallel. Concurrency includes parallelism.

1.2.4 Time-sharing system (sharing processor time)

To realize human-computer interaction, the host is shared by multiple terminals

Time sharing system:
  • Multi-program design
  • Multiple users share the processor
  • Multiple users access the system at the same time through different terminals, and each user is controlled by the OS to execute alternately in a short time (faster than human response time)
Features of time-sharing system: versatility, independence, timeliness, interactivity
system Multi-pass batch processing Time-sharing system
aims Make full use of cpu Human-computer interaction
Instruction source operation user

The first time-sharing system: CTSS does
one sentence:

  • Write is larger than the existing one: the existing one is written out
  • The writing is small, freeing up space for writing, but part of it remains in it
Time slice technology: The system clock generates interrupts at a fixed time, the OS resumes control at the interruption, and the processor is allocated to a new user, while the current user is preempted

Real-time system

The system can respond to external requests in time , start or complete the processing of an event within the specified time , and control the coordinated operation of all real-time tasks

Real-time system application: aviation military, industrial control
Real-time system characteristics: determinism, responsiveness, user control, reliability, fault weakening ability

1.3 Main achievements of OS (four important theoretical developments)

1.3.1 Process

If the script is a program, the performance is the process

process
  • A running program
  • An instance of a program running on the computer
  • An entity that can be assigned to and executed by a processor
  • A unit of activity represented by a single sequential thread, a current state, and a set of related resources
Three major components of the process:
  1. An executable program
  2. Related data required by the program
  3. The execution context of the program (process state)
Process context includes: process status and data required by OS to manage and control the process

1.3.2 Memory Management

A file is a named object, a basic unit

File system: for long-term file storage
Virtual storage: logically access storage
  • Swap-in and swap-out: part of the job resides in memory, and swap-in and swap-out are arranged when pages are missing
Paging: The process is divided into blocks of the same size-pages
  • Virtual address: composed of page number and offset within the page, used to map a physical address

1.3.3 Information protection and security

Four types of typical security issues

1.3.4 Scheduling and resource management

Scheduling strategy: fair, effective, and differentiated (distinguish the length of the process)

1.4 Modern OS Features (Key Points)

  • Microkernel

    • Assign some basic functions to the kernel: address space, communication, basic scheduling
    • Based on the C/S architecture, the service program can be customized, called "server"
    • System structure is more flexible
    • Advantages : simplifies implementation, provides flexibility, and is suitable for distributed environments
  • Single core

    • The big kernel is implemented as a process, sharing the address space
    • Most of the functions provided by the OS are provided by the kernel
  • Multithreading

    • Divide the process of executing an application into multiple threads that can be performed simultaneously (threads are units of work)
    • Process: a collection of one or more threads and related resources
      • Scheduling unit: thread
      • Resource unit: data
  • Symmetric multiprocessing (SMP, multiple processors)

    • Multiple threads and processes can run in parallel
    • With multiple processors, transparent to users, OS is responsible for the synchronization of multiple processes
    • Better than multi-program design: multiple CPUs can be used to run the same process / multiple different processes can be executed at one time, and multiple different processes can be executed at the same time
    • The performance can be reduced by reducing the cpu, and the performance can be improved in turn
    • Advantages :
      • Availability: a single processor failure will not cause the machine to stop
      • Gradual increase: performance increases gradually with the addition of cpu
      • Scalability: manufacturers base their pricing on performance
    • The difference with multi-threading: multi-threading is still useful on single-processor computers, while SMP is equally effective for non-threaded processes. These two methods complement each other
  • Distributed OS

       - 给用户错觉:用户只有自己一个(其实是多个)
       - 分布式尚落后于单核和SMP
    
  • Object Oriented Technology

       - OS基于对象的结构有利于程序员定制
       - 可给内核增加模块化的拓展而不破坏完整性
       - 让分布式更容易实现(基于对象,引用更方便)
    

1.5 Fault tolerance (fault tolerance rate)

系统或部件发生错误时仍可继续运行的能力

Ways to improve fault tolerance:

- 进程隔离
- 并发控制(进程通信、协作)
- 虚拟机(应用隔离)
- 检测点和回滚机制

1.6 Multi-processor and multi-core OS design considerations

Multi-program design+SMP

Key: Thread and process concurrency, scheduling, synchronization, memory management, reliability, fault tolerance

Three levels of parallel capability:

1. 指令级并行
2. 程序并行
3. 应用程序并行

virtual machine

为一个进程分配一个或多个核,让这些cpu专门为该进程服务
When multi-core, the OS is responsible for allocating cores, but does not pay attention to resource allocation

1.7 Introduction to mainstream OS

  • Win series

  • Traditional UNIX

  • Modern UNIX

  • Linux

Guess you like

Origin blog.csdn.net/qq_44722674/article/details/111130023
Recommended