comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Waiver question
Date: 1997/05/02
Date: 1997-05-02T00:00:00+00:00	[thread overview]
Message-ID: <E9J2rB.G04@world.std.com> (raw)
In-Reply-To: 5kb8ol$18o@bcrkh13.bnr.ca


In article <5kb8ol$18o@bcrkh13.bnr.ca>,
Kaz Kylheku <kaz@vision.crest.nt.com> wrote:
>Because you may wish to code an interrupt service routine for an embedded
>system without dropping down to the assembly language level. In that case
>it becomes important to know that you can modify some variable atomically;
>you suddenly care how the access is compiled into machine code. It's not
>practical or desirable to write interrupt service routines in assembly
>language.
>
>If access to that object is not atomic, the process that was interrupted could
>have been in the middle of trying to read that variable. 

No, I don't buy that.  If you want to modify variables atomically in
Ada, then you use pragma Atomic.  And it's no big deal if that causes an
8-bit thing to take up 32 bits.

The real answer to my question, as Robert Dewar e-mailed to me
privately, is that variables (including components) are independently
addressable by multiple tasks, unless they're part of a pragma-packed
type.  If you have a record containing three booleans, then on a
Pentium, it will fit in three bytes, whereas on an Alpha (early
versions), it will need 12 bytes.  Unless there's a pragma Pack (in
which case it will be three *bits* on both machines).  If task 1 refers
to X.Y, and task 2 refers to X.Z, that's supposed to be OK, unless the
type of X has a pragma Pack.

Strange semantics, IMHO.  Pragma Pack is all about time-vs-space
trade-offs, but it has this weird side-effect on tasking semantics.  We
should have a way to *declare* things independently adressable, but the
default should be that things are not.  Instead of forcing the compiler
to assume that *everything* is independently addressable.

- Bob




  reply	other threads:[~1997-05-02  0:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-18  0:00 Waiver question Ken Garlington
1997-04-19  0:00 ` Tom Moran
1997-04-20  0:00 ` Steve Doiel
1997-04-20  0:00 ` Dean Runzel
1997-04-22  0:00   ` Ken Garlington
1997-04-20  0:00 ` Robert Dewar
1997-04-21  0:00   ` Ken Garlington
1997-04-22  0:00     ` Ken Garlington
1997-04-23  0:00       ` Corey Minyard
1997-04-24  0:00         ` Richard Kenner
1997-04-28  0:00         ` Larry Kilgallen
1997-04-28  0:00           ` Corey Minyard
1997-04-29  0:00             ` Kaz Kylheku
1997-04-29  0:00             ` Robert Dewar
1997-04-29  0:00             ` Laurent Guerby
1997-04-30  0:00               ` Corey Minyard
1997-04-29  0:00           ` Robert Dewar
1997-04-29  0:00           ` Richard Kenner
1997-04-30  0:00             ` Robert A Duff
1997-05-01  0:00               ` Kaz Kylheku
1997-05-02  0:00                 ` Robert A Duff [this message]
1997-05-02  0:00                   ` Larry Kilgallen
1997-05-02  0:00                     ` Robert A Duff
1997-05-02  0:00                       ` Larry Kilgallen
1997-05-03  0:00                         ` Robert A Duff
1997-05-03  0:00                           ` Larry Kilgallen
1997-05-04  0:00                             ` Robert Dewar
1997-05-04  0:00                         ` Robert Dewar
1997-05-02  0:00                     ` Robert Dewar
1997-05-06  0:00                     ` John M. Mills
1997-04-30  0:00             ` Robert Dewar
1997-05-01  0:00               ` Larry Kilgallen
1997-05-07  0:00                 ` Bad .diff files in gnat-3.09 in Linux Benoit Jauvin-Girard
1997-05-09  0:00                   ` Albert K. Lee
1997-04-23  0:00     ` Waiver question Tarjei Jensen
1997-04-21  0:00 ` Robert I. Eachus
1997-04-21  0:00   ` Robert Dewar
1997-04-22  0:00     ` Robert I. Eachus
1997-04-23  0:00       ` Robert Dewar
1997-04-22  0:00   ` Ken Garlington
1997-04-23  0:00     ` Robert S. White
1997-04-24  0:00     ` Robert Dewar
1997-04-24  0:00       ` Steve Vestal
1997-04-25  0:00         ` Robert I. Eachus
1997-04-25  0:00         ` Ken Garlington
replies disabled

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