Linux Kernel Learning Summary
Huang Original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000
Understanding of Linux systems and learning about Linux kernels
Linux is a multi-process operating system, so other processes must wait until the running process is idle for the CPU to run. When a running process waits for other system resources, the Linux kernel gains control of the CPU and allocates the CPU to other waiting processes, which is the process switch. The scheduling algorithm in the kernel determines which process the CPU is allocated to.
The Linux system has a process table, and a process is one of them. Each item in the Process Control table is a TASK_STRUCT structure that stores a variety of low-level and advanced information in the TASK_STRUCT structure, including links from the registers of some hardware devices to the working directory of the process. The Process Control table is both an array, a doubly linked list, and a tree, and its physical implementation is a static array that includes multiple pointers. Once the system is started, the kernel is typically represented as a process. A global pointer variable, pointing to Task_struct, is used to record a running process.
In the beginning, I think the main problem is that you know, not understand, that a subsystem is implemented using some kind of strategy and method, and what needs to be done in learning is to know that there is such a thing, and then to understand the strategy or method described. But after the teacher explained, only then found that understanding is more important.
After learning the course, you can build up the core framework in your own mind, understand the design concepts and construction ideas of each subsystem, these ideas and ideas will be presented to you from the macro-clear context, like a branch of the tree to remove branches and leaves of the trunk, at a glance; Of course, it will also involve specific implementation methods, functions, But at this point the contact function or method is located at the higher level of the kernel implementation, is the main (want) function, has been aware of these functions, aimed at what design ideas, the realization of what kind of function, achieved what purpose. As for the other auxiliary functions called by the main function is equivalent to branches and leaves, do not have to go into the deep. At this point, the initial establishment of the kernel subsystem framework and code implementation of the association between, is actually very simple, such as a see a function name, I think of this function is for which subsystem, the realization of what function.
Linux Kernel Analytics Blog links and Knowledge aggregation
- Learning Links
- Linux kernel Analysis first week study summary-How the computer works
Linux Kernel Analysis second week learning summary-how the operating system works
Linux Kernel Analysis Third week study summary--construct a simple Linux system menuos
Linux Kernel Analysis Fourth Week study summary--three layers of skin (top) of the Clawed application system
Linux kernel Analysis Fifth Week study summary--three layers of peel (bottom) of the application system
Linux Kernel Analysis Sixth Week study summary--description of the process and creation of the process
Linux Kernel Analysis Seventh Week study summary-executable program loading
Linux Kernel Analysis Eighth Week study summary-process switching and system general execution process
Learning Knowledge Summary
1. How does the computer work?
Storage Program Computer Working model
X86 Compilation Basics
Assemble a simple C program to analyze its assembly instruction execution process
2. How does the operating system work?
function Call stack
Simulating the operating model and clock interruption of the stored program computer with the help of the Linux kernel part source code
Construct a simple operating system kernel on the basis of Mykernel
3. Construct a simple Linux system menuos Linux kernel source code introduction
To construct a simple Linux system
Tracing the boot process of the debug Linux kernel 4. Three layers of skin (top) of the system call
(i) User state, kernel state and interrupt processing process
(ii) Overview of system invocation
System call Overview and system call three-layer skins
(iii) triggering the same system call using the Library function API and the embed assembly code in C code
Using the Library function API to get the current time of the system
Method of embedding assembly code in C Code (review)
Trigger system call to get system current time using embedded assembler code in C code
5. Three-layer peel of the application system (bottom)
(i) Add time and Time-asm commands to Menuos
(ii) Call the kernel function using the GDB tracking system Sys_time
(iii) Mechanism and initialization of system calls in kernel code
1. Mechanism and initialization of system calls in kernel code
2. Simplified, easy-to-understand System_call pseudo-code
3. Simply browse the main code between System_call and Iret
6.Description of the process and creation of the process
Description of the process
- Process descriptor TASK_STRUCT Data structure (i)
- Process descriptor TASK_STRUCT Data structure (ii)
Creation of processes
- Overview of process creation and user-state code for a process fork
- Understand how complex code is created by the process
- Browse key code related to process creation process
- Where does the new process of creation start?
- Using GDB to track the process of creating a new process
7. Loading of executable programs
(a) preprocessing, compiling, linking, and format of the target file
1. How can I get the executable program?
2. Format of the target file elf
3. Statically linked elf executable file and process address space
(ii) executable programs, shared libraries, and dynamic loading
1. Work before loading the executable program
2. Load-time dynamic link and runtime dynamic link application Example
(iii) Loading of executable programs
1. Analysis of key issues related to the loading of executable programs
Internal process of 2.sys_execve
3. Using GDB to track the processing of SYS_EXECVE kernel functions
4. Executable program loading and Zhuangsheng dream Butterfly Story
5. Analysis of dynamic linked executable program loading
8. Process switching and general execution of the system
(i) Key code SWITCH_TO analysis of process switching
1. Timing analysis of progress and process scheduling
2. Process context switch related code analysis
(ii) General implementation process of Linux systems
Analysis of general execution process of 1.Linux system
Several special cases in the process of 2.Linux system execution
3. The core and the dancer
(iii) Overview of the Linux system architecture and implementation process
1.Linux Operating System Architecture Overview
2. Simplest and most complex operation--perform LS operation
3. The implementation of Linux systems from a CPU and memory perspective
Summary: Learn the biggest gains from the Linux kernel analysis course? What is your biggest regret after learning the Linux kernel analysis course?
The class is finished, but the kernel learning is only beginning. These weeks of blog and homework, has been carefully written, the knowledge is somewhat mastered but has not been clear enough. In the discussion only to know that their foundation is weak. In class, we analyzed the linux-3.18.6 kernel source code, its exquisite data structure and algorithm is just breathtaking. Classroom We also just look at some of the core source code, I hope in the future I can learn more. Simple, beautiful kernel, we have no reason not to learn. Linux kernel, including process management, memory management, device driver, file system, from the analysis of the kernel to understand how the whole system is working, how to control the management of resource allocation, process switching and execution. Various strategies and structures make the system more efficient to run. Only by knowing the basic working mechanism can you effectively crop the kernel and recompile the kernel to generate efficient, portable kernel modules.
The biggest harvest is to let me have a further understanding of the kernel, for the source can go to the search to see, can read some of the core source code to verify the teacher said theory. The previous study is like elephant, cannot connect together, learns very fragmentary. Through this class, as the teacher said, sometimes we can first think about how the system is how to manage, and then see the source code verification to correct their ideas, such a kernel learning way more effective, after all, the kernel source code is profound, want to study thoroughly not overnight can do.
Summing up my study of this course, I feel regret is still a lot of shortcomings, Mu class ended, to now have not all the knowledge point string up, not very good form a main line, but also need to spend more time to reason, can have clearer ideas to better learn the kernel.
Linux Kernel Learning Summary