The most practical and core knowledge is obscure and difficult to learn. For this study syllabus, I hope it will be helpful to students who are learning the Linux kernel.
Process management and scheduling
Priority of the process
Process life cycle
Process representation
- Process type
- Namespaces
- Process ID number
- Process relationship.
System calls related to process management
- Process replication
- Kernel thread
- Start a new process
- Exit process
Implementation of the scheduler
- Overview
- data structure
- Processing priority
- Core scheduler
Completely fair scheduling
- data structure
- CFS operation
- Queue operation
- Choose the next process
- Process periodic scheduler
- Wake-up preemption
- Handle new processes
Real-time scheduling
- nature
- data structure
- Scheduler operation
Scheduler enhancement
- SMP scheduler
- Scheduling domain and control group
- Kernel preemption and low latency related work
Memory management
(N) Memory organization in UMA model
- Overview
- data structure
Page table
- data structure
- Creation and operation of page table entries
Initialize memory management
- Establish data structure
- Architecture-specific settings
- Memory management during the startup process
Physical memory management
- The structure of the buddy system
- Avoid fragmentation
- Initialize the memory domain and node data structure
- Allocator API
- Allocation page
- Release page
- Allocation of non-contiguous pages in the kernel
- Kernel mapping
slab distributor
- Alternative distributor
- Memory management in the kernel
- Principle of slab distribution
- achieve
- General cache
Processing: device cache and TLB control
Process virtual memory
Process virtual address space
- The layout of the process address space
- Build the layout
The principle data structure of memory mapping
- Tree and linked list
- Representation of virtual memory area
- First search tree
Operations on the area
- Associate the virtual address to the city
- Regional consolidation
- Insert area
- Create area
Memory map
- Create mapping
- Delete mapping
- Non-linear mapping
Reverse mapping
- data structure
- Establish reverse mapping
- Use reverse mapping
Correction of abnormal page fault in user space
- On-demand allocation/paging
- Anonymous page
- Copy-on-write
- Obtain a non-linear mapping
Kernel page fault exception
Copy data between kernel and user space
Lock and inter-process communication
Control mechanism
- Race condition
- Critical section
Kernel lock mechanism
- Atomic operations on integers
- Spin lock
- signal
- RCU mechanism
- Memory and optimization barriers
- Reader/writer lock
- Big kernel lock
- Mutex
- Approximate per-CPU counter
- Lock competition and fine-grained locks
System V inter-process communication
- System V mechanism
- signal
- message queue
- Shared memory
Other IPC mechanisms
- signal
- Pipes and sockets
Device driver
I/0 architecture
Access device
- Device file
- Character devices, block devices, and other devices
- Use ioct for device addressing
- Representation of master and slave device numbers
- registered
Associated with the file system
- Device file member in inode
- Standard file operations
- Standard operation for character devices
- Standard operation for block devices
Character device operation
- Represents a character device
- Open device file
- Read and write operations
Block device operation
- Representation of block devices
- data structure
- Add disks and partitions to the system
- Open block device file
- Request structure
- BIO
- Submit request
- I/O scheduling
- Implementation of ioct
Resource allocation
- Resource management.
- 1/O memory
- 1/O port
Bus system
- Universal Driver Model
- PCI bus
- USB
Module
Use modules
- Add and remove
- Dependency
- Query module information
- Auto load
Insert and delete modules
- Representation of the module
- Dependencies and references
- Binary structure of the module
- Insert module
- Remove module
Automation and hot swap
- Automatic loading by kmod
- Hot swap
version control
- Checksum method
- Version control function
Virtual file system
File system type
Common file model
- inode
- link
- Programming interface
- Use files as a universal interface
The structure of VFS
- Structure overview
- inode
- Process-specific information
- File operations
- Directory item cache
Handling VFS objects
- File system operations
- File operations
Standard function
- General read routine
- Failure mechanism
- Permission check
System call
Basics of System Programming
- Tracking system calls
- Supported standards
- Restart system call
Kernel activity
Interrupt
- Type of interrupt
- Hardware IRQ
- Handle interruption
- data structure
- Interrupt current processing
- Initialize and assign IRQ
- Handling IRQ
Soft interrupt
- Enable soft interrupt processing
- Soft interrupt daemon
tasklet
- Create tasklet
- Register tasklet
- Execute tasklet
Waiting queue and completion volume
- Waiting queue
- Amount completed:
- Work queue
Implementation of system calls
- The structure of the system call
- Access user space
- Tracking system weekly
Ext file system family
Ext2 file system
- Buried structure
- data structure
- Create a file system
- File system operations
Ext3 file system
- data structure.
Ext4 file system
- data structure
- Encrypted part
- Extended part
File system without persistent storage
proc file system
- /pro content
- data structure
- initialization
- Mount the proc file system
- Manage /proc data items
- Process-related information
- System control mechanism
Simple file system
- Sequence files.
- Write file system with libfs
- Debug file system
- Pseudo file system
sysfs
- data structure
- Mount the file system
- File and directory operations
- Add content to sysfs
Extended attributes and access control list
Extended attributes
- Interface to the virtual file system
- Implementation in Ext4
- Implementation in Ext3
- Implementation in Ext2
Access control list
- Universal implementation
- Implementation in Ext4
- Implementation in Ext3
- Implementation in Ext2
The internet
ISO/OSI and TCP/IP reference model
Communicate via socket
- Create socket
- Use socket
- Datagram socket
Layered Model of Network Implementation
Network namespace
Socket buffer
- Use socket buffers to manage data
- Manage socket buffer data
Network access layer
- Network device representation
- Receive packet
- Send packet
Network layer
- IPv4
- IPv6
- Receive packet
- Delivery to the local transport layer
- Packet forwarding
- Send packet
- netfilter
Transport layer
- UDP
- TCP
Application layer
- socket data structure
- Sockets and files
- socketcall system call
- Create socket
- Accept data
- send data
Network communication inside the kernel
- Communication function
- netlink mechanism
System call
Basics of System Programming
- Tracking system calls
- Supported standards
- Restart system call
Available system calls
Implementation of system calls
- The structure of the system call
- Access user space
- Tracking system calls
Time management
Overview
- Timer type
- Configuration options
Realization of low-resolution timer
- Timer activation and process statistics
- Handle jiffies
- data structure
- Dynamic timer
Universal Time Subsystem
- Overview
- Configuration options
- Time representation
- Objects used for time management
High resolution timer
- data structure
- Set timer
- achieve
- Cycle clock simulation
- Switch to high resolution timer
Dynamic clock
- data structure
- Dynamic clock in low resolution system
- Dynamic clock in high resolution system
- Stop and start the cycle clock
Broadcast mode
Implementation of timer-related system calls
- Time base
- alarm and setitimer system calls
- Get the current time
Manage process time
Page cache and block cache
The structure of the page cache
- Manage and find cached pages
- Write back modified data
The structure of the block cache
address space
- data structure
- Page tree
- Address space operations
Implementation of page caching
- Allocation page
- Find page
- Wait on the page
- Operation on the whole page
- Page cache read ahead
Implementation of block cache
- data structure
- operating
- Interaction between page cache and block cache
- Independent buffer
data synchronization
pdflush mechanism
Start a new thread
Thread initialization
Perform actual work
Periodic brush out
Related data structure
- Page status
- Write-back control
- Adjustable parameters
Central control
Super block synchronization
inode synchronization
- Traversing the super block
- Examine the super block inode
- Write back a single inode
congestion
- data structure
- Threshold
- Setting and clearing of congestion status
- Waiting on the congested queue.
Forced write-back
Lap mode
System call for synchronization control
Fully synchronized
- inode synchronization
- Synchronization of a single file
- Synchronization of memory mapping
Page recycling and page swapping
Overview
- Page can be swapped out
- Page thrashing
- Page swap algorithm
Page Reclamation and Page Swapping in Linux Kernel
- Organization of the exchange zone
- Check memory usage
- Select the page to be swapped out
- Handling page faults
- Reduce the kernel cache
Management exchange area
- data structure
- Create swap area
- Activate the swap area
Swap buffer
- Logo page out
- The structure of the swap buffer
- Add a new page.
- Search one page
Data write-back
Page recycling
- Overview
- data structure
- Determine the activity level of the page
- Shrink the memory domain
- Isolate LRU pages and collect them collectively
- Shrink the active page list
- Recycle inactive pages
Exchange token
Handling exchange page fault exception
- Change in page
- Read data
- Swap read-ahead
Initiate memory reclamation
- kswap d performs periodic memory reclamation
- Swap out pages in severe memory shortages
Shrink other caches
- data structure
- Register and delete shrinkers
- Shrink the cache
audit
Audit rules
achieve
- data structure
- initialization
- Processing request
- Log event
- System call audit
Recommended books
"Linux Kernel Design and Implementation"
"In-depth understanding of the Linux kernel"
"In-depth Linux kernel architecture"
"Linux kernel complete analysis"
"Linux kernel source code scenario analysis"
If you are self-study, it will be more difficult. I recommend a free course for a big guy. This is different from what I have seen before, which only talks about theory. Friends who are studying can experience it.
https://ke.qq.com/course/417774?flowToken=1031343
In addition, the Linux and C/C++ technology exchange group: [960994558] I have compiled some learning books, interview questions from major companies, and popular technology teaching video materials that I think are better (including C/C++, Linux, Nginx, ZeroMQ, MySQL, Redis, fastdfs, MongoDB, ZK, streaming media, CDN, P2P, K8S, Docker, TCP/IP, coroutine, DPDK, etc.), you can add it yourself if you need it! ~