---
title: "Allocation without Locking"
authors:
  - "Andrew W. Appel"
year: 1989
venue: "Software: Practice and Experience 19(7), 703–705, July 1989 (also Princeton CS technical report TR-182-88, September 1988)"
arxiv: null
doi: "10.1002/spe.4380190704"
source: "https://www.cs.princeton.edu/~appel/papers/182.pdf"
version_reviewed: "Author's manuscript PDF (8 pages, dated November 1988) from Appel's Princeton papers page, read in full; the Wiley journal version was not reachable from the box"
topics:
  - "bump-allocation"
  - "thread-local-allocation"
  - "guard-pages"
  - "garbage-collection"
  - "lock-free-allocation"
  - "roll-forward"
  - "restartable-sequences"
seed_rank: 2755
seed_batch: "archive-2026-11-30"
reviewed: "2026-11-30"
pool: "systems"
relevance_score: 8
lineage: memory-allocators
cites:
  - title: "Allocation without Locking"
    url: "https://doi.org/10.1002/spe.4380190704"
    year: 1989
    arxiv: null
    doi: "10.1002/spe.4380190704"
  - title: "Allocation Without Locking (Princeton CS TR-182-88)"
    url: "https://www.cs.princeton.edu/research/techreps/710"
    year: 1988
    arxiv: null
    doi: null
  - title: "Garbage Collection Can Be Faster Than Stack Allocation"
    url: "https://doi.org/10.1016/0020-0190(87)90175-X"
    year: 1987
    arxiv: null
    doi: "10.1016/0020-0190(87)90175-X"
  - title: "Real-Time Concurrent Collection on Stock Multiprocessors"
    url: "https://doi.org/10.1145/53990.53992"
    year: 1988
    arxiv: null
    doi: "10.1145/53990.53992"
  - title: "List Processing in Real Time on a Serial Computer"
    url: "https://doi.org/10.1145/359460.359470"
    year: 1978
    arxiv: null
    doi: "10.1145/359460.359470"
  - title: "A Nonrecursive List Compacting Algorithm"
    url: "https://doi.org/10.1145/362790.362798"
    year: 1970
    arxiv: null
    doi: "10.1145/362790.362798"
  - title: "A Real-Time Garbage Collector Based on the Lifetimes of Objects"
    url: "https://doi.org/10.1145/358141.358147"
    year: 1983
    arxiv: null
    doi: "10.1145/358141.358147"
  - title: "Generation Scavenging: A Non-disruptive High Performance Storage Reclamation Algorithm"
    url: "https://doi.org/10.1145/800020.808261"
    year: 1984
    arxiv: null
    doi: "10.1145/800020.808261"
see:
  - "2525-a-nonrecursive-list-compacting-algorithm"
---

# Allocation without Locking

## One-sentence takeaway

In a copying-GC runtime, allocation is a bump of a free-space pointer kept in a register: four VAX instructions for a cons cell, with the limit check done by an inaccessible guard page. Appel keeps that cost with many threads, without a lock. Each thread gets its own free area. Every allocation writes its last word first, so the guard-page fault always fires before any partial state exists. If the collector catches a thread mid-allocation, it recognizes the stereotyped instruction sequence at the saved PC and *finishes* the allocation by interpreting those few instructions.

## Why it matters here

This three-page note is the ancestor of thread-local allocation buffers and of "make the critical section restartable instead of locking it". Linux `rseq` and per-CPU allocators revisit that idea, though they usually abort and retry rather than roll forward. For Anoptic's arenas and per-thread command buffers, the recipe transfers directly: a per-thread bump region, a guard page instead of a bounds check, and an allocation sequence restricted enough that a frame-boundary "flip" can always tell whether a thread was inside one and complete it. For ano, where standing rules allocate result rows every tick, it argues for a fixed, recognizable emission sequence per row, so a tick boundary never sees half-written rows. These bridges are this card's reading, and the `rseq` comparison is not made in the paper.

## Key ideas

- **Cost argument.** With copying or generational GC the amortized reclaim cost is about one instruction per cell. Allocation then dominates: Appel's Standard ML compiler allocates about once every 80 instructions, so cutting allocation from 20 instructions to 5 is roughly a 15% overall speedup.
- **Guard page as the limit test.** Map an inaccessible page right after the free area. Running past the end then becomes a segmentation fault that the runtime turns into a GC. Records are written last word first, so the first store is the one that traps, and nothing is half-initialized when it does. Records bigger than a page need a longer guard run, or a lock on the assumption that they are rare.
- **Per-thread free spaces.** Thread A allocates in space a and thread B in space b, so pre-emption between threads never sees a shared half-finished record. That removes allocator contention.
- **Roll-forward by interpretation.** The remaining hazard is a GC starting while a thread is mid-allocation, because the collector cannot tell initialized fields from garbage. Allocation uses only three instruction forms, which appear nowhere else: store at an offset from `fsp`, move `fsp` to a register, and add to `fsp`. The collector interprets instructions from the saved PC until the `add` and then proceeds. Some compilers also need stereotyped fetches.
- **Overhead.** Interpretation is about 20× slower than execution, but threads are inside an allocation only about 10% of the time, and then on average halfway through. The expected cleanup is about 23 instructions per suspended thread, paid only when a collection starts (only at a "flip" for a concurrent collector), against several instructions of locking on every one of, say, 10,000 allocations between collections.

## Caveats

This is a short note with an estimated cost model, not measurements. The ~23-instruction figure comes from assumed fractions (10% of time allocating, 5-instruction allocations). The scheme relies on compiler-controlled code generation: the allocation sequence must be stereotyped and recognizable from the PC, which rules out allocation through arbitrary library code. It assumes threads are suspended at instruction boundaries with registers the collector can read. On a real multiprocessor every running thread must also be stopped and inspected at a flip, which the note does not discuss. Instruction formats are VAX-specific. The rseq, TLAB, arena and ano bridges are this card's reading.

## Links

- DOI: https://doi.org/10.1002/spe.4380190704
- PDF (author's manuscript, Appel's papers page, as read): https://www.cs.princeton.edu/~appel/papers/182.pdf
- Princeton TR-182-88 record: https://www.cs.princeton.edu/research/techreps/710
- Princeton TR-182-88 PDF: https://www.cs.princeton.edu/techreports/1988/182.pdf
