Concepts and usage of Modules

Source: Internet
Author: User
Concepts and usage of Modules-general Linux technology-Linux programming and kernel information. The following is a detailed description. 1. What is modules?

The literal meaning of modules is the module, which refers to the kernel modules. Simply put, a module provides a function, such as isofs, minix, nfs, and lp. Traditionally, there are two ways to solve modularization: the designer can separate various functions into separate processing called threads, or re-compile the kernel by including/excluding some functions. If functions are separated into threads, the kernel is called "micro-kernel". This solution increases the communication overhead of Inter-thread coordination. As the name implies, the advantage of this solution lies in the size of the kernel.

Linux Solutions include kernel modules that can be loaded and detached at any time as needed. In this way, the kernel size and traffic can be minimized. The module is independent from the kernel and does not need to be pre-bound to the kernel codes. There are three advantages: First, you do not have to re-compile the kernel in the future, which saves a lot of time; second, if you need to install a new modules, you do not have to re-compile the kernel, you only need to insert the corresponding modules (using the insmode command). Third, to reduce the kernel's occupation of system resources, the kernel can focus on the most basic tasks, some extended functions are implemented by modules.

The module can also be used to try new kernel code without the need to create and reactivate the kernel every time. However, the problem is that using the kernel module usually slightly increases performance and memory consumption. A loadable module will certainly generate more code. This code and additional data structure will occupy more memory. In addition, indirect access to kernel resources also reduces the module efficiency slightly.

The idea of modularization has been widely accepted, mainly because it can expand the functions of the system and allow users to flexibly configure the system. Apache also adopts this function extension method. In this article, we mainly discuss how to install and uninstall the kernel module. For details about how to install the Apache module, refer to the Apapce documentation.

Ii. How to load modules?

There are two ways to load the kernel module. First, use the insmod command to manually insert it to the kernel. Another more intelligent method is to load this module as needed: demand loading ). When the kernel discovers that a module is required, for example, when you install a file system that is not in the kernel, the kernel will request the kernel daemon (kerneld) to try to load the appropriate module. Speaking of this, we can't help but mention the kernel daemon kerneld. It is very intelligent and can automatically Insert the required modules into the kernel and Remove unused modules from the kernel. Kerneld consists of two independent parts: one part is used in the linux kernel and is responsible for sending requests to daemon. The other part is used in the user data area of the system and is responsible for transferring the modules specified by the kernel request. If this kerneld is missing, it can only be loaded manually using the insmode or modeprobe command.

3. Introduction to modules commands

Commands related to modules include:
QUOTE:
Related Article

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.