From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 206E4BC69 for ; Wed, 30 May 2007 21:58:00 +0200 (CEST) Received: from smtp.syd.people.net.au (smtp.syd.people.net.au [218.214.225.98]) by concorde.inria.fr (8.13.6/8.13.6) with SMTP id l4UJvvJe004048 for ; Wed, 30 May 2007 21:57:58 +0200 Received: (qmail 12632 invoked from network); 30 May 2007 19:58:22 -0000 Received: from unknown (HELO hendrix.mega-nerd.net) (218.214.64.136) by smtp.syd.people.net.au with SMTP; 30 May 2007 19:58:22 -0000 Received: from hendrix (hendrix [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id C63252FF4E for ; Thu, 31 May 2007 05:57:56 +1000 (EST) Date: Thu, 31 May 2007 05:57:56 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: Fwd: [Caml-list] Faking concurrency using Unix forks and pipes Message-Id: <20070531055756.2e328baa.mle+ocaml@mega-nerd.com> In-Reply-To: <4C7DF773-3B6F-464F-8D90-CE240B91AEE5@valdosta.edu> References: <5F7D2956-2B0A-465A-8AC2-06D7EDC457F9@valdosta.edu> <4C7DF773-3B6F-464F-8D90-CE240B91AEE5@valdosta.edu> Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 465DD745.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 forks:01 jocaml:01 marshaling:01 marshaled:01 misused:98 heap:01 unix:01 wrote:01 caml-list:01 marshal:01 marshal:01 closure:01 closure:01 data:02 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