Version française
Home     About     Download     Resources     Contact us    
Browse thread
Fwd: [Caml-list] Faking concurrency using Unix forks and pipes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Erik de Castro Lopo <mle+ocaml@m...>
Subject: Re: Fwd: [Caml-list] Faking concurrency using Unix forks and pipes
Jonathan Bryant wrote:

> What I've always done to get around this is fork a process at the  
> very beginning of the code, and whenever I need to fork a process  
> later, I fork one from that process.  That way almost nothing is in  
> the heap.

Yep, that works. Its also probably something that could be built 
into the JoCaml extension.

>  I do have worries about the efficiency of this though:  
> when marshaling a closure across a socket to another process, it  
> must marshal all the necessary state as well.  I would imagine this  
> has the potential to get slow if there was much state to marshal  
> (i.e., a closure marshaled referencing a large data structure).

This is a potential problem. This is like so many language features
that if misused, can lead to huge performance degradations. Knowing
about the problem beforehand allows programmers to avoid it.

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"If you have an apple and I have  an apple and we  exchange apples then
you and I will still each have  one apple. But  if you have an idea and I
have an idea and we exchange these ideas, then each of us will have two
ideas." -- George Bernard Shaw