RSS 2.0

Personal Info:

Joe Send mail to the author(s) leads the architecture of an experimental OS's developer platform, where he is also chief architect of its programming language. His current mission is to enable writing large-scale software that is reliable, secure, and scalable by-construction. Before this, Joe founded the Parallel Extensions to .NET project. He has been granted 19 patents, with 49 pending. When not working, Joe enjoys travelling with his wife, writing books, writing music, studying music theory & mathematics, and doing anything involving food & wine.

My books

My music

Disclaimer:
The content of this site are my own personal opinions and do not represent my employer's view in anyway.

© 2012, Joe Duffy

 
 Sunday, April 03, 2005

I love Haskell. So much that I'm now writing a compiler for it. In my "spare" time, of course. (Which means just a couple hours a week since my book is priority #1 at the moment.) :)

I mentioned it briefly before, but I'm basing the generated code's execution model on the GHC (i.e. STG) machine. I've decided to forego all of the front end gunk and instead just hook into the Core output from GHC. This will work so long as I leave the underlying language unchanged; I might revisit that decision later on, but for now it seems like the right approach. This paper is a great help.

Aside from my self professed admiration of the language, I have a few other motivations, too.

The latest release (6.4) of GHC contains STM (software transactional memory) abstractions. I'm really psyched about the recent work in this space. Because Haskell is non-strict and I/O (side-effecting) operations are by their very nature easy to notice, it removes a bunch of roadblocks. But, I intend to look (and I know a whole set of other folks are already looking) into how imperative and strict languages could take advantage of this, too. The primary concern is that, if a transaction fails--more common that you might think due to STM's optimistic nature--a whole lot of stuff ends up re-executed as part of a retry. For side-effecting operations, this is dangerous. However, if one could detect statically what Framework operations would result in I/O, you could get closer to implementing safe retries.

Drilling one level deeper, STM support baked into the VM would be bliss. Not a small project no doubt, but interesting nonetheless. I've done some hacking on Rotor's JIT to see what I can come up with, but it seems difficult to do in an efficient manner. STM requires that certain activities write to a transaction log instead of directly to memory. But it's difficult to know statically whether you're inside a transaction and thus which behavior is appropriate--e.g. with locked { Foo(); }, Foo() will execute inside a transaction sometimes but other times not. You can detect this at runtime and do the right thing, but this would result in a pretty poor global performance hit.

Further, because of the non-strict nature of Haskell, implicit parallelism becomes more of a reality. Again, something that's possible in strict languages, but more difficult to do correctly. With more intent-based annotations throughout the Framework, I think we could eventually get there. I absolutely love the existing par and seq explicit abstractions that the Parallel GHC library provides. They compose beautifully. I think C# could learn a thing or two.

So, I'm curious what folks think. Anybody out there using Haskell? Wish you had a reliable implementation on the CLR? What about STM, implicit parallelism, and concurrency on the CLR? Useful? Interesting at least?

(BTW, I'm aware of the Mondrian effort. We share some similar goals, but mostly they are sufficiently different to justify both works existing. My focus is more on the concurrency side of things.)

4/3/2005 11:36:50 PM (Pacific Daylight Time, UTC-07:00)  #   
Tracked by:
"Hacking away at STM on Rotor" (`(joe (@ (version "2.0")) ,(mk-blog))) [Trackback]

 

Recent Entries:

Search:

Browse by Date:
<April 2005>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

Browse by Category:

Notables: