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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 55B2FBBAF for ; Thu, 10 Jul 2008 23:19:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUEAGkZdkjAXQIm/2dsb2JhbACBW7AqAQ X-IronPort-AV: E=Sophos;i="4.30,340,1212357600"; d="scan'208";a="27217391" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Jul 2008 23:19:08 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m6ALJ5rP025980 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 10 Jul 2008 23:19:07 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsgCAOAZdkjU4367gWdsb2JhbACBW5BKAQEQIAOfLAE X-IronPort-AV: E=Sophos;i="4.30,340,1212357600"; d="scan'208";a="13013566" Received: from moutng.kundenserver.de ([212.227.126.187]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Jul 2008 23:19:07 +0200 Received: from gate.lan.gerd-stolpmann.de (dslb-088-068-196-079.pools.arcor-ip.net [88.68.196.79]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1KH3Xe1z93-0007O9; Thu, 10 Jul 2008 23:19:06 +0200 Received: from [192.168.0.32] (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id 1984CC077; Thu, 10 Jul 2008 23:19:06 +0200 (CEST) Subject: Re: [Caml-list] Re: thousands of CPU cores From: Gerd Stolpmann To: Sylvain Le Gall Cc: caml-list@inria.fr In-Reply-To: References: <1215717356.24773.17.camel@flake.lan.gerd-stolpmann.de> <1215721450.24773.25.camel@flake.lan.gerd-stolpmann.de> Content-Type: text/plain Date: Thu, 10 Jul 2008 23:19:05 +0200 Message-Id: <1215724745.24773.37.camel@flake.lan.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX18HNc17HdfwGu7khjeeaLK6TuscDmIXufmGsMx 3R6mUsPWWOumf0Iq3Xhx0btJDO2LZ3h1otRInwk1W+c4N+9iQg PNGS3c7eWnFNm+clG5BdwE/s+ORktuT X-Miltered: at discorde with ID 48767CC9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 donnerstag:01 gerd:01 stolpmann:01 donnerstag:01 ocaml:01 stdin:01 stdout:01 mingw:01 sockets:01 syscalls:01 orthogonal:01 event-based:01 viktoriastr:01 Am Donnerstag, den 10.07.2008, 21:02 +0000 schrieb Sylvain Le Gall: > On 10-07-2008, Gerd Stolpmann wrote: > > > > Am Donnerstag, den 10.07.2008, 20:07 +0000 schrieb Sylvain Le Gall: > >> On 10-07-2008, Gerd Stolpmann wrote: > >> > In Ocaml you can exploit multi-core currently only by using > >> > multi-processing parallel programs that communicate over message passing > >> > (and only on Unix). Actually, it's an excellent language for this style. > >> > >> Why only on Unix ? > > > > No fork() on Windows. And emulating its effects is hard. > > > > open_process + stdin/stdout should do the trick... at least i think so. After having ported godi to mingw I am not sure whether this works at all. The point is that you usually want to inherit OS resources to the child process (e.g. sockets). The CreateProcess Win32 call (http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx) mentions that you can inherit handles, but I would be careful with the information given in MSDN. Often it works only as far as the presented examples. Windows isn't written for multi-processing, and its syscalls aren't as orthogonal as in Unix-type systems. Furthermore, it looks like a pain in the ass - often you want to run some initialization code, and without fork() you have to run it as often as you start processes. Also, Windows is just a bad platform for event-based programs, and you want to do it to some extent (e.g. for watching all your child processes). Only for socket handles there is a select() call. For all other types of handles you cannot find out in advance whether the operation would block or not. So... if there is any chance you can select the OS, keep away from Windows for this type of program. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------