comp.lang.ada
 help / color / mirror / Atom feed
From: stt@inmet.inmet.com
Subject: Re: Interpretation of LRM 13.10.1
Date: 2 Mar 90 18:21:00 GMT	[thread overview]
Message-ID: <20600035@inmet> (raw)
In-Reply-To: 11249@encore.Encore.COM


With regard to reclaiming storage for a terminated task:

It is useful to distinguish between a "task object" and
a "task".  A "task object" designates a task.  An access type
designates a task object (or a record/array object containing
a task object).  When you perform an unchecked deallocation,
the space for the task object may be reclaimed, and it is erroneous
if some other access value is later used to try to refer
to this task object.  Therefore, it *is* legitimate for
an implementation to free *all* storage associated with a terminated
*task* when the task object is freed (Sorry not to agree with you Jerry!).

However, it is *not* legitimate to free the storage associated
with a task with live sub-tasks (i.e. "completed" but not "terminated"),
nor is it permissible to implicitly abort a non-completed
task when its task object is freed.

Using a relatively simple trick, it is actually possible to
free the space devoted to a task as soon as it terminates,
even if its task object still exists.  The trick is
to store a "generation number" within the task control block,
and bump that number when reusing the TCB for a new task.
The same generation number is stored with the task object,
and a task is considered terminated if the generation number
in its task object doesn't match the generation number in
the TCB it points at.

By the way, the ARG (Ada Rapporteur(sp?) Group) recently decided to reverse
an earlier decision, and consider a reference to a task
outside of its scope as erroneous (the dreaded task-returning function
problem).  This means that TCBs can be reclaimed when the task object's
scope is exited, at the latest.

S. Tucker Taft     stt%inmet@uunet.uu.net; uunet!inmet!stt
Intermetrics, Inc.
Cambridge, MA  02138

  reply	other threads:[~1990-03-02 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-02-23 15:48 Interpretation of LRM 13.10.1 "Fred Zwarts, KVI, Groningen, NL."
1990-02-27 15:50 ` Jerry Callen
1990-03-02 18:21   ` stt [this message]
1990-03-05 17:01     ` John Goodenough
1990-02-27 19:47 ` Loren Louis Hart
  -- strict thread matches above, loose matches on Subject: below --
1990-02-27 14:15 Mats Weber
1990-02-27 14:51 "Norman H. Cohen"
replies disabled

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