Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux driver modules's operating mechanism ???

Status
Not open for further replies.

HaoDr

IS-IT--Management
Sep 26, 2001
32
VN
Hi all,

I have just read "MAN" commands of modprobe, modules.conf, depprobe, ... ( and relevant ones ), but I still have a lot of vague ideas of this issue, as well as there are many quesitons arising in my mind but I cannot answer myself. That's as follows:

1) I don't know how modules's working mechanism is at system startup process.

2) In my case, my box has CDROM, NIC and sound card, IDE hard drive, I wonder these modules are loaded onto memory, and loading of a module onto memory to get system run faster, is it right ? what command can I use to check loaded modules on memory ?

3) I look my file modules.conf up and I wonder why it has statements related to NIC and sound card only ? what about ohter modules ?

4) and ... the last question, when I setup ipcahins, for example, adding statement " modprobe ipchains " into /etc/rc.d/init.d/rc.local file is the same as adding this code into modules.conf file ???

Thanks so much for your help.

Hao Dr
 
Hi,

There has been a debate ever since the origins of linux as to whether kernels should be monolithic or modular. In other words, should you have a large kernel with all the operating system code built in or have a 'lean and mean' micro-kernel that does just the basics and provided loadable 'add-on' operating system modules for other requirements. The advantage of the modular approach, apart from flexibility, is that you only load what you need for your hardware, etc., setup. The downside is that the module handling functions have a small overhead.

When you build a custom kernel many of the options let you choose whether you want to build the code into the main kernel or compile a loadable module. For optimisation, I personaly tend to compile in code that is 'always' needed. However, even that is debateable because not everything is actually in use all the time and, if code is sitting idle in memory then thats not a good idea. Most modules can be 'autocleaned', i.e. removed from memory automatically if not referenced for a period of time.

1) Basically, kmod loads modules 'on demand' as the associated resource is referenced. For example if there is no driver loaded for eth0 reference is made in /etc/modules.conf for the driver associated with the alias eth0 and kmod would load that on the fly.

2) No - modules are not loaded into memory to make things faster. They are loaded because the kernel needs them to extend it's functionality. To list currently loaded modules do :

/sbin/lsmod

3) Modules may be explicity loaded by programs or by init scripts, etc.

4) No - /etc/modules.conf is a configuration file not a script file. It contains additional information regarding modules to the modules.dep file, including parameters to be passed (options directive).

If your're interested in the technical details see --> .

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top