Article Title: differences between Linux system applications and Kernel Modules. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. the application executes a single task from start to end. The module only registers itself in advance to serve a future request. The init_module function (module entry) the task is to prepare for calling the module functions in advance. The cleanup_module function (the second entry of the module) is called when the module is detached.
2. an application can call undefined functions, because external references can be parsed during the connection process to use the appropriate function library. A module is only connected to the kernel, therefore, it can only call functions with kernel Export (such as printk) without any accessible libraries.
3. segment errors during application development are harmless and can always be tracked by the debugger to locate issues in the source code. An error in the kernel module is fatal even if it is not correct to the entire system, or at least cause a fatal error to the current process.
4. Applications run in user space. The processor prohibits direct access to hardware and unauthorized access to memory. The kernel module runs in the kernel space and can perform all operations.
5. Generally, applications do not have to worry about changing their runtime environment due to other situations. For kernel module programming, the handling of concurrency issues must be considered.