LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Does a kernel module run in kernel or user space? (https://www.linuxquestions.org/questions/linux-general-1/does-a-kernel-module-run-in-kernel-or-user-space-840263/)

paliga 10-25-2010 02:27 AM

Does a kernel module run in kernel or user space?
 
Hi...

Im pretty new to this whole (micro)kernel architecture story.

Im wondering if a kernel module is running in kernel or in user space?

Is a driver running as kernel module slower than a driver build into kernel?
If so, are there some current articles, benchmarks?

Thanks in advance and with kind regards,
chris

neonsignal 10-25-2010 04:07 AM

Quote:

Im wondering if a kernel module is running in kernel or in user space?
A kernel module is not treated differently to other parts of the kernel, apart from being dynamically loadable. It runs in supervisor mode.

Quote:

Is a driver running as kernel module slower than a driver build into kernel?
Yes, there is a small penalty because of the extra level of indirection making calls between the module and other kernel services. The fraction would be different depending on the number of calls being made. For most drivers it would not be significant (ie, worth making a module built in).

Quote:

this whole (micro)kernel architecture
The Linux kernel is not a microkernel, because it does not have any real separation between the components of the kernel. The kernel of OS X is based on the Mach microkernel, but is something of a hybrid.

syg00 10-25-2010 04:09 AM

A kernel module is (effectively and literally) an extension to the kernel. It runs in kernel context.
Except registered interrupt handlers - they, of course, run in interrupt context.

syg00 10-25-2010 04:13 AM

Nope - all kernel memory is non-paged and directly addressable. Built in or module.

paliga 10-31-2010 07:22 AM

thanks a lot : )


All times are GMT -5. The time now is 01:12 AM.