On 11/29/2010 04:33 PM, Oliver Bandel wrote:
Zitat von "Gerd Stolpmann" <i...@gerd-stolpmann.de>:

Am Montag, den 29.11.2010, 17:12 +0100 schrieb Oliver Bandel:
Zitat von "Gerd Stolpmann" <i...@gerd-stolpmann.de>:


You use shared mem(?), but you link only to *.ml files,
and I see no *.c there.

How can this be done?

At least not via the libs that are shipped with OCaml?!

Actually it can be done using the libs that ship with OCaml
(Unix and Bigarray), although it is not 100% POSIX :

let create_shared_genarray kind layout dims =
  let fd = Unix.openfile "/dev/zero" [Unix.O_RDWR] 0
  in let ar = Bigarray.Genarray.map_file fd kind layout true dims
  in Unix.close fd; ar


The resulting bigarray object is shared among subsequent forks.
This relies on the fact that mmap-ing /dev/zero is equivalent
to an anonymous mmap.

http://en.wikipedia.org/wiki//dev/zero

Well, at least it works on Linux.

Stephan

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to