Linux modules and how they work

In the /proc directory their is a file called modules which lists device drivers inserted in the Linux kernel.  How do these drivers work and what are their relationship with the device files in the /dev directory?

Phorious WhitmoreInformation TechnicianAsked:
Who is Participating?
Daniel HelgenbergerConnect With a Mentor Commented:
Basically, Unix/Linux is following the 'everything is a file' philosophy. Meaning, every device for instance is represented by a file, you can wipe/damage a Hard disk by copying something on its device file.

Kernel modules are like device drivers. If the kernel detects certain hardware, it will try to load the corresponding kernel module. This approach is called microlithic kernel (vs. the monolithic kernel, which would have all modules compiled in; they would always be loaded).
This is the reason why a linux installation will almost always work on different hardware if you move the root disk.
If for instance a kernel module for a raid controller is loaded, it will make the corresponding device nots ('mknod') for the disks in /dev.

Also, for documenting reasons, there is /proc - every device driver will create a file there where information about this diver and its devices is maintained. For instance, our raid controller would be represented there with a file stating the size of the disks and I/O - throughput. Some commands like iostat use the /proc filesystem.

While Linux cannot run without /dev, it can run without /proc perfectly. Proc is info for humans only.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.