From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!inmet!stt From: stt@inmet.inmet.com Newsgroups: comp.lang.ada Subject: Re: Interpretation of LRM 13.10.1 Message-ID: <20600035@inmet> Date: 2 Mar 90 18:21:00 GMT References: <11249@encore.Encore.COM> Nf-ID: #R:encore.Encore.COM:11249:inmet:20600035:000:1755 Nf-From: inmet.inmet.com!stt Mar 2 13:21:00 1990 List-Id: 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