!!!??? 2.3 Core modules vs. applications

Source: Internet
Author: User


Just now we know that the Kernel module program is different from the driver, so what is the difference between the kernel module program and the application?
1. Most small-scale and medium-scale applications perform a single task from beginning to end, but the module simply registers itself to serve a future request, and then its initialization function ends immediately. That is, the task of the module initialization function is to prepare for the subsequent invocation of the module function, while the module's exit function is called before the module is unloaded. This differs from the single task that the application executes from start to finish, and instead performs two tasks based on user actions.
This programming is a bit like event-driven programming, but not all applications are event-driven, and each kernel module is event-driven. In addition, there is a major difference between the event-driven application and the kernel module code: The application exits, regardless of the release of resources or other clear, but the module's exit function must carefully undo the initialization function to do everything, otherwise, before the bear restarts, something will remain in the system. (not related to uninstall residue under Windows): It can shorten the development cycle of the module and do not need to be restarted every time the test is done.
2. An application can invoke a function that it does not define itself because the connection process can parse an external reference to use the appropriate library of functions. such as the printf function. However, the module is only linked to the kernel, so it can only invoke those functions exported by the kernel, such as the PRINTK function.
Any kernel-related content is declared in the header file of the kernel source tree that we have installed and configured, where most of the related header files are saved in the Include/linux and include/asm directories, but the other subdirectories of the include contain header files that are related to the specific kernel subsystem.

3, kernel programming and application programming in various environments to handle errors in different ways; the segment error during application development is harmless, and you can always use the debugger to trace the problem in the source code, and a kernel error will kill the current process, even if it does not affect the entire system. We need specialized debugging techniques to track kernel errors.

4, the module runs in the kernel space, the application runs in the user space, this is the basic theory of the operating system.

How to use function calls and function pointers in modules to add new functionality to a running kernel.

To tell the truth, this picture does not feel what, perhaps I did not understand in place, hope later can understand thoroughly.





From for notes (Wiz)

!!!??? 2.3 Core modules vs. applications

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.