In Linux environments, device drivers can be deployed as part of the kernel, but they can also be loaded separately as modules. The kernel modules in Linux have loaded drivers, the advantage of these drivers is that they will be in memory only during the time the device is needed, otherwise, it will not be loaded, thus freeing the memory during the inactivity.
Linux is an open-source operating system, distributed free of charge, so one of its many advantages is that the internal operating mechanism is visible to the general public. Through this democratization of Linux operating systems, a large number of programmers, possessing the necessary knowledge, have been able to examine, understand and modify the system code. Thus, driver updates will generally be faster than with closed-source systems such as Windows. While Windows drivers will be rigorous and lengthy, Linux drivers will be available to the user more frequently and faster, due to the large set of individual programmers working to achieve them.
The disadvantage of this accessibility, however, is that the drivers made by such non-affiliated programmers will be able to present bugs, gaps in operation, and performance in the main, but compatibility and stability will be compromised. In the Linux kernel, besides software-hardware interfacing, device drivers also act as real black boxes.
They facilitate the transmission of Linux commands, or Linux programs, to the component, but at the same time mask the details of how the device works with the user. A user’s activity will be managed through a standard set of calls, independent of a particular driver. The driver will handle these calls to specific device operations, linking the kernel to the device itself. For devices that do not have drivers installed or whose driver is not detected correctly, you can use inexpensive kernel modules.
A kernel module is a piece of code that can be loaded and unloaded from the kernel when it is needed or not, without the need to restart the system and rebuild the kernel, thus extending the Linux functionality. They are created separately and then inserted into the system by installing in the /lib/modules/directory. This modularity makes Linux drivers easy to write, so the number of drivers available will be higher than that of Windows drivers. Although Linux supports thousands of hardware devices, the kernel is small because only a small number of drivers are loaded into memory, and other modules will be loaded if a particular device is needed.
You can view the modules currently running within the operating system via the lsmod command, and information about a module is via the modinfo command. Module loading and unloading are done by modprobe and insmod commands, respectively rmmod. Device drivers are viewed within Linux as independent processes, each with its own internal address space, which can be expanded to include multiple devices simultaneously. There are Linux basic libraries, dynamic link libraries that include floppy disk drives, RAM and hard drives, and other devices. If two devices try to use the same type of driver, it will be loaded again from the DLL and will run independently of the first instance.