Qwiki

Loadable Kernel Module

A Loadable Kernel Module (LKM) is a feature of modern operating system kernels that allows the kernel to be extended with additional functionality without the need to reboot the system. This modular approach is pivotal in Linux and other Unix-like operating systems, enabling a flexible and efficient way to manage system resources and hardware interaction.

Loadable Kernel Modules are essentially object code files that can be loaded and unloaded into the kernel at runtime. This capability allows system administrators and users the flexibility to add new features or support for new hardware dynamically. The mechanism is an integral part of systems like the Linux kernel, FreeBSD and NetBSD among others.

The Linux Kernel is both monolithic and modular, which means it can operate as a single large process or have parts of its functionality isolated into separate modules. LKMs play a significant role by allowing functions to be added to the kernel independently. This is accomplished through tools such as modprobe, which handles the loading and unloading of modules.

Dynamic Kernel Module Support

Dynamic Kernel Module Support (DKMS) is a system that facilitates the management of kernel modules whose sources are located outside the kernel source tree. DKMS is often used in conjunction with LKM to ensure that modules are compatible with various versions of the kernel, thus enhancing the portability and maintainability of the system.

Applications

Loadable Kernel Modules are utilized in various contexts:

  • Device Drivers: Many hardware devices require drivers that are loaded as kernel modules. This is particularly common in devices that are not present during the initial system boot, such as USB devices.

  • File Systems: New file systems can be supported by loading their corresponding modules. This is crucial for interoperable environments requiring access to different file systems like NTFS or ZFS.

  • Networking: Networking functionalities, like the Netfilter framework in the Linux kernel, often use modules to enable features such as packet filtering and network address translation.

  • Virtualization: Kernel-based Virtual Machine (KVM) is another example where virtualization support is provided through loadable modules, allowing the system to serve as a hypervisor.

Related Topics

These modular capabilities underscore the versatility and adaptability of modern operating system kernels, allowing them to efficiently manage emerging technologies and evolving user needs.