Algorithms and data structures are complex, but it is necessary for Linux kernel developers to focus on the algorithms and data structures used in the Linux kernel.
In a foreign question and answer platform Stackexchange.com's theoretical computer science sub-board has a discussion of the actual use of algorithms and data structures, Vijay D to make a detailed answer, which is part of basic Data Structures and algorithms in the Linux kernel a summary of the algorithms and data structures used in the Linux kernel. See here for details.
At the same time there is a Chinese translation can be found in https://linux.cn/article-2317-1.html.
The following is a Vijay D answer as a blueprint for learning summary.
Test method Preparation
Because of the need for code test validation in the kernel, the full compilation of the installation kernel is time consuming and laborious. Ready to validate using module form.
Makefile
Obj-m:=linked-list.o kernelbuild:=/lib/modules/$ (shell uname-r)/build Default Make-c ${kernelbuild} m=$ (shell pwd) modules Clean RM-RF *.o *.cmd *.ko *.mod.c. tmp_versions |
Linked-list.c
#include <linux/module.h> #include <linux/init.h> #include <linux/list.h> int linked_list_init (void) { PRINTK ("%s\n", __func__); return 0; } void Linked_list_exit (void) { PRINTK ("%s\n", __func__); } Module_init (Linked_list_init); Module_exit (Linked_list_exit); Module_author ("Arnold Lu"); Module_license ("GPL"); Module_description ("Linked list Test"); |
Install module
sudo insmod Linked-list.ko |
Find the installation situation
Execute log
<4>[621267.946711] Linked_list_init <4>[621397.154534] Linked_list_exit |
Delete Module
Linked list, doubly linked list, no chain table
Algorithms and data structures in the Linux kernel