Huawei's internal nanny-level fairy notes finally open source! All the knowledge points that operating system programmers must know are sorted out!

The mystery of operating systems

I remember a poem that I often read when I was young is like this:

I have been counting since I was young.

Count to sensible and mature,

No count yet.

Why are the stars in the sky uncountable?

Like memories and fantasy,

Always burdened with stubborn mystery...

For many university students in computer science and related majors, operating systems are like stars in the sky, hiding a stubborn mystery that will never be clear to them. However, is the operating system really not clear?

no. It’s not clear because I didn’t see the mystery behind it. This mystery is not known to everyone. Even people who study operating systems don't necessarily realize it, let alone computer beginners.

So what is this mystery?

The stars in the sky cannot be counted because what we are trying to do is to count the stars. If we change the angle, instead of counting the stars, but the designer looking for the stars, let him tell us the number of stars, wouldn’t it be clear?

This is exactly the mystery of learning operating systems. To understand the operating system, we must find the designers of the operating system and let them tell us all the secrets of the operating system. Of course, the search for designers here is not really looking for them, because it is impossible to find all the designers. The designer here refers to an abstraction, a philosophy of life shared by all designers, because when designing an operating system, designers will unconsciously construct their own thinking or life pursuits in the operating system, thereby giving operations The system is based on the mind, and the operating system runs under the command of this mind.

Introduction to operating system notes outline

 

 

 

 

Too much content, omit part Σ( ° △ °|||)︴

The notes are divided into 8 chapters, namely basic principles, process principles, thread principles, memory principles, file principles, I/O principles, multi-core principles, and operating system design

Let us now reveal the secrets together and count the stars in the operating system.

The first chapter, basic principles

The falsehood is true, the avenue is invisible

The most important core idea of ​​this article is the role played by the operating system in the process of computer operation: magician and manager. The magician turns ugliness into beauty, turns nothing into existence, and turns less into more; while managers manage all computer resources to achieve a "double material" realm of fairness and efficiency. The understanding of these two roles of the operating system will be very helpful to the mastery of processes, threads, virtual memory, file systems and input and output systems.

  • Chapter 1 Introduction to Operating Systems
  • Chapter 2 Operating System History
  • Chapter 3 Basic Concepts of Operating System

How the program works

 

Manager role

 

Interview questions

  1. What is an operating system? Please describe your understanding of the operating system in one sentence.
  2. What is your opinion on the relationship between operating systems and user programs? Explain your thoughts.
  3. Briefly list the areas covered by the operating system and the core content of each area.
  4. The operating system needs to manage different components. Please discuss the similarities and differences between these managements.
  5. What is the purpose of equipment management?
  6. Some people say that device management software (device driver) is often provided by a third party and should not be part of the operating system. What is your opinion on this? How do you think it should be judged-is a piece of software an operating system?
  7. Please list the intervention of the operating system during program execution.
  8. What is the basis for saying that the operating system is a man-made subject?
  9. What are the characteristics of man-made subjects? How does it help us to learn operating systems?
  10. The OS needs a compiler to compile, and the operation of the compiler needs the support of the OS. Then who appears first and who appears later?

The evolution of operating systems

 

The future development trend of operating systems

 

Basic knowledge of computer hardware

 

 

Operating system structure

 

Chapter Two, Process Principle

In a daze, there is something in it; in a daze, there is something in it

This chapter includes the content of Chapters 4~6. Chapter 4 describes the logical inevitability of the emergence of processes, the efficiency of multiprogramming, the creation and death of processes, the state and conversion of processes, processes and address spaces, process management and process model defects. The contents of Chapter 5 include scheduling goals, first-come-first-served, time slice rotation, short task priority, priority scheduling, hybrid scheduling, real-time scheduling and other algorithms, and discuss priority inversion and thread uncertainty. Chapter 6 covers why communication, pipes, named pipes, sockets, signals, semaphores, shared memory, message queues, etc. are needed.

 

  • Chapter 4 Process
  • Chapter 5 Process Scheduling
  • Chapter 6 Process Communication

Introduction to Process

 

Benefits of multiprogramming

 

Process management

 

Process embrace: shared memory

 

The third, thread principle

This article discusses the process-level concurrency mechanism-the process model. This chapter includes the contents of Chapters 7-10. The content of Chapter 7 includes process clone technology process, process management, process user mode, kernel mode and mixed mode realization, modern operating system process realization model, the relationship between multiple processes, and the main considerations of the process model. Chapter 8 covers why synchronization, the purpose of synchronization, the evolution of lock primitives, sleep and wake primitives, semaphores, monitoring, message passing, and fences. Chapter 9 explains the occurrence, development, prevention, and avoidance of deadlock, and discusses the relationship between deadlock, livelock, and starvation. Chapter 10 describes how to use interrupt enable and disable, test and setup to implement lock primitives.

  • Chapter 7 Threads
  • Chapter 8 Thread Synchronization
  • Chapter 9 Philosophical Principles of Deadlock Response
  • Chapter 10 Lock Implementation

 

Process clone technique-thread

 

Kernel mode thread implementation

 

User mode thread implementation

 

Enter kernel mode from user mode

 

No hair control: dynamic avoidance of death

 

Chapter Four, Memory Principle

This chapter includes the contents of Chapters 11-14.

Chapter 11 describes the memory management environment, virtual memory, the location of the operating system in the memory, the location of the program in the memory (fixed load address, fixed partition, variable partition), and basic memory management mechanisms (address translation, base address limit) , Exchange), free space management, etc.

Chapter 12 explains the problem of base address limit, paging management, page tables, page translation process, advantages and disadvantages of paging management system, multi-level page tables, address translation speed, locked pages, memory jitter and page size design.

Chapter 13 explains in detail the ins and outs of the page replacement algorithm, the purpose to be achieved, and various specific page replacement algorithms.

Chapter 14 includes the limitations of the page management system, the segment management system, the advantages and disadvantages of the segment, the segment number and the number of addressing bits, and discusses the role of negation in the development of the memory management model.

The concept of virtual memory

 

First-in-first-out algorithm

 

Use matrix to implement LRU algorithm

 

Segment management system

 

Chapter 5, Principles of Documents

If there is a lack of great success, it will not be used; if a great profit is high, it will be used endlessly

The content of this article includes the content of Chapter 15~18.

The 15th chapter tells about the content including the disk structure, disk access speed, disk operating system interface, disk access process and disk scheduling.

Chapter 16 describes why a file system is needed, what is a file system, the purpose of the file system, basic knowledge of files, file storage structure, file types, file access, file attributes, file operations, folders, relative and absolute paths, sharing Links, memory-mapped files, etc.

Chapter 17 includes file system distribution, file realization, folder realization, shared file realization, disk space management, etc.

The content of Chapter 18 includes file security performance (file access control, access control list, capability table), file reliability performance (persistence, consistency, log, transaction, shadow, consistency check) and file system efficiency performance ( Read in advance, reduce the moving distance of the magnetic arm, log structure file system (LFS).

  • Chapter 15 Touch Disk Operation
  • Chapter 16 File System.
  • Chapter 17 File System Implementation
  • Chapter 18 File System Performance

 

The structure of the disk

 

File system

 

File content organization

 

File realization

 

Enforcement of access control

 

File system persistence

 

Chapter 6, I/O Principles

The good, the teacher of the bad; the bad, the resource of the good

Therefore, if a computer is really useful, it must have input and output. Since the operating system is the controller of the computer, of course it also needs to control the input and output. This article explains the input and output mechanisms of the computer to communicate with the outside world. There is only one chapter in this article (Chapter 19). The discussion includes the importance and purpose of input and output, input and output hardware, physical I/O modes (proprietary channel I/O, memory mapped IO, composite I/O , DMA), input and output software, software I/O mode (programmable I/O, interrupt-driven I/O, DMA), I/O software layering, device drivers, etc.

 

Device controller

 

Physical I/O mode

 

Logical I/O mode

 

Chapter Seven, Multi-core Principle

Good words do not believe, faith words are not beautiful

This article explains the emerging multi-core technology. Focus on the impact of the multi-core environment on the operating system. The whole article includes two chapters, Chapter 20 and Chapter 21. Chapter 20 includes the multi-core processor structure (hyper-threading structure, multi-core structure, multi-core hyper-threading structure), multi-core memory structure (UMA, NUMA, COMA, NORMA), the startup process of a symmetric multi-core processor computer, and the Inter-communication, SMP cache consistency, etc. Chapter 21 includes multi-core process synchronization, software synchronization primitives in multi-core environments, spin locks and their implementation, queue spin locks, process scheduling in multi-core environments, energy management in multi-core environments, and multi-core system performance.

  • Chapter 20 Multi-core Architecture and Memory
  • Chapter 21 Process Synchronization and Scheduling in a Multi-core Environment

 

Multiprocessor structure

 

Multi-core structure

 

SMP cache consistency

 

Chapter Eight, Operating System Design

If you hear a lot of poor, don’t keep it in the middle

This article expounds the ten philosophical principles of operating system design from the perspective of a tall building. Obviously, there are many operating system design principles, and only ten very important ones are selected in this article. Chapter 22 discusses and compares these ten principles from the two levels of operating system and human society, so that readers can understand more clearly that operating system is the reflection of human society in computers, and understand the operation of human society. The operation of the system. After reading this article, readers can discover other design principles and principles of mining operating systems.

The first philosophical principle of operating system design: hierarchical architecture

 

Philosophical principle: simplicity is beauty-seeking simplicity and eternity

 

See the end of the article for the full version

The two [Operating System Notes] documents are 400+ and 300+ pages respectively. Friends who need the full version can like this article and follow the editor. See the picture below to get it! !

The second operating system note

 

The content is very much, slightly Σ( ° △ °|||)︴................................... ....................

 

Processes and threads

 

Interprocess communication

 

Scheduling

 

RAM

 

No memory abstraction

 

The concept of address space

 

File system

 

Free space block

 

 

File system management and optimization

Physical dump and logical dump

 

File system consistency

 

I / O

 

I/O device

 

I/O hierarchy

 

plate

 

Common interview questions

 

abridgement................................................. .............................................

Terms you must know about operating systems

 

(Because there is too much content, we will not show Σ( ° △ °|||)︴)

The two [Operating System Notes] documents are 400+ and 300+ pages respectively. Friends who need the full version can like this article and follow the editor. See the picture below to get it! !

 

Don't be disappointed,

Disappointment makes us age,

While we are still young,

Look up, let us count the stars;

Maybe we can count;

Maybe we can see the truth:

Maybe we can find hope...

Guess you like

Origin blog.csdn.net/weixin_48182198/article/details/109096666