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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B5C6FBBAF for ; Thu, 10 Jul 2008 23:37:20 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtsBAGUddkjUnw7Xf2dsb2JhbACCOY9sAQELBQIGBxGfGw X-IronPort-AV: E=Sophos;i="4.30,340,1212357600"; d="scan'208";a="13013875" Received: from fhw-relay07.plus.net ([212.159.14.215]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 10 Jul 2008 23:37:20 +0200 Received: from [90.211.25.230] (helo=beast.local) by fhw-relay07.plus.net with esmtpa (Exim) id 1KH3pH-0006I2-N5 for caml-list@yquem.inria.fr; Thu, 10 Jul 2008 22:37:19 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: thousands of CPU cores Date: Thu, 10 Jul 2008 22:35:52 +0100 User-Agent: KMail/1.9.9 References: <1215724745.24773.37.camel@flake.lan.gerd-stolpmann.de> In-Reply-To: <1215724745.24773.37.camel@flake.lan.gerd-stolpmann.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807102235.52882.jon@ffconsultancy.com> X-Plusnet-Relay: 70f327ec4c239d8826451bb70ab63d96 X-Spam: no; 0.00; gerd:01 stolpmann:01 mingw:01 sockets:01 syscalls:01 orthogonal:01 event-based:01 syntax:01 frog:98 wrote:01 caml-list:01 inherit:01 inherit:01 idiomatic:02 handles:03 On Thursday 10 July 2008 22:19:05 Gerd Stolpmann wrote: > 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. I think your conclusion needs qualification. You are trying to shoehorn an existing process-based Linux solution onto Windows and discovering that it does not work well. However, Windows already provides different ways of achieving the same thing, e.g. F# with its first-class events and built-in asynchronous programming syntax using the .NET thread pool and mailboxes for message passing. Moreover, the idiomatic solution on Windows is almost certainly faster than anything you can reasonably write under Linux in the absence of a concurrent GC (i.e. off the JVM). -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e