Friday, June 22, 2007

1. What is Device Driver?

In short, device driver is a software program which talks to the computer and controls the device. If you really want a bookish definition, you better check this site CLICK HERE. I'd rather post a simple definition which makes sense.

NOTE: From next time, whenever you see me mentioning 'drivers' or 'dd', consider it as device drivers.

Before getting into device drivers, I should mention that OS has a vital role here. One of the most important features of OS is resource management, which includes I/O operation with devices. Devices are connected with I/O ports. Interfacing does the physical connection, OS can send the requests to the device. Here comes the role of drivers. Driver is the OS of the device itself, it can talk to the computers OS and thus computers OS recognizes the device. Later drivers can control the device, which is essentially the I/O instructions by the computers OS.


Lets narrow down a bit more. OS is a huge entity to consider. By OS here we mean the kernel of an OS. Kernel is the core of the OS. Drivers has to either be inside the kernel to recognize devices or has to be somewhere near the kernel so that it can easily communicate with the kernel.

Check out the diagram*.



So here comes the kernel. I just mentioned that the driver can be inside the kernel, that is known as monolithic kernel, which actually has to come with the kernel package. There is another way of implementing drivers, that is by kernel modules.

My concern is now with kernel modules only.

Kernel modules are pieces of codes. Which can be loaded and unloaded upon demand. Letting us not worry about rebuilding the kernel again and again.

On my next post, I'll show the structure of the kernel module.


*Image courtesy: http://www.linuxjournal.com/article/2476

No comments: