Algorithms and data structures in the Linux kernel

Source: Internet
Author: User

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

Lsmod | grep linked-list

Execute log

<4>[621267.946711] Linked_list_init
<4>[621397.154534] Linked_list_exit

Delete Module

sudo rmmod linked-list

Linked list, doubly linked list, no chain table

Algorithms and data structures in the Linux kernel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.