device drivers vs driver stack
W开发者_如何学Gohat 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!
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.
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://learn.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/driver-stacks
精彩评论