comp.lang.ada
 help / color / mirror / Atom feed
* Task storage size
@ 2003-07-29 12:33 Martin Dowie
  2003-07-29 20:30 ` Robert I. Eachus
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Dowie @ 2003-07-29 12:33 UTC (permalink / raw)


How can I create many instances of a task type with different Storage_Size
values?

I can set the priority of each by parameterizing the task type, e.g.

task type A_Task (Priority : System.Priority := System.Default_Priority);

but I can't see any way of having different Storage_Size's...






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

* Re: Task storage size
  2003-07-29 12:33 Task storage size Martin Dowie
@ 2003-07-29 20:30 ` Robert I. Eachus
  2003-07-30  7:36   ` Martin Dowie
  2003-07-30 19:15   ` Randy Brukardt
  0 siblings, 2 replies; 5+ messages in thread
From: Robert I. Eachus @ 2003-07-29 20:30 UTC (permalink / raw)


Martin Dowie wrote:
> How can I create many instances of a task type with different Storage_Size
> values?
> 
> I can set the priority of each by parameterizing the task type, e.g.
> task type A_Task (Priority : System.Priority := System.Default_Priority);
> but I can't see any way of having different Storage_Size's...

You can't.

But what are you trying to do? Usually if you have lots of tasks and 
need to manage their storage you put the larger objects on the heap. I'd 
be interested in seeing what you are doing, if you do need different 
stack sizes for some reason.

Some implementations may have a local heap for each task, but if your 
implementation does, then you can create storage pools that are program 
wide.  However, I usually find that when I am creating large objects in 
tasks, they have to be on the system heap, since the type outlasts the task.

-- 
"As far as I'm concerned, war always means failure." -- Jacques Chirac, 
President of France
"As far as France is concerned, you're right." -- Rush Limbaugh




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

* Re: Task storage size
  2003-07-29 20:30 ` Robert I. Eachus
@ 2003-07-30  7:36   ` Martin Dowie
  2003-07-30 19:15   ` Randy Brukardt
  1 sibling, 0 replies; 5+ messages in thread
From: Martin Dowie @ 2003-07-30  7:36 UTC (permalink / raw)


"Robert I. Eachus" <rieachus@attbi.com> wrote in message
news:3F26D939.3030003@attbi.com...
> Martin Dowie wrote:
> > How can I create many instances of a task type with different
Storage_Size
> > values?
> >
> > I can set the priority of each by parameterizing the task type, e.g.
> > task type A_Task (Priority : System.Priority :=
System.Default_Priority);
> > but I can't see any way of having different Storage_Size's...
>
> You can't.

Didn't think so :-(

> But what are you trying to do? Usually if you have lots of tasks and
> need to manage their storage you put the larger objects on the heap. I'd
> be interested in seeing what you are doing, if you do need different
> stack sizes for some reason.
>
> Some implementations may have a local heap for each task, but if your
> implementation does, then you can create storage pools that are program
> wide.  However, I usually find that when I am creating large objects in
> tasks, they have to be on the system heap, since the type outlasts the
task.

I have a number of tasks that service a number of (almost) identical
devices. The
devices return sensor data, some return _lots_ of data other hardly any. The
actual
processing for each device is _almost_ the same - hence the hope of using a
single
task type. Actually it is a task type in a generic - so that a callback can
provide
to slightly different processing required.

I think what I'll do is instantiate different versions with different
Storage_Size's but
with all remaining generic formal parameters the same. Not ideal but it will
do.

Cheers





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

* Re: Task storage size
  2003-07-29 20:30 ` Robert I. Eachus
  2003-07-30  7:36   ` Martin Dowie
@ 2003-07-30 19:15   ` Randy Brukardt
  2003-07-31  7:35     ` Martin Dowie
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Brukardt @ 2003-07-30 19:15 UTC (permalink / raw)


"Robert I. Eachus" <rieachus@attbi.com> wrote in message
news:3F26D939.3030003@attbi.com...
> Martin Dowie wrote:
> > How can I create many instances of a task type with different
Storage_Size
> > values?
> >
> > I can set the priority of each by parameterizing the task type, e.g.
> > task type A_Task (Priority : System.Priority :=
System.Default_Priority);
> > but I can't see any way of having different Storage_Size's...
>
> You can't.

Huh? You do it the same why that you parameterize by Priorities:

    task type Foobar (My_Storage_Size : Natural) is
        pragma Storage_Size (My_Storage_Size);
        ...
    end Foobar;

See 13.3(62-64).

You couldn't do it in Ada 83, of course, but you certainly can in Ada 95.

                   Randy.







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

* Re: Task storage size
  2003-07-30 19:15   ` Randy Brukardt
@ 2003-07-31  7:35     ` Martin Dowie
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Dowie @ 2003-07-31  7:35 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> wrote in message
news:vig67ci599jq99@corp.supernews.com...
> > You can't.
>
> Huh? You do it the same why that you parameterize by Priorities:
>
>     task type Foobar (My_Storage_Size : Natural) is
>         pragma Storage_Size (My_Storage_Size);
>         ...
>     end Foobar;
>
> See 13.3(62-64).
>
> You couldn't do it in Ada 83, of course, but you certainly can in Ada 95.

Just the ticket! Thanks!!





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

end of thread, other threads:[~2003-07-31  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29 12:33 Task storage size Martin Dowie
2003-07-29 20:30 ` Robert I. Eachus
2003-07-30  7:36   ` Martin Dowie
2003-07-30 19:15   ` Randy Brukardt
2003-07-31  7:35     ` Martin Dowie

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