paper

On-the-Fly Garbage Collection: An Exercise in Cooperation

  • Authors:

📜 Abstract

As an example of cooperation between sequential processes with very little mutual interference despite frequent manipulations of a large shared data space, a technique is developed which allows nearly all of the activity needed for garbage detection and collection to be performed by an additional processor operating concurrently with the processor devoted to the computation proper. Exclusion and synchronization constraints have been kept as weak as could be achieved; the severe complexities engendered by doing so are illustrated.

✨ Summary

The paper develops and informally justifies a concurrent, fine-grained garbage-collection algorithm for a Lisp-like directed graph. A collector marks reachable nodes while a mutator simultaneously modifies the graph, with synchronization restricted to small atomic operations rather than a global stop-the-world pause. The design uses white, gray, and black node states, a rooted free list, and invariants that ensure two properties: garbage is eventually reclaimed, and the collector changes the graph only when appending confirmed garbage to the free list. The authors first construct a coarse-grained algorithm, expose and discard an incorrect finer-grained attempt, then derive a correct fine-grained version using propagation paths and auxiliary “C-edges” to preserve the required invariants during arbitrary interleavings. The paper emphasizes that concurrent algorithms require rigorous state-based reasoning because plausible designs can contain subtle safety and liveness errors.

The work is identified by Microsoft Research as the first concurrent garbage-collection algorithm, and it influenced subsequent research on on-the-fly collection, including Mordechai Ben-Ari’s algorithms derived from program proofs and later work on formal verification of concurrent collectors. (microsoft.com) Its conceptual heritage also appears in production software: the Go runtime documentation explicitly cites Dijkstra’s algorithm as part of the intellectual heritage of Go’s concurrent garbage collector. (tip.golang.org)