From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: Julien Cristau <julien.cristau@ens-lyon.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] mmap() and strings
Date: Wed, 8 Dec 2004 21:24:28 +0100 [thread overview]
Message-ID: <20041208202428.GA9878@ours.starynkevitch.net> (raw)
In-Reply-To: <20041208200458.GC1840@ens-lyon.fr>
Le Wed, Dec 08, 2004 at 09:04:59PM +0100, Julien Cristau écrivait/wrote:
> Hello list,
>
> I'm wondering if somebody has an idea for the following problem:
>
> I'm working on a program which manipulates a buffer. A writer process
> regularly changes this buffer, and reader processes have to work on it
> after each change. Currently, the buffer is a string and is passed to
> the readers trough pipes. However, this is costly because the buffer is
> copied many times at each iteration.
Actually, pipes perform quite well on Linux....
> We thought we could use mmap(2),
> but there seems to be no easy solution
> to mmap() a memory region and treat it as a string in ocaml.
Use Bigarray-s for that. They can mmap files (on Unix & Linux) and are
already in Ocaml 3.08
You might also use IPC shared memory segments, but there is no support
in Ocaml for these (shmget & related system calls), so you'll probably
need to code the C stub (for the Ocaml binding) yourself.
Maybe you'll need JoCaml... (but I don't know if it is dead or not -
it was designed for coding cooperative programs communicating thru
channels).
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France
next prev parent reply other threads:[~2004-12-08 20:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-08 20:04 Julien Cristau
2004-12-08 20:24 ` Basile STARYNKEVITCH [this message]
2004-12-08 20:50 ` [Caml-list] " Julien Cristau
2004-12-09 1:09 ` Jacques Garrigue
2004-12-09 1:42 ` Jacques Garrigue
2004-12-09 10:32 ` David Baelde
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=20041208202428.GA9878@ours.starynkevitch.net \
--to=basile@starynkevitch.net \
--cc=caml-list@inria.fr \
--cc=julien.cristau@ens-lyon.fr \
/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