1. Operating system overview

1.1 What is an operating system

1.1.1 Definition

Operating System (Operation System, referred to as OS) is a computer program that manages computer hardware and software resources. The operating system needs to handle basic tasks such as managing and configuring memory, determining the priority of system resource supply and demand, controlling input devices and output devices, operating the network, and managing the file system.

Operating system is a software that can manage CPU, memory and various peripherals, and manage and service application software

1.1.2 Function

Program management, resource management, equipment management, file management
Linking up and down: Connecting the underlying hardware with the upper-level software.
Resources include built-in CPU and peripherals.
The operating system abstracts the CPU as a process, disk as a file, and memory as an address space.

1.1.3 Composition

CPU

Each CPU has a specific set of instructions that can be executed. Therefore, x86 CPUs cannot execute ARM programs and ARM CPUs cannot execute x86 programs. Since accessing memory to obtain execution or data takes longer than executing instructions, all CPUs contain internal registers to store key variables and temporary results.

RAM

Multithreading does not provide true parallel processing. Only one process is running at a time.

The memory system adopts a hierarchical structure. The memory at the top has the highest speed, but has the smallest capacity and very high cost. The lower the hierarchical structure, the slower the access efficiency and the larger the capacity, but the cheaper the cost.
The top layer of the memory is the register in the CPU, which has the shortest access time but the smallest capacity.
Below the registers is the cache . The main memory is divided into cache lines of 64 bytes. The most frequently used cache lines are stored in the cache located inside the CPU or very close to the CPU.

Random Access Memory (RAM): The most important type of memory, also called main memory, is an internal memory that directly exchanges data with the CPU. It can read and write at any time (except when refreshing), and it is very fast, and is usually used as a temporary data storage medium for the operating system or other running programs. When RAM is working, information can be written (stored in) or read (taken out) from any designated address at any time. The biggest difference between it and ROM is the volatility of data, that is, the stored data will be lost once the power is off. RAM is used in computers and digital systems to temporarily store programs, data, and intermediate results.

Modern CPUs have designed two caches. The first level cache or L1 cache is always located inside the CPU and is used to transfer decoded instructions into the execution engine of the CPU. For those frequently used keywords, most chips have a second L1 cache. The size of a typical L1 cache is 16 KB. In addition, there are often second-level caches, that is, L2 cache, which is used to store recently used keywords, usually in megabytes. The biggest difference between L1 cache and L2 cache is whether there is a delay. There is no delay in accessing the L1 cache, but there will be a 1-2 clock cycle delay in accessing the L2 cache.

In the above hierarchy, the next layer is the main memory , which is the main force of the memory system. The main memory is usually called RAM (Random Access Memory).
In addition to the main memory, many computers also have a small amount of non-volatile random memory. Take the memory. They are different from RAM in that non-volatile random access memory does not lose its contents after the power is off. The content in ROM (Read Only Memory) will not be modified once it is stored. It is very fast and cheap.
ROM (Read Only Memory): Read-only memory is a type of semiconductor memory. Its characteristic is that once data is stored, it cannot be changed or deleted, and the content will not disappear because the power is turned off. In electronic or computer systems, it is usually used to store programs or data that do not need to be changed frequently.
The next level is the disk (hard disk)
Solid State Disk (SSD) is not a disk

Peripherals

Any complicated things can be solved by adding a layer of agents. This is a universal solution for computers or human society.
Each type of device controller is different, so different software is needed to control it. The software that specializes in information exchange with the controller, sends out commands to process instructions and receives responses is called a device driver.

1.1.4 Categories

The operating system is located under the application software and provides service support for the application software.
Externally known as: Shell (such as GUI, command line)
Internally known as: Kernel (Kernel)
KERNEL is the research focus, located under the shell.

1.1.4.1Kernel-operating system internal components

Mainly include:
CPU scheduler,
physical memory management,
virtual memory management,
file system management,
interrupt management and device drivers

1.1.5 Features of OS Kernel

1. Concurrency
There are multiple running programs in the computer system at the same time, which requires OS management and scheduling
. The difference between concurrency and parallelism.
Concurrency: a period of time, multiple programs run at the same time.
Parallelism: a point in time
2. Sharing
"simultaneous" access
mutually exclusive sharing
simultaneously Sharing
3. Virtual
use of multi-program design technology, so that each user feels that there is a computer dedicated to him
4. The execution of asynchronous
programs is not consistent to the end, but stop and go, and the speed of advancement is unpredictable. But as long as the operating environment is the same, the OS needs to ensure that the results of the program are also the same

1.2 Why the learning system

1.2.1 Integrated courses-combining many different classrooms

*Program design language
*Data structure
*Algorithm
*Computer architecture
*Materials
*Operating system concepts and principles, source code
*Skills
*Operating system design and implementation

1.2.2 Why learn operating system

1.2.2.1 Requirements

The operating system is constantly developing, and there is a strong demand in industrial control and other fields


Operating system code must be reliable and efficient.
Operating system errors can cause great losses.
Operating system is the foundation of system security

1.2.2.2 Role

The operating system is cool, useful, challenging, and challenging to improve
ability : the
amount of code is large, and the goal is to master the core.
Operating system management concurrency.
Operating system code manages hardware.
Good hardware management.
Reasonable resource allocation.
Understanding how it works

Operating systems need to weigh:
space and time,
performance and predictability,
fairness and performance

1.2.2.3 Importance

One of the cornerstones of computer science research The
basic components of a computer system
are driven by the development of hardware and application requirements

1.2.2.4 Continuous advancement of academics and industry

Top conference:
SOSP
USENIX

1.3 How to learn the operating system

Understand concepts and principles
Practice: Read the code,
depending on your needs

1.4 Operating system example

UNIX family: FreeBSD, NetBSD, OpenBSD, Mac OS, etc.
Learn more: Unix History
Linux family
Learn more: Linux version family
Windows family
Specific applications: analysis of weather, industrial control and other systems

1.5 History of the operating system

Continuous development:
R&D and development of transistors, CPUs, hardware, peripherals, and networks

Early computer programs and data transfer tape, loading the operating system only functions of
the processing by the program sequence to the multi-processing
to make better use of computer resources, and to better interact with the user, there has been time-sharing system
PC operating The emergence of the system,
multi-core, multi-processing,
cloud operation

1.5.1 Evolution

Hosted computing -> personal computer computing -> network computing -> pervasive computing (cloud computing, mobile computing)

1.6 Operating system structure

(1) Simple operating system: MS-DOS has a single core without modules (internally accessed through function calls, shortcomings, complex, tightly coupled, vulnerable to attacks)

(2) Microkernel: transplant the kernel function to user space as much as possible, the disadvantage is low performance.

(3) The outer core, the inner core is divided into one, one is responsible for dealing with the hardware, and the other is dealing with the application.

(4) Virtual machine
VMs (virtual machine) -> VMM (virtual machine monitor) -> physical machine hardware, multiple operating systems share hardware resources
VMM (virtual machine monitor), also known as hypervisor, virtualizes all hardware Resources.

Guess you like

Origin blog.csdn.net/weixin_51864831/article/details/111823254
Recommended