caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Erik de Castro Lopo <mle+ocaml@mega-nerd.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] forking, threads and events
Date: Tue, 10 Oct 2006 14:38:28 +0200	[thread overview]
Message-ID: <1160483909.32409.35.camel@localhost.localdomain> (raw)
In-Reply-To: <20061010221607.7ecc5cba.mle+ocaml@mega-nerd.com>

Am Dienstag, den 10.10.2006, 22:16 +1000 schrieb Erik de Castro Lopo:
> Hi all,
> 
> I'm thinking about to start a new project which has some rather 
> critical requirements. It will be compiled with the native compiler 
> initially targeting Linux/Unix but eventually also windoze.
> 
> The app consists of a main engine which spawns many short lived 
> child threads or processes. The children go away, do their work and 
> then pass their results back to the main engine. Many of the children 
> will spawn another process and read the child process output via a 
> pipe and many of the children will block on I/O. A small portion of 
> the children may be I/O bound, but there is not way of telling which 
> beforehand.
> 
> Since I would like to maximize the throughput on multi-core and 
> multi-processor machines I am thinking of using a mix of forking and 
> threading.

You know that there is no fork on Windows?

>  For communications, I was thinking of using the Event
> module for communication between threads, but I don't think that
> works for forked process (pipes maybe?).
> 
> Anybody have any advice for this project? Any war stories from similar
> projects? Any readings they can recommend?

If there wasn't the Windows requirement I could recommend this:

You may have a look at ocamlnet2. It includes the netplex library that
manages parent/children relationships between either forked processes or
threads. You can use SunRPC for communication (or whatever you like, but
SunRPC support is included). The bad news is that it does not run on the
native Windows port, not even in the threaded variant (because there's
no socketpair...).

Ah yes, I have a war story, but cannot tell it now. I can only say it is
used for a really big commercial project.

Download it here:

http://www.ocaml-programming.de/packages/ocamlnet-2.2test13.tar.gz

An online manual is here:

http://ocamlnet.sourceforge.net/manual-2.2/

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
------------------------------------------------------------


  reply	other threads:[~2006-10-10 12:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 12:16 Erik de Castro Lopo
2006-10-10 12:38 ` Gerd Stolpmann [this message]
2006-10-11  0:23   ` [Caml-list] " Erik de Castro Lopo
     [not found] ` <1160490322.16459.110.camel@rosella.wigram>
2006-10-11  0:22   ` Erik de Castro Lopo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1160483909.32409.35.camel@localhost.localdomain \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=mle+ocaml@mega-nerd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).