Skip to content
Tech News
← Back to articles

Intrusive Linked Lists

read original more articles
Why This Matters

Intrusive linked lists are a memory-efficient data structure where list links are embedded within the objects themselves, commonly used in Linux kernel process management. Understanding this structure helps developers optimize performance and memory usage in system-level programming.

Key Takeaways

This post will teach you what intrusive linked lists are and how they are used to manage processes in Linux.

What are intrusive linked lists?

Intrusive linked lists are a variation of linked lists where the links are embedded in the structure that’s being linked.

In a typical linked list implementation, a list node contains a data pointer to the linked data and a next pointer to the next node in the list.

Figure 1: A linked list

In an intrusive linked list implementation, the list node contains next pointer to the next list node, but no data pointer because the list is embedded in the linked object itself.

Figure 2: An intrusive linked list

A list structure for an intrusive singly linked list contains a single next pointer to another list node:

typedef struct list { struct list * next; } list;

The list structure is then embedded in the structure that will be linked. For example, you might have a item structure with a val member:

... continue reading