Tuesday, October 25, 2005

House -- The Haskell OS

I'm a systems guy. In my professional life, as per this blog's title, I necessarily am writing software at a pretty grubby level of abstraction, typically in C and assembly. So, it often surprises folks that I carry a torch for functional languages in general, and Haskell in particular. It all dates back to my wasted youth at OGI. I was porting Linux to the i960 on behalf of an active networking project that, to the best of my knowledge, never really got off the ground. My cube was adjacent to the warrens of OGI's fanatical Haskell lovers. While I was too preoccupied with my work at the time, the sheer wild-eyed passion these folks felt about Haskell made a strong impression on me.

Then, they got one of my friends. Michael did a substantial programming project in Haskell, and came away convinced that this was how software ought to be. While I've never created real software in Haskell, I've taken great pleasure in, e.g., fooling around with Haskore. I've often idly wondered whether it made sense to contemplate doing systems programming in Haskell; well, those crazy folks across the way at OGI have beaten me to it. The House poster at SOSP was one of the more popular exhibits, and I for one spent a good twenty minutes or so sputtering half-formed questions such as, "so, like, you can use like, eval in your network drivers!", after which my head exploded.

Update: well, I got the boot floppy image going inside a VM, albeit briefly before the guest hung. So there are some bugs to work out; big freaking deal. Seeing page-table manipulation code as gorgeous as this looks like a cold beer on a hot summer's day to me; and having the OS at large interact with it through this interface makes my heart sing. These guys badly need a e1000 or vmnet ethernet driver; any takers?


Blogger Kim-Ee Yeoh said...

I've found that the more one knows about the Haskell compiler, the better one gets at coding Haskell, especially if it's systems work. (In contrast, one can't really say the same about the C compiler. One doesn't get better at C by knowing GCC inside out.)

1:40 PM  
Blogger Keith Adams said...

This is one of the things that does that does tend to keep professional programmers sitting on the sidelines of functional programming. You pick up some web tutorial for ocaml or scheme or whatever, and it's full of all these elegant little two-liners that do incredible stuff, and express it clearly and concisely, and say to yourself, "Man! I want to write code like that!"

...And then you find out that you have to contort that two-liner into a five-liner or whatever to make it tail-recursive and avoid a cons, and the whole realization that, yes, you still have to understand the abstraction stack all the way down to the hardware, takes some of the shine off the enterprise. But, a) kernel folks should be more than used to thinking along those lines, and b) I'm tickled to see that the code for House is both gorgeous and, apparently, fast "enough" for some definition of "enough."

The nitty-grittiest, cycle-count-intensive parts of any OS (those couple hundred instructions wrapping kernel entry/exit, the sharp end of the context-switch stick, etc.) are all going to be part of the "runtime" (i.e., written in C and assembly to run on bare metal) anyway. But, for those large and always getting larger parts of the OS that do lots of pure computation, like resource management policies, caching, block strategies, filesystems, the more elaborate security arrangements that are getting popular, etc., Haskell would allow much greater productivity and safety. The more I think about this project the more exciting I find it.

4:52 AM  
Blogger Bill Mill said...

The "this" and "this interface" links are broken for me.

2:20 PM  
Blogger Keith Adams said...

House itself seems to have gone the way of all research projects. Let's see if archive.org can help us out:


this interface

3:07 PM  

Post a Comment

<< Home