caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: "\"Mattias Engdegård\"" <mattias@virtutech.se>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocamlnet and kernel poll
Date: Thu, 11 Sep 2008 12:31:19 -0400	[thread overview]
Message-ID: <f8560b80809110931t1b571b01t3724e84239704ce@mail.gmail.com> (raw)
In-Reply-To: <43AB5EFE-44FF-47AB-818E-F27DD03823AE@gmail.com>

On Thu, Sep 11, 2008 at 11:43 AM, Joel Reymont <joelr1@gmail.com> wrote:
> Are you suggesting using multiple OS threads within a single process?

Yes.

> When exactly do you release the lock and how do you perform IO outside of
> it?
>
> How do you determine whether to release the lock or not?

Look at our Core-library.  It contains a module "Bigstring", which
provides many efficient I/O-functions for those.  Look at
"bigstring_stubs.c", where you'll see how these functions are
implemented in C-land, e.g. when the lock gets released, etc.

There are functions like e.g. "read_assume_nonblocking", which one can
use if one knows for sure that a read cannot block (e.g. after a
"select").  Then the function determines whether it's worth/necessary
releasing the lock.

If, for example, the read is performed into a bigstring which happens
to be a memory-mapped file, then the lock will always be released,
because if the memory page happens to be on disk you might otherwise
experience latency spikes when it's being paged in, since all other
threads would temporarily freeze.  Same for very large I/O-operations:
there the lock would be released, too, to exploit parallelism, improve
throughput, and avoid latency spikes.

Regards,
Markus

-- 
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com


  parent reply	other threads:[~2008-09-11 16:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 12:43 Joel Reymont
2008-09-11 12:51 ` Sylvain Le Gall
2008-09-11 13:42 ` [Caml-list] " Gerd Stolpmann
2008-09-11 14:04 ` Markus Mottl
2008-09-11 14:37 ` Mattias Engdegård
2008-09-11 15:32   ` Markus Mottl
2008-09-11 15:43     ` Joel Reymont
2008-09-11 15:50       ` Sylvain Le Gall
2008-09-11 16:31       ` Markus Mottl [this message]
2008-09-24 15:05         ` [Caml-list] " Rich Neswold
2008-09-24 15:43           ` Gabriel Kerneis
2008-09-26 15:53             ` Rich Neswold
2008-09-24 17:28           ` Markus Mottl

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=f8560b80809110931t1b571b01t3724e84239704ce@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=joelr1@gmail.com \
    --cc=mattias@virtutech.se \
    /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).