Linux – Does udev load kernel modules

kernel-moduleslinux-kerneludev

In the Wikipedia article of udev:

Device drivers are part of the Linux kernel, and device discovery, state changes, etc. are handled by the Linux kernel. But after loading the driver into memory, the only action the kernel takes is to send out an event to a userspace daemon udevd.

It seems that the kernel is responsible for inserting corresponding kernel modules when detecting a device, and udev receives events after the kernel modules are inserted.

However, in the ArchWiki page of udev:

udev loads kernel modules by utilizing coding parallelism to provide a potential performance advantage versus loading these modules serially.

I am confused. Who is responsible for inserting the kernel module, kernel or udev?

Best Answer

Some of the device drivers are compiled together with the kernel, which means that they are already loaded when the kernel starts. And some others are in the initrd, and are loaded together with the kernel at boot.

After the kernel has booted, it sends uevents to the userspace. udev sees them, and loads the appropriate modules, according to the rules contained in the modules.alias file.

More information on udev (Archive, page moved here)

Related Question