From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 C2090BB9C for ; Wed, 23 Nov 2005 04:35:53 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAN3ZqQj002666 for ; Wed, 23 Nov 2005 04:35:52 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA28271 for ; Wed, 23 Nov 2005 04:35:51 +0100 (MET) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAN3ZnVZ000894 for ; Wed, 23 Nov 2005 04:35:50 +0100 Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id jAN3Zbn0027762; Wed, 23 Nov 2005 14:35:37 +1100 Received: from zeus.zipworld.com.au (zeus.zipworld.com.au [61.8.0.1]) by mailproxy2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id jAN3ZaBr016073; Wed, 23 Nov 2005 14:35:36 +1100 Received: from zeus.zipworld.com.au (localhost [127.0.0.1]) by zeus.zipworld.com.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id jAN3YseY013703; Wed, 23 Nov 2005 14:34:54 +1100 Received: (from mlh@localhost) by zeus.zipworld.com.au (8.12.3/8.12.3/Debian-7.1) id jAN3YrIw013702; Wed, 23 Nov 2005 14:34:53 +1100 Date: Wed, 23 Nov 2005 14:34:53 +1100 From: Matthew Hannigan To: Oliver Bandel Cc: caml-list@inria.fr Subject: Re: [Caml-list] Threads & Fork Message-ID: <20051123033453.GB11205@zipworld.com.au> References: <1132673981.13170.17.camel@starlight> <87wtj07kv8.fsf@mid.deneb.enyo.de> <20051122155002.GB16451@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051122155002.GB16451@first.in-berlin.de> User-Agent: Mutt/1.3.28i X-Miltered: at concorde with ID 4383E398.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4383E395.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 threads:01 oliver:01 bandel:01 threads:01 ocaml:01 run-time:01 posix:01 posix:01 api:01 clones:98 clones:98 unix:01 unix:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, Nov 22, 2005 at 04:50:02PM +0100, Oliver Bandel wrote: > On Tue, Nov 22, 2005 at 04:39:07PM +0100, Florian Weimer wrote: > > * Jonathan Bryant: > > > > > I'm confused as to why the attached code hangs. My understanding of > > > Unix.fork () is that it completely clones the current process, which in > > > my understanding, clones the processes's threads as well. Apparently, > > > though, that is not the case, because I can't join the thread in both > > > the parent and the child. > > > > I can't speak for the OCaml run-time, but POSIX fork only duplicates > > the current thread, so the new process is essentially single-threaded. > > I doubt that this is true. > Unix-fork() copies a complete process. > If the original has threads, the copy also have. > I don't think that POSIX handles this different to old Unix API. from the solaris10 man page for fork; note the last sentence. A call to fork1() replicates only the calling thread in the child process. In Solaris 10, a call to fork() is identical to a call to fork1(); only the calling thread is replicated in the child process. This is the POSIX-specified behavior for fork(). -- Matt