Prabhat Kumar Ravi

Wednesday, May 18, 2011

Device Drivers Interview Questions

1.What is Device driver?

A device driver is a code that performs device control operations specific to the device being addressed.It is software layer that lies between applications and the actual device.
A more formal definition would be Device drivers are distinct black boxes that make a particular piece of hardware respond to a well defined internal programming interface.
Device Driver lies between the Hardware & operating system.Through this layer only all the request/response between the OS & H/w are happening.

2.what kind of information the linux driver modules (.ko )files has ?

kernel 2.6 introduces a new file naming convention: kernel modules now have a .ko extension (in place of the old .o extension) which easily distinguishes them from conventional object files. The reason for this is that they contain an additional .modinfo section that where additional information about the module is kept. Linux program modpost can be used to convert .o files into .ko files.
3.what happens when we do insmod & rmmod in Linux Device Drivers ?

At time of insmod required o's brings in ram or updated the kernel with the perticular device driver. At the time of rmmod removes the o's by kmod it kills the process and refresh the kernel.
4.what are the different ways the Linux can swich from User Space to Kernel Space & vice-versa ?

There are 2 situations when Linux can switch from user Space
to Kernel Space:-

1) by doing System calls
2) When interrupt comes (to handle interrupt)

Linux can switch from kernel Space to User space:-
1) process in kernel mode is preempted.
2) After completion  of Interrupt handler / System call