Quick musing...

Nov 07, 2006 15:44

We all know and love Lazy Evaluation[1]. Among other things, it allows us to do cool stuff like optimize away benchmarks. It occurred to me today though, that the problem with laziness in life in general is that sometimes you get hit with 12 deadlines at once and wish you'd previously been a bit more eager. So I wonder if anything yet exists which might be called "opportunistic evaluation"?

Such a thing could be thought of as a next logical step for giving lazy evaluation systems a kind of social conscience. A system running a single (potentially) lazy programme might be given a regular update of what resources are up for grabs. When the system's doing nothing else (particularly in a very parallel system if there are lots of free thread slots), it could go hyper-eager, speculatively calculating values which might be required depending on the future flow of the programme. When the system's very busy it could fall back to maximum laziness (reaping the harvest of the eager work that went before) until the spike has passed.

I suppose this is sort of doable (or simulable) if you have many, many small unix progs, piped together (for laziness) and appropriately niced... But even that (increasingly unlikely) scenario doesn't allow for speculative evaluation while (for example) waiting for IO.

At the moment, I'm thinking that the quickest route to such a system would involve some OS integration (either hacked into linux, or possibly built in to some sort of research OS), and some of the tricks of the partial evaluation crowd. But you might know better :) Is there another route? Has someone else already built it? I'd appreciate any links left in the comments :)

[1] I'd also like to be able to hyperlink to two places at once - perhaps your browser would give you a little context menu when you click on the multi-link or something.

languages, os, research, haskell

Previous post Next post
Up