caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Nathaniel Gray <n8gray@gmail.com>
Cc: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>,
	caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Select on channels (again)
Date: Fri, 25 Aug 2006 11:55:34 +1000	[thread overview]
Message-ID: <1156470934.20759.166.camel@rosella.wigram> (raw)
In-Reply-To: <aee06c9e0608241206j1ff5a82ao2aecda304c4e0ebb@mail.gmail.com>

On Thu, 2006-08-24 at 12:06 -0700, Nathaniel Gray wrote:
> On 8/23/06, skaller <skaller@users.sourceforge.net> wrote:
> >
> > IF you had some known semantics such as that
> > messages were of bounded length and transmitted
> > in bounded time .. select would be useful, since
> > blocking operations would block only for bounded time,
> > in which case they're not blocking at all.
> 
> That's exactly what I'm talking about.  There are plenty of cases
> where such assumptions are justified, including IPC on a single
> machine or communication on a small trusted network.  Select on
> channels is no more or less useful than regular select, other than the
> fact that it makes it possible to use OCaml functions that only
> operate on channels.

This is true, and in C it is the same:

	printf(...)
	sscanf(... )

are both going to block, possibly for a bounded time
if they're only called when you know the underlying
fd has, at least temporarily, enough throughput to allow
the formatting algorithms to terminate.

The thing is, you can already do this, guaranteed!
It is rather heavy though: you make two pthreads
and read one fd in each, then send the
results down a single Event channel: the user code
can then read the parsed objects in sequence,
blocking until the first is available, then blocking
until the second is available.

The point is that although this is heavy, it is guaranteed
to work, so using Event module with pthreads is actually
easier to reason about.

If you would like to do this without the cost of spawning
pthreads .. then you need to use Felix, not Ocaml :)

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2006-08-25  1:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15  0:46 Nathaniel Gray
2006-08-21 22:47 ` Nathaniel Gray
2006-08-22  0:42   ` [Caml-list] " Jonathan Roewen
2006-08-22  6:27     ` Nathaniel Gray
2006-08-22  6:41       ` Jonathan Roewen
2006-08-22  8:15         ` skaller
2006-08-22 21:15           ` Mike Lin
2006-08-23  5:12         ` Nathaniel Gray
2006-08-22  8:10       ` Olivier Andrieu
2006-08-23  5:27         ` Nathaniel Gray
2006-08-22  8:21       ` Jacques Garrigue
2006-08-23  5:16         ` Nathaniel Gray
2006-08-23  6:35           ` skaller
2006-08-23 19:31             ` Nathaniel Gray
2006-08-24  5:37               ` skaller
2006-08-24 19:06                 ` Nathaniel Gray
2006-08-25  1:55                   ` skaller [this message]
2006-08-25 22:19                     ` Nathaniel Gray
2006-08-23  8:29 Christoph Bauer
2006-08-23 17:35 ` Robert Roessler
2006-08-24  8:18 ` Robert Roessler

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=1156470934.20759.166.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    --cc=n8gray@gmail.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).