Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-07-15 (15:21)
From: Kuba Ober <ober.14@o...>
Subject: Re: [Caml-list] Re: thousands of CPU cores
On Thursday 10 July 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.
> I would subsume Cygwin under "pseudo-Unix", and its fork emulation is so
> slow that it would be a problem for speedy programs.

AFAIK, Cygwin's fork() emulation is quite limited since Cygwin didn't go the 
way of doing a custom process loader. I.e. instead of having a *tiny* 
statically linked loader executable which then actually brings in code and
data pages into the process space (and would allow sharing them copy-on-write
with other processes), they just use Windows for that, and that's why they
have to emulate (and make up) their process IDs. Doing an exec() when you have
your own loader is trivial: just tell the loader to deallocate all of
the process's virtual memory (save for that of the loader's), and load 
something else instead.

I have fiddled some time ago with a very basic custom loader which uses native
API and it worked OK for what it did. Of course Cygwin has to work under 
win 95, so it has no access to native API there, but on anything modern it
could easily have speeds comparable to native. I mean, Microsoft has
implemented the Posix subsystem using same native API and its fork() works
just fine (read: way better than Cygwin's).

I have last delved into all this ~5+ years ago, so things may have changed
in the meantime...

Cheers, Kuba