From: Florian Weimer <fw@deneb.enyo.de>
Subject: Concurrent access to packed arrays
Date: 21 Jan 2001 11:59:06 +0100
Date: 2001-01-21T11:59:06+01:00 [thread overview]
Message-ID: <87g0id8939.fsf@deneb.enyo.de> (raw)
For simplicity, assume the array is of type String. Some machines
(early Alphas?) do not offer load/store functions for individual
octets, so the characters of a string might not be independently
addressable. Now suppose we have a string object and a variable which
indicates the last position in the string which has been written:
The_String : String (1 .. Some_Maximum);
Last_Written : Natural;
pragma Atomic (Last_Written);
Task A1, A2, ... make a copy of Last_Written and read data from
The_String (1 .. Copy_Of_Last_Written). Task B continues to write to
The_String (Last_Written + 1 .. Some_Maximum) and update Last_Written.
This might result in concurrent read and write access to the same
memory location, but I think this will work anyway because task B
writes to the location without changing the part interpreted by the
reading tasks. However, according to the Ada standard, this scenario
results in erroneous execution.
Now my question: Are there in fact platforms where this doesn't work?
Shall I play safe and apply pragma Atomic_Components (and use an
unpacked array instead of a packed one)?
next reply other threads:[~2001-01-21 10:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-21 10:59 Florian Weimer [this message]
2001-01-21 16:00 ` Concurrent access to packed arrays Robert Dewar
[not found] ` <3A71447B.A2082CA3@mac.com>
2001-01-27 16:37 ` Florian Weimer
2001-01-27 23:06 ` Mats Weber
2001-01-27 23:56 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox