0

A friend of mine asked me this question in the class and I could not answer it. He asked:

Since we know kernel controls the physical hardware via device drivers. What if all this functionality is kept inside the device controller itself rather than kernel managing them. What would be the consequences of such scenario? Good or Bad?

I searched online for this question but could not get information about this scenario. May be I'm not googling in the right keyword.

You insight into this will help me getting clearing my concepts.

Please answer.

Thanks.

Hammad
  • 177
  • 1
  • 3
  • 10

1 Answers1

0

Your question seems to propose the elimination of the "device driver" by "keeping" "control (of) the physical hardware ... inside the device controller". The premise for this seems to be:

kernel controls the physical hardware via device drivers.

That description of a device driver is something similar to what I've seem for end-user comprehension rather than from a developer's perspective. The end-user is aware of the device, and it is the device driver that takes that abstraction and can control that device down to the specific control bits of each device port.

But a device driver is responsible for mundane housekeeping tasks such as:

  • maintaining device status and availability;
  • configuring the device for operation;
  • managing data flow, setting-up/tearing-down data transfers, copying data between user space and kernel space;
  • handling interrupts and exceptions.

These tasks are integral to a device driver. These tasks cannot be transferred out of the purview of the kernel driver to a peripheral device.

Sometimes the device driver can only try to manage the device, rather than fully control it, for example, a NIC driver during a packet flood.

There is simply no possibility that you can eliminate a device driver no matter how much of "all this functionality is kept inside the device controller itself". And there would still be control directives/commands issued from the device driver to the peripheral.

The hardware device in question should be a computer peripheral device, not an autonomous robot device. The device should be designed to operate with a computer. Whatever interface there is between processor and device should be suitable for the task. If the peripheral is made more "intelligent", then perhaps the CPU can be unburdened and a high-level command interface can replace low-level sub-operation directives. But only "some" functionality can be transferred to the peripheral, not "all".

sawdust
  • 16,103
  • 3
  • 40
  • 50
  • All true, just want to add a clarification. In extreme cases it's possible to move almost all functionality to the device (i.e. to firmware), leaving only a passthru driver that functions as a proxy between the OS and the device. – SomeWittyUsername Nov 07 '12 at 19:17
  • @icepack - sort of, but if the device doesn't have a very standardized purpose, client software will end up having to know details of how to use the device, at which point you arguably have a host-side device driver again, just one implemented in the application rather than the OS/kernel. – Chris Stratton Nov 08 '12 at 17:49
  • Not necessary. Drivers have rather limited set of APIs with the OS. As far as the OS is concerned the implementation can be anywhere, either in the driver itself or down below in the firmware, as long as the requests are fulfilled. Moreover, applications won't be able to perform the tasks that usually belong to driver/firmware, simply because they don't have the access to the required resources. – SomeWittyUsername Nov 08 '12 at 20:49
  • @icepack - for a passthrough driver to work, it must connect two subsystems which share sufficient understanding to be able to communicate. For an extremely generic interface, that might be the firmware and the OS. But in other cases, it is the firmware and the application software - consider for example libusb, which basically put the device-specific part of the host-side code in the application, by being a driver that simply proxies/wraps the operating system support functions to make them accessible to and easier to use by applications. – Chris Stratton Nov 10 '12 at 03:17
  • Yes, this is one of the few cases where the application access level is enough but in most situations it won't be the case – SomeWittyUsername Nov 10 '12 at 06:01