comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: Streams and Concurrency
Date: 1998/12/31
Date: 1998-12-31T00:00:00+00:00	[thread overview]
Message-ID: <76g91o$udt$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 76fe92$46c$1@platane.wanadoo.fr

In article <76fe92$46c$1@platane.wanadoo.fr>,
  "Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr> wrote:
> Unfortunately, all IO operations are potentially
> blocking, and therefore not allowed from within a
> protected operation. To get the effect of mutual
> exclusion for procedures requiring potentially blocking
> operations, have a look at package Protection
> available from Adalog's components page
> (http://perso.wanadoo.fr/adalog/compo2.htm)


To me the abstraction violation that comes from the
restriction on blocking operations in protected objects
is an intolerable concession to one particular low level
model of implementation, which in fact as far as I know
virtually no Ada 95 compiler uses. I think that this
optimization should have been achieved with a restrictions
pragma

   pragma Restrictions (No_Blocking_Operations, type-name);

or some such,

In any case, GNAT guarantees that blocking operations CAN
be done within protected objects, of course you may get
deadlock if you do obviously bad things, but certainly
doing IO within a protected object is not such a bad thing,
and this will work fine. We have many customers who depend
on this guarantee.

Yes, yes, of course this is potentially non-portable, but
it makes protected objects enormously more useful. Remember
that there are two advantages of protected objects:

1) possibility of more efficient implementation (I say
possibility here because in fact there are many
complications which result in less efficiency than you
might have hoped for in the general case, and in any
case some cases of agent tasks can be optimized in a
corresponding efficient manner.

2) preferable abstraction to a task in some situations

For my taste 2) is much more important than 1), and the
restriction on blocking operations badly damages the use
of 2).

We have had more than one user who was plain incredulous
on being informed of this restriction, and indeed it was
in talking with one of these users that we decided to
guarantee that GNAT does NOT have this restriction.

If we ever find a real need to implement this restriction,
for efficiency purposes or for any other purpose, we can
add a restrictions identifier.

By the way, another way around this is to do the actual
IO with an interface to C. There is nothing in the RM that
says that a C routine doing I/O is potentially blocking in
the formal sense in the RM (remember that the notion of
potentially blocking is not isomorphic to actual blocking,
there can be blocking operations that are not potentially
blocking, and vice versa).

So an implementation is free to define whether interfacing
to C I/O routines is or is not blocking, and for sure a
compiler cannot in fact check, so this is likely to work
on most Ada 95 compilers.

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  parent reply	other threads:[~1998-12-31  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-30  0:00 Streams and Concurrency James S. Rogers
1998-12-29  0:00 ` David Botton
1998-12-30  0:00   ` James S. Rogers
1998-12-30  0:00     ` dennison
1998-12-30  0:00       ` James S. Rogers
1999-01-04  0:00       ` Robert I. Eachus
1998-12-31  0:00     ` Jean-Pierre Rosen
1998-12-31  0:00       ` dewar
1998-12-31  0:00         ` dennison
1999-01-04  0:00         ` Jean-Pierre Rosen
1999-01-04  0:00           ` robert_dewar
1998-12-31  0:00       ` dewar [this message]
1998-12-31  0:00         ` Ada-G, was " Tom Moran
1999-01-01  0:00           ` dewar
1999-01-01  0:00             ` Larry Kilgallen
1999-01-01  0:00           ` Brian Rogoff
1999-01-04  0:00             ` Robert I. Eachus
1999-01-08  0:00               ` Mats Weber
1999-01-08  0:00                 ` Robert I. Eachus
1999-01-08  0:00         ` Mats Weber
1999-01-08  0:00           ` Tucker Taft
1998-12-30  0:00   ` dennison
1998-12-30  0:00     ` Tucker Taft
1998-12-30  0:00       ` Robert I. Eachus
1998-12-30  0:00         ` Tucker Taft
1998-12-31  0:00         ` dennison
1998-12-31  0:00           ` robert_dewar
1998-12-31  0:00             ` dennison
1999-01-01  0:00               ` robert_dewar
1999-01-04  0:00           ` Robert I. Eachus
1998-12-30  0:00       ` dennison
1998-12-31  0:00         ` robert_dewar
1998-12-30  0:00 ` dennison
1998-12-30  0:00   ` Robert I. Eachus
1999-01-11  0:00   ` Bulk synchronous model for IO (was Re: Streams and Concurrency) Kevin Rigotti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox