E-Mail:
Get our new Windows 7 eBook (PDF) for $7 with 70+ Tips. Download Now!

Autoloading Modules

  • No Related Post

Autoloading Modules

As we’ve noted on several occasions, the Linux kernel has the ability to load and unload modules, or device drivers, as needed. While this seems to move away a bit from the monolithic kernel model, it does allow users to build a smaller chunk of kernel code.

These modules can be loaded either manually, using the modprobe command, or automatically. At this point in Linux development, loading these drivers automatically is, hands down, the most-used option. So, how do you tweak your system to dynamically load and unload modules as needed?

It’s time to introduce yet another Linux daemon. kerneld is the daemon in Linux that’s responsible for, among other things, automatically loading and unloading modules. If this feature is not activated in your current kernel, you’ll need to recompile and include “Loadable Module Support” from the options. This feature is the default in newer distributions, so if you’ve recently installed the latest and greatest, it’s a safe bet that kerneld is already performing this function.

You can check the current module status by using the lsmod command. You may find this command in the /usr/sbin directory or in /sbin. This command returns a list of all loaded modules [ls - as in listing directory contents, and mod for modules]. Modules that are loaded and unloaded automatically from kerneld will return an additional column - (autoclean). That’s your indication that kerneld is monitoring the module’s usage. If, after sixty seconds, an affected module isn’t needed, kerneld will automatically unload it. This wise use of system resources is one of the reasons that Linux is, in the end, one of the most efficient operating systems around.

If, for whatever reasons, you’ve built modules you’d rather not load automatically, you can load them as needed using the modprobe command:

    /sbin/modprobe [module name]

Note, however, that kerneld will not monitor these modules for use as it does with modules that are auto-loaded.

Auto-loading modules is a convenient way to allocate system resources as needed. And, isn’t that what computers are all about, making life easier by doing things for us?

What Do You Think?

 
35 queries / 0.360 seconds.