comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Pragma Atomic
Date: Thu, 11 Jan 2001 09:00:12 -0500
Date: 2001-01-11T14:00:12+00:00	[thread overview]
Message-ID: <3A5DBC6C.1E665DA7@averstar.com> (raw)
In-Reply-To: 93i7oi$a6laq$2@ID-25716.news.dfncis.de

Nick Roberts wrote:
> ...
> > As for reads and writes being performed indivisibly, Reset is
> > one bit, so how could a read or write of it be "divisible"?
> 
> Reset is not necessarily one bit. It may be a size chosen by the compiler
> (e.g. one word), or determined by a representation clause.
> 
> Furthermore, if it is one bit in size, it may (indeed it is liekly to) cause
> normal accesses to it to be divisible. To effect one read access, a typical
> machine will need to: load the word containing the bit; mask off the rest of
> the word; perhaps shift the bit along. If this takes several instructions,
> those instructions will probably be interruptible.

This is not really the problem.  The thing which has to be "indivisible"
is the interaction with memory, and in this case, the read from
memory is generally just one uninterruptable instruction.
The problem is more with "write" where it is supposed to involve
exactly one memory access instruction, but in general, to write
a bit field, you must first read the entire surrounding word, make
the appropriate change, and then rewrite the entire surrounding
word, which violates the volatility rules by incurring an extra
"read", and if neighboring bits are also volatile, causes further
violations of volatility.  So the original questioner is in some
sense right that a single bit marked atomic is not saying much
more than marking the single bit volatile.

> ...> >                                 -- thanks, Adam
> 
> I hope I've cleared some things up!
> 
> --
> Nick Roberts

-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom, Inc. (A Titan Company) Burlington, MA  USA
(AverCom was formed 1/1/01 from the Commercial Division of AverStar)
(http://www.averstar.com/services/ebusiness_applications.html)



  reply	other threads:[~2001-01-11 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-09 22:44 Pragma Atomic Adam Beneschan
2001-01-09 23:16 ` mark.biggar
2001-01-10  4:27 ` Robert Dewar
2001-01-10 17:53 ` Nick Roberts
2001-01-11 14:00   ` Tucker Taft [this message]
2001-01-11 15:06     ` Nick Roberts
replies disabled

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