Chapter One introduction to the Linux kernel
The activity of each processor at any point in time must be summed up in the following three things:
- Run in user space, execute user process
- Runs in kernel space, is in the process context, executes on behalf of a particular process
- Runs in kernel space, is in the interrupt context, is independent of any process, and handles a specific interrupt
The difference between the Linux kernel and the traditional UNIX system:
- The Linux kernel can preempt
- The Linux kernel does not differentiate between threads and other general processes
- Linux provides object-oriented device models with device classes, hot plug events, and device file systems for user space
- Linx ignores some of the UNIX features that are thought to be poorly designed and obsolete standards that are difficult to implement
- Linux embodies the essence of "freedom", the existing Linux feature set is the result of free development of Linux open development model
Comparison of single-core and multi-core designs:
Single Core
- The entire kernel is running on a large kernel address space
- Advantages: simple and efficient. All cores are in a large address space, so calls and call functions are similar between functions of the kernel, with little performance overhead
- Cons: A feature crash can cause the entire kernel to be unusable
Micro-core
- The kernel is divided into individual processes by function. Each process runs independently on its own address space
- Pros: safe. The various services of the kernel run independently, one service hangs without affecting other services
- Cons: Calls between the kernel's services involve inter-process communication, which is more complex and inefficient
Linux kernel Design
- Based on a single core
- Features of the microkernel: modular design, preemptive kernel, kernel threading support, dynamic loading of kernel modules
- Avoiding performance flaws in microkernel design: Let everything run in kernel state, call functions directly, no message delivery
Chapter II starting from the kernel
Kernel source tree:
| Catalogue |
Description |
| Arch |
Code for a specific architecture |
| Block |
Block device I/O layer |
| Crypo |
Encryption API |
| Documentation |
Kernel Source Documentation |
| Drivers |
Device drivers |
| Firmware |
Device firmware required for use with certain drivers |
| Fs |
VFS and various file systems |
| Include |
Kernel header File |
| Init |
Kernel Boot and initialization |
| Ipc |
Inter-process Communication code |
| Kernel |
A core subsystem such as a scheduler |
| Lib |
Same kernel function |
| Mm |
Memory management subsystem and VMS |
| Net |
Network subsystem |
| Samples |
Example, demo code |
| Scripts |
Scripts used to compile the kernel |
| Security |
Linux Security Module |
| Sound |
Voice subsystem |
| Usr |
Early user space code (so-called Initramfs) |
| Tools |
Tools that are useful in Linux development |
| Virt |
Virtualization Infrastructure |
- COPYIN: Kernel License
- CREDITS: List of developers
- Maintainters: Maintainer list (maintaining kernel subsystems and drivers)
Kernel Development Features:
- Kernel programming can neither access C libraries nor access standard C header files
- Kernel programming must use gun C
- Kernel programming lacks a memory protection mechanism like user space
- Difficult to perform floating-point arithmetic during kernel programming
- The kernel gives each process only a small fixed-length stack
- Because the kernel supports asynchronous interrupts, preemption, and SMP, you must always be aware of synchronization and concurrency
- To consider the importance of portability
"Linux kernel Design and implementation" chapter 12th notes