comp.lang.ada
 help / color / mirror / Atom feed
* Re: Making a package safe for use by multiple tasks
@ 2002-06-07 10:14 Grein, Christoph
  2002-06-07 10:29 ` Alexander Boucke
  0 siblings, 1 reply; 11+ messages in thread
From: Grein, Christoph @ 2002-06-07 10:14 UTC (permalink / raw)


From: "Alexander Boucke" <alexb@lufmech.rwth-aachen.de>
 
> idea, how this could be dealt with. The idea is, that every task needs to
> have it's own temporary object. But I have no idea how this could be be
> achieved in an automatic or semi-automatic way.

See RM C.7.2 Task Attributes



^ permalink raw reply	[flat|nested] 11+ messages in thread
* Making a package safe for use by multiple tasks
@ 2002-06-07 10:07 Alexander Boucke
  2002-06-07 11:11 ` Marc A. Criley
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Alexander Boucke @ 2002-06-07 10:07 UTC (permalink / raw)


Hello!

I am just playing with the idea to use multiple tasks in a programm doing
linear algebra. The problem lies in my vector-algebra package, that uses
some global tmp-object to optimize memory use and reuse. To give you the
idea, some not necessarily correct code snippets what this is doing:

in the spec:

type values is array (<>) or real;
type vector is access values;

function "+" (left, right : vector) return vector;

in the body:

tmp_vec : vector;

function "+" (left, right : vector) return vector is
begin
   -- test here, if the tmp_vec is of correct size and allocated
   for i in tmp_vec'range loop
      tmp_vec(i) := left(i) + right(i);
   end loop;
   return tmp_vec;
end "+";

I hope this gives you the idea. In fact it is a little more complicated,
since I do reference counting on the vectors. The thing with the tmp_vec
enables me to reuse this vector several times, e.g. in d := a + b + c it is
not necessary to allocate it new every time, I could just overwrite tmp_vec
here.

This is of course not usable if I use more then one task! And converting the
whole thing in some kind of protected type is certainly not very useful,
since this would it would not allow parallel execution of vector operations
then.

Except of getting rid of these tmp_vec things, does anybody of you have an
idea, how this could be dealt with. The idea is, that every task needs to
have it's own temporary object. But I have no idea how this could be be
achieved in an automatic or semi-automatic way.

Thanks,

Alexander





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-06-08 13:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07 10:14 Making a package safe for use by multiple tasks Grein, Christoph
2002-06-07 10:29 ` Alexander Boucke
  -- strict thread matches above, loose matches on Subject: below --
2002-06-07 10:07 Alexander Boucke
2002-06-07 11:11 ` Marc A. Criley
2002-06-07 11:47   ` Alexander Boucke
2002-06-07 13:31 ` Dr. Michael Paus
2002-06-07 15:00 ` Ted Dennison
2002-06-07 16:37 ` Georg Bauhaus
2002-06-07 21:16 ` Jeffrey Carter
2002-06-08 13:14   ` Craig Carey
2002-06-08 13:39     ` Dr. Michael Paus

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