comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Carey <research@ijs.co.nz>
Subject: Re: String library with garbage collection?
Date: Sat, 11 Jan 2003 00:35:20 +1300
Date: 2003-01-11T00:35:20+13:00	[thread overview]
Message-ID: <n77t1vkmvvv47o5oq0dpli4f74c3tqu5jb@4ax.com> (raw)
In-Reply-To: NrrT9.103677$hK4.8421041@bgtnsc05-news.ops.worldnet.att.net

On Fri, 10 Jan 2003 03:52:13 GMT, "James S. Rogers"
<jimmaureenrogers@worldnet.att.net> wrote:
>"Craig Carey" <research@ijs.co.nz> wrote:
>> On Thu, 09 Jan 2003 20:46:45 GMT, "James S. Rogers" wrote:
...

>It is true that global constants are safe to access.
>

E.g. constant pointers in linked list of nodes where each node is
 labelled with a Task_Id. Task can simultaneously traverse it safely.

To add a new node, some safer scheme is used.

If tasks correctly identify their own node and only write to that, then
parallel update also does not need to be protected.

Checks to see which nodes are no longer used, also do not need to be
protected.

An idea is that the function to find the Task_Id,
 "Ada.Task_Identification.Current_Task ()", is faster than protected
objects (and that is true of the GNAT 3.15_ implementation):

   RM C.7.1 The Package Task_Identification
     http://www.adaic.org/standards/95aarm/html/AA-C-7-1.html


>Furthermore, pragma Atomic() is really only useful on a uniprocessor system.

I notice the correction.

>There is no way to check Task_Id's and update or read a linked list
>element atomically. This entails at least two reads, or a read and a write.

Those words "is no way" seems to be inconsistent with these words:

 "global constants [that] are safe to access".

...
>> RM 9.10 defines "erroneous":
>>    http://www.adaic.org/standards/95aarm/html/AA-9-10.html
>
>Read that definition again. "Erroneous" execution is not a desired
>behavior.


That would be rejected using this argument.

RM 9.10, does not actually have extra words to differentiate between the
"updating" of, and the "reading" of, the "global constants" (may need to
add the constraint that the variables be genuinely 'volatile' (updates
are actually done before the next read).

RM9.10(11) uses the word "or" to have the same constraints on both the
idea of reading and writing ("updating"), be applied in an atomic action:

  "Given an action of assigning to an object, and an action of
   reading or updating a part of the same object ... is erroneous
   unless ...".

I thought Mr Rogers was trying to nail down this group as holding a
desire of preferring to avoid owning erroneous programs. To keep the
thread shorter, some corrective statement is appropriate.

[I didn't see text in the RM saying that Task_Id's should be uniquely
assigned over the life of the program.]


PS. Correction: 0x2000 bytes = 8192 bytes


Craig Carey

Some Ada 95 mailing lists: http://www.ijs.co.nz/ada_95.htm






  reply	other threads:[~2003-01-10 11:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-09 10:33 String library with garbage collection? I. Marks
2003-01-09 19:50 ` Craig Carey
2003-01-09 20:41   ` Craig Carey
2003-01-09 20:46   ` James S. Rogers
2003-01-10  0:14     ` Craig Carey
2003-01-10  3:52       ` James S. Rogers
2003-01-10 11:35         ` Craig Carey [this message]
2003-01-09 20:09 ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2003-01-09 11:04 Grein, Christoph
replies disabled

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