Version française
Home     About     Download     Resources     Contact us    
Browse thread
thousands of CPU cores
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] Re: thousands of CPU cores

Am Donnerstag, den 10.07.2008, 21:02 +0000 schrieb Sylvain Le Gall:
> On 10-07-2008, Gerd Stolpmann <info@gerd-stolpmann.de> wrote:
> >
> > Am Donnerstag, den 10.07.2008, 20:07 +0000 schrieb Sylvain Le Gall:
> >> On 10-07-2008, Gerd Stolpmann <info@gerd-stolpmann.de> 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
------------------------------------------------------------