Version française
Home     About     Download     Resources     Contact us    
Browse thread
CallCC using fork (and garbage collected processes)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: CallCC using fork (and garbage collected processes)

Just another crazy idea. So Oleg's callcc for OCaml works by copying the OCaml 
bytecode stack and its rather nifty because you can trivially control invert 
parsers and so forth.

You can replicate the native-code stack using fork. What if you wrap the 
forked process in an object and set the finalizer to pass it a message 
telling it to die. Then you could invoke the process (continuation) to 
propagate computation. Maybe you can pass your child the pipe from your 
parent so that it can respond directly and then die yourself (a tail call!).

I know this is really silly because you've got the OCaml GC collecting 
processes (which is even worse than GCing OpenGL textures) but my machine can 
fork processes pretty quickly and I'm just wondering if anyone's tried it?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The OCaml Journal
http://www.ffconsultancy.com/products/ocaml_journal/?e