They take care of initialization and cleanup. The link step for an application gives the program access to library functions, such as those defined in libc . Note that modules do NOT have access to libc functions, only those exported by the kernel. Remember, a module is added to a really big application, the kernel. Declare most symbols as static and use a well-defined prefix for global symbols.
Applications run in user space while modules run in kernel space .
In user mode, the processor inhibits direct access to hardware and unauthorized access to memory. Applications switch to kernel mode through a limited number of gates, implemented as system calls and hardware interrupts . Hardware interrupts are asynchronous and are not associated with a particular process. Drivers typically provide code for both of these tasks. Although it is true that context switches cannot occur due to timeouts while kernel code is executing, unanticipated suspensions can occur, e.g., a page fault caused by reference to user space.