Fog Creek Software
g
Discussion Board




Abstraction layers: just say no.

I guess not a lot of people here have to deal with device driver programming but  I guess abstraction layers can also apply in other cases.

I was reading that article on embedded.com : http://www.embedded.com/showArticle.jhtml?articleID=18900788

... and now I must scream ... NOoooooo !!!!

There are some things you just cant abstract. Like interrupt handling, locking or task handling. There are just too many different semantics form one hardware/OS combination to the other.  Trying to adapt an abstraction layer to an OS that has a different semantic can be difficult and lead to nasty bugs. (Read this articles that just show that in the linux kernel: http://www.kerneltraffic.org/kernel-traffic/kt20040402_256.html#12)

Sink Different
Tuesday, April 20, 2004

Check out IOKit in Darwin.  Apple has a very, very good set of abstraction layers in the Mac OS X kernel.  You can literally subclass a base class for your particular type of device, fill in a couple methods, and have your basic functionality up and running in hours or days for common devices.

And their abstractions are complete and have depth, so you can go further than the above in order to tune your driver for performance etc.

Chris Hanson
Wednesday, April 21, 2004

Do you think that's something that's only possible because the Mac supports a small subset of the hardware that the PC platform does? I'm not being funny, I genuinely don't know.

John Topley (www.johntopley.com)
Wednesday, April 21, 2004

You can't abstract locking?  I dunno, aren't relational database transactions an abstraction over locking?

name withheld out of cowardice
Wednesday, April 21, 2004

IOKit dates back to NEXTSTEP, which did run on Intel hardware.  It never supported the range of hardware that Windows did, but I think that was more a matter of limited market and resources than technical feasibility.

AMS
Wednesday, April 21, 2004

> Trying to adapt an abstraction layer to an OS that has a different semantic can be difficult and lead to nasty bugs.

The ACE seems pretty successful: http://www.cs.wustl.edu/~schmidt/ACE.html

Christopher Wells
Wednesday, April 21, 2004

*  Recent Topics

*  Fog Creek Home