Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

device drivers vs driver stack

What is the difference between a driver (device drivers) and a driver stack? I keep hearing people talking about "driver stacks" but I have never really heard of this before... Thanks!

like image 933
Russel Avatar asked Jul 08 '10 02:07

Russel


2 Answers

A driver is...well...a driver.

A driver stack is when drivers plug into each other, each one adding a bit to the chain. Like, say, OpenGL or DirectX drivers that use your video card's driver, which in turn uses PCI Express or AGP or whatever drivers to set up resources and push pixels and such. Or your USB devices' drivers that of course have to use the USB drivers in order to communicate.

It's technically possible to have a "stack" consisting of one driver, but when people say "stack", they almost always mean more than one. Or they're just trying to sound like they know what they're talking about.

like image 150
cHao Avatar answered Sep 22 '22 10:09

cHao


The Driver stack refers to a theoretical vertical chain of drivers each of them performing a specific job on the line up from the HW to the user code or down from user code to the HW.

In windows OS, messages (with data) to the HW are modelled in IRPs (IO request packet) that go through this line from one side to the other and on its way each driver handles them and does its operation.

An example that will make it easy for understanding is a main driver in Windows called "Function Driver" and for some reason you want to put a "Filter Driver" above it to do some minor work like modifying some data from user mode before it reaches your main driver. You may need this if you already have a working driver that you do not want or can't modify.

See this assay on Windows drivers stack: https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/driver-stacks

like image 34
Sharon Katz Avatar answered Sep 21 '22 10:09

Sharon Katz