A Garbage Collection Algorithm for Tricia
نویسنده
چکیده
We present a new algorithm for garbage collection of the term stack in David H. D. Warren's abstract Prolog machine (WAM). The algorithm exploits the possibilities of using a large address space, with special attention paid to virtual memory behaviour. The time required for the algorithm depends linearly on the size of the areas in which garbage is collected. Pseudo-code is given for the whole algorithm. It has been fully implemented in Tricia, a Prolog developed at UPMAIL for the DEC-2060 computer. 1. PROBLEM In languages with dynamic memory allocation it often happens that an instance of a data structure is not needed for the rest of the computation. Assuming that virtual memory is a limited resource (although it may be very large) it is desirable to be able to re-use such garbage structures. Placing the responsibility of returning garbage on the programmer is a too heavy burden for non-trivial programs so it should be mechanized and invisible to the programmer. In modern abstract Prolog machines, such as WAM 19] or ZIP 8] some garbage collection is built into the machine itself. On backtracking, allocated memory in the environment and term stacks is immediately reclaimed. In addition, environment stack memory is reclaimed during deterministic execution and tail-recursive calls. These and other peculiarities of Prolog machines have to be considered when writing a garbage collector, or it is likely to be ineecient in time and/or space. A garbage collection algorithm for WAM or a similar machine must have the following properties: 1. The garbage collected term stack must be compactiied. 2. The order of objects in the term stack must be preserved, at least within each term stack segment. (A term stack segment is deened as the part of the term stack allocated between two subsequent choice points. Environment stack segment and trail segment are deenied analogously.) This criterion rules out many LISP garbage collectors. 3. Non-atomic objects may be of arbitrary size. 4. There may be pointers with diierent tags to the same address. The standard example is a list whose head is an unbound variable. Both variable and list-tagged pointers to the rst word of the list object may appear. This can be avoided, at a price, by always moving unbound variables out of lists and other compound terms. There may be other reasons than garbage collection to do this 7]. The ideal garbage collection would progress in parallel …
منابع مشابه
A Non-blocking Snapshot Algorithm for Distributed Garbage Collection of Mobile Active Objects
Distributed actor garbage collection differs from distributed object garbage collection in that it needs to consider in-transit message detection, unordered message reception, and actor migration. In this paper, we propose a new snapshot-based distributed actor garbage collection algorithm. The algorithm does not require First-In-First-Out or blocking communication, nor message logging. Further...
متن کاملDistributed from The Derivation of Termination Detection Algorithms Garbage Collection Schemes
A b s t r a c t . It is shown that the termination detection problem for distributed computations can be modeled as an instance of the garbage collection problem. Consequently, algorithms for the termination detection problem are obtained by applying trausformations to garbage collection algorithms. The transformation can be applied to collectors of the "mark-and-sweep" type as well as to refer...
متن کاملCyclic Distributed Garbage Collection Without Global Synchronization in CORBA
1 Abstract This paper describes an algorithm for cyclic distributed garbage collection and its implementation. The algorithm is an extension of reference-listing that collects cyclic garbage. It uses back-tracing instead of mark-and-sweep to eliminate the need of global synchronization. First, by using a special heuristic the algorithm chooses an object that is likely to be garbage (suspect). T...
متن کاملCache Performance of Chronological Garbage Collection
This paper will present the cache performance analysis of Chronological Garbage Collection algorithm used in the LVM system. The LVM is a new Logic Virtual Machine for Prolog. It adopts one stack policy for all dynamic memory requirements and cooperates with an efficient garbage collection algorithm, the Chronological Garbage Collection, to recuperate space not as deliberate garbage collection ...
متن کاملPerDiS PPF Case Study: Fitting a Distributed Garbage Collection Algorithm to a Persistent Distributed Store Architecture
Several garbage collection algorithms exist, but it is not always straightforward to adapt them to a given platform. In this article, we describe our work to t a distributed garbage collection algorithm to a persistent distributed store called PerDiS. We pinpoint ordering and consistency problems, and present the way we solved them. We also address the dilemma of performance versus modularity.
متن کامل