[<<][compsci][>>][..]
Mon Jun 15 13:19:05 CEST 2009

Cached Continuations and Synchronized VMs

I've been thinking a bit about continuations and how they can be used
in situations where you have two parties that communicate without
shared state with the following constraints:

   * There is a possibility of one side giving up without notice.

   * The link is expensive.

This is the typical interaction scenario of a web server talking to a
web client, but there is no need to make it a-symmetrical.

Communicating parties are adequately modeled using continuation
passing style.

In general, if the two communicating parties just exchange the whole
continuation (placing the ball in the other court), the first
constraint isn't a problem: if one of them dies the conversation
simply stops without any side-effect on the other party.

However, because the link is expensive and because non-trivial
continuations tend to be quite large, one tends to keep the
continuation stored on one of the parties, call this the "server", and
exchange references over the channel.  The problem here however is
that if the other party (the "client") dies, this creates garbage on
the server.

If you separate this problem in two it might be easier to manage:

  * Logically, continuations are always exchanged fully between the
    two parties.  There is never any local state.

  * A caching channel with knowledge of the protocol can use an an
    aggressive expiry strategy to manage the communication.

An effective caching channel requires analysis of the continuations by
the caching mechanism: i.e. two subsequent continuations usually share
a lot of common data.  Eploiting this redundancy is the task of the
cache.

Also, the expiration strategy probably needs to be based on common
usage.  This needs to be tuned in the field.

So I wonder, can't this be solved by "synchronizing" two virtual
machines, say two CEK machines, one on the server and one on the
client?

This would be quite similar to the way two humans talk: we don't
really have a mechanism to transfer our continuations, but we can try
to model the other's state to get by with very little information
traveling accross.

TODO:

  * Look at some work on continuations in web programming
    (i.e. Shriram Krishnamurthi[1] or Jay McCarthy[2]) to see if this
    idea is already there.

  * Look at prog@vub work on this[3][4].


[1] http://www.cs.brown.edu/~sk
[2] http://faculty.cs.byu.edu/~jay/home/
[3] http://prog.vub.ac.be/amop/research/dgc
[4] http://prog.vub.ac.be/amop/research/ambientrefs


[Reply][About]
[<<][compsci][>>][..]