Continuations, continued
First, let me correct an important omission in my previous post. The example I gave is closely based on one I was shown by Shriram Krishnamurthi. Shriram is part of the PLT Scheme group. They have done a lot of good work in this area, and in programming languages in general. They even have their own continuation-based web server.
The history of ideas is very important, especially in academia. I'd encourage anyone interested in the topic to look at the above sites, read the papers, and trace back through the citations to understand it all better. As far as I know, the first realization of such a web server was by Paul Graham, but this is not an academic paper and I haven't done a literature search.
As for the substance of the comments on the last post. It seems that most people who responded are comfortable with us not supporting continuations on the JVM. For those who aren't, I have to stress that any feature we add comes at the expense of something else. Resources are finite. If we add X, we cannot do a good job on Y. So we prioritize. We do this based on input from the community, and on our own technical understanding of the cost/benefit ratio of a given feature. Your priorities may differ.
There are still some smart people that don't buy my view continuation based web servers are a temporary expedient. That's fine. Time will tell.
Posted at 03:32PM May 19, 2006 by gbracha in Java | Comments[8]
I strongly suspect that most of us who think more favourably of continuation based web servers try to avoid programming in Java. For myself, I don't think that they are the last word in web technology, but I expect that they are going to be the next step in the evolution of web technology.
Posted by John Dougan on May 19, 2006 at 04:40 PM PDT #
Posted by Morten Christensen on May 20, 2006 at 04:33 AM PDT #
Posted by Jerry Boetje on May 20, 2006 at 12:22 PM PDT #
Posted by Sam Griffith on May 22, 2006 at 12:32 AM PDT #
I strongly suspect you weren't couting right. Then again, as a former commenter said, maybe we just don't belong here, in your Java world. We'd realy like our Scheme (or our Ruby) to belong to your JVM world but, in the end, it'll always be the Java-VM world - not “good” enough for Java, not good enough period.
Posted by ncruces on May 22, 2006 at 04:31 AM PDT #
Jetty6 implements a feature it calls "continuations," which are really (as far as I can tell) just lots of suspended threads on the server.
Using threads as a sort of poor man's continuation actually does just fine in many cases -- it's possible, for example, to get basic "yield"-style coroutine semantics with some fairly simple abstraction. But in the web server scenario, I can't imagine it's a good idea to keep all those threads around, even if they're all waiting.
I wonder if it's possible to create some sort of mechanism for the long-term suspension of threads that doesn't consume OS resources? Is it possible to detach the actual OS thread from a JVM stack, and reattach it later?
Perhaps it is even possible to do this while maintaining existing thread semantics, and make it transparent: if thread overhead is becoming large, the thread that's been stuck on wait() longest gets tossed to the side. Then you don't have security issues, and don't have to add language features -- the web scenario is still quite possible given a few good abstractions, only now it's just a JVM optimization problem instead of a language problem.
Or maybe the JVM already does this sort of thing, and I shouldn't be afraid of creating thousands of mostly-suspended threads?
Posted by Paul Cantrell on May 22, 2006 at 07:53 AM PDT #
Posted by Paul Cantrell on May 22, 2006 at 11:28 AM PDT #
Posted by Predictor on May 23, 2006 at 07:40 AM PDT #