"Linux Kernel Design and Implementation" Reading Notes-Introduction to Linux Kernel

basis

The kernel source code version used in the book: Linux 2.6.34

In China, you can download the mirror image of the kernel at the following website:

http://ftp.sjtu.edu.cn/sites/ftp.kernel.org/pub/linux/kernel/

 

What is operating system

Operating system refers to those parts responsible for completing the most basic functions and system management in the entire system.

These parts include the kernel, device drivers, bootloader, command line Shell or other kinds of user interfaces, basic file management tools and system tools.

 

Unix

The Unix system has now evolved into a family of operating systems with similar application programming interfaces (APIs) and based on similar design concepts.

Unix has only a few hundred system calls and has a very clear design purpose.

Everything in Unix is ​​treated as a file (so it can be operated through a unified interface, but the network is an exception).

Unix is ​​written in C language.

Unix process creation is very fast.

Unix provides a simple and stable inter-process communication primitive.

 

Linux

Linux borrows many designs from Unix and implements Unix API, but Linux does not directly use Unix source code.

The foundation of the Linux system is the kernel, C library, tool set, and basic system tools (such as login programs and Shell).

 

Kernel

Usually a kernel is composed of an interrupt service program responsible for responding to interrupts, a scheduler responsible for managing multiple processes to share processor time , a memory management program responsible for managing the address space of the process, and system service programs such as network and inter-process communication .

The kernel runs in the kernel space.

The application runs in user space.

The application program communicates with the kernel through system calls .

Applications usually call library functions (such as the C library), and then the library functions through the system call interface to let the kernel complete different tasks.

The kernel is also responsible for managing the hardware devices of the system, which makes use of the interrupt mechanism .

When the hardware needs to communicate with the system, it first sends out an asynchronous interrupt signal. The interrupt usually corresponds to an interrupt number . The kernel uses this interrupt number to find the corresponding interrupt service routine to respond and process the interrupt.

The interrupt service routine runs in a special interrupt context that has nothing to do with all processes .

The Linux kernel is a single kernel (macro kernel), but introduces a modular design, preemptive kernel, support for kernel threads and the ability to dynamically load kernel modules.

The kernel does not distinguish between threads and other general processes. It is the same for the kernel, only some of them (threads) share resources.

 

The relationship between application, kernel and hardware

 

Guess you like

Origin blog.csdn.net/jiangwei0512/article/details/105962121