Serializing Functions and Actions for Distributed Programming

I'm very excited by the ability to pass functions or IO actions between threads of the same program. But I don't see any language or library support for doing so between programs, or between sessions with the same program. OCaml provides a partial solution: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Marshal.html Though all it's really sending is an address and a hash of the binary program. Even SerTH doesn't help with functional types. I seek the knowledge of the Haskell Cafe: is there a reasonable way of addressing this problem? -- Brian T. Sniffen bts@alum.mit.edu or brian.sniffen@gmail.com http://www.evenmere.org/~bts

Hi
I'm very excited by the ability to pass functions or IO actions between threads of the same program. But I don't see any language or library support for doing so between programs, or between sessions with the same program. OCaml provides a partial solution:
I know Tom Shackell has been trying to solve this with Yhc. His work is on trying to pull apart functions, send them over a network connection to an unrelated computer (different architecture, os, continent etc) and put them back together, with lots of communication and other cool stuff. I know there is an API for this in the yhc repo, but I have absolutely no idea how to use it :) I also think this is intended as a low level library, with something easier to use going to be layered on top of it. http://www-users.cs.york.ac.uk/~malcolm/cgi-bin/darcsweb.cgi?r=yhc-devel;a=h... Thanks Neil

At Sat, 29 Jul 2006 14:07:51 -0400, Brian Sniffen wrote:
I'm very excited by the ability to pass functions or IO actions between threads of the same program. But I don't see any language or library support for doing so between programs, or between sessions with the same program.
There is a project, Mobile Haskell, that deals with this a bit. It requires a special version of the GHC compiler -- and I am not sure how publicly available the patches are. There are a few papers on it such as: http://homepages.inf.ed.ac.uk/stg/workshops/TFP/book/DuBois/duboismhaskell/c... j.

On 29.07 14:07, Brian Sniffen wrote:
I'm very excited by the ability to pass functions or IO actions between threads of the same program. But I don't see any language or library support for doing so between programs, or between sessions with the same program. OCaml provides a partial solution:
http://caml.inria.fr/pub/docs/manual-ocaml/libref/Marshal.html
Though all it's really sending is an address and a hash of the binary program. Even SerTH doesn't help with functional types. I seek the knowledge of the Haskell Cafe: is there a reasonable way of addressing this problem?
There is sadly no real good way of doing it on top of GHC. If both sides are running an identical executable image one can hack it to work (see parallel Haskell for the code to do it). But in general I don't think it is worth the trouble. The problem is: 1) versioning (I like being able to upgrade applications while keeping serialized state) 2) trust (GHC does not have sandboxing) YHC may have an answer for YHC users. I have some code which allows one to register functions and call them transparently over a network - even supporting callbacks. Thus code does not move, but code location is quite transparent. - Einar Karttunen

On 7/30/06, Einar Karttunen
On 29.07 14:07, Brian Sniffen wrote:
I'm very excited by the ability to pass functions or IO actions between threads of the same program. But I don't see any language or library support for doing so between programs, or between sessions with the same program. OCaml provides a partial solution:
http://caml.inria.fr/pub/docs/manual-ocaml/libref/Marshal.html
Though all it's really sending is an address and a hash of the binary program. Even SerTH doesn't help with functional types. I seek the knowledge of the Haskell Cafe: is there a reasonable way of addressing this problem?
There is sadly no real good way of doing it on top of GHC. If both sides are running an identical executable image one can hack it to work (see parallel Haskell for the code to do it). But in general I don't think it is worth the trouble. The problem is:
1) versioning (I like being able to upgrade applications while keeping serialized state) 2) trust (GHC does not have sandboxing)
Depending on the type of sandboxing that you need/want #2 might be possible with GHC. Take lambdabot for example. lambdabot has made it safe to allow arbitrary expression evaluation by disallowing IO and not importing unsafePerformIO and similar "unsafe" functions. Just a thought... Jason

On 30.07 12:12, Jason Dagit wrote:
Depending on the type of sandboxing that you need/want #2 might be possible with GHC. Take lambdabot for example. lambdabot has made it safe to allow arbitrary expression evaluation by disallowing IO and not importing unsafePerformIO and similar "unsafe" functions.
This is possible as lambdabot has the source code rather than an arbitrary Haskell expression at runtime. Basically how does one differentiate between: (\x -> unsafePerformIO somethingNasty `seq` (x+1)) and (\x -> x + 1) at runtime. - Einar Karttunen
participants (5)
-
Brian Sniffen
-
Einar Karttunen
-
Jason Dagit
-
Jeremy Shaw
-
Neil Mitchell