English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Faking concurrency using Unix forks and pipes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-30 (07:14)
From: Florian Hars <hars@b...>
Subject: Re: [Caml-list] Faking concurrency using Unix forks and pipes
Jon Harrop schrieb:
> Has anyone implemented a parallel map function in OCaml using Unix forks, 
> pipes and maybe marshalling?

I've been toying with something like

module type MR =
  functor (D1: DICT_TYPE) ->
    functor (D2: DICT_TYPE) ->
  val mapreduce :
    (D1.key -> D1.value -> (D2.key * 'a) list) ->
    ( D2.key -> 'a list -> D2.value option) ->
    D1.t ->

and have one implementation that forks a set of worker processes
and then marshalls data of types
type 'a command = Quit | Execute of 'a
type ('a, 'b) response = Result of 'a | Error of 'b
through a pipe.

Not very robust right now, but it seems to work if none of the
workers dies prematurely...

Yours Florian.