guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: to serialize/deserialize closures; and multithreading


From: Faraz Shahbazker
Subject: Re: to serialize/deserialize closures; and multithreading
Date: 25 Mar 2004 22:38:00 -0000

nick,

I am curious too : what is your purpose of migration?

        I am working on something similar, for using scheme on
Beowulf-clusters with PVM. Here the purpose of migration is to
remotely-evaluate a sexp. But possible uses of this technology
could be to simply suspend/restart programs(see chpox), or for
delivering active web-content.

> Should a mutation on the new computer of a captured variable
> affect the old computer? - greg

        Basically, if your program is purely/mostly functional,
it might be easy to migrate, while maintaining referential
transparency - just byte-copy(with tags) all   data-types.
The semantics of mutable objects (when mutation does occur)
is for you to decide. It might make greater sense for example
for exceptions to be migrated and  handled remotely, than
say mutexes or ports.


>  Also, you'd need to check that any symbols referenced by
> the code or variables were actually in existence in the
> new guile instance's symbol table.  And that global
> variables referenced by the code got copied (as well as
> the lexical variables).
> So will be recursively nasty.

        I agree with Lynn. Guile's own procedures for
detecting free-variables in expressions may be inadequate for
this.  There is a technique called lambda-lifting meant for
converting sexps into pure combinators(a.k.a thunks). See
Jonhsson's paper on lambda-lifting. It was meant to be used
for compiler optimizations for ML. It was also used in the
Larceny Scheme compiler. But since you are not yet conversant
with SCM_API, I don't know....

        printer/reader is an elegant(read slow ;) solution for
plain Scheme code, but it obviously won't work for custom smobs,
which I am assuming that you might want to create(since you are
using C). 

So tell me more about it!!

- faraz 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]