|
|
xv | |
|
|
xix | |
|
|
xxi | |
Preface |
|
xxiii | |
Acknowledgements |
|
xxvii | |
Authors |
|
xxix | |
|
|
1 | (16) |
|
1.1 Explicit deallocation |
|
|
2 | (1) |
|
1.2 Automatic dynamic memory management |
|
|
3 | (2) |
|
1.3 Comparing garbage collection algorithms |
|
|
5 | (4) |
|
|
6 | (1) |
|
|
6 | (1) |
|
Completeness and promptness |
|
|
6 | (1) |
|
|
7 | (1) |
|
|
8 | (1) |
|
Optimisations for specific languages |
|
|
8 | (1) |
|
Scalability and portability |
|
|
9 | (1) |
|
1.4 A performance disadvantage? |
|
|
9 | (1) |
|
1.5 Experimental methodology |
|
|
10 | (1) |
|
1.6 Terminology and notation |
|
|
11 | (6) |
|
|
11 | (1) |
|
The mutator and the collector |
|
|
12 | (1) |
|
|
12 | (1) |
|
References, fields and addresses |
|
|
13 | (1) |
|
Liveness, correctness and reachability |
|
|
13 | (1) |
|
|
14 | (1) |
|
|
14 | (1) |
|
Mutator read and write operations |
|
|
14 | (1) |
|
|
15 | (1) |
|
Sets, multisets, sequences and tuples |
|
|
15 | (2) |
|
2 Mark-sweep garbage collection |
|
|
17 | (14) |
|
2.1 The mark-sweep algorithm |
|
|
18 | (2) |
|
2.2 The tricolour abstraction |
|
|
20 | (1) |
|
|
21 | (1) |
|
|
22 | (2) |
|
|
24 | (3) |
|
2.6 Cache misses in the marking loop |
|
|
27 | (2) |
|
|
29 | (2) |
|
|
29 | (1) |
|
|
29 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
3 Mark-compact garbage collection |
|
|
31 | (12) |
|
3.1 Two-finger compaction |
|
|
32 | (2) |
|
|
34 | (2) |
|
|
36 | (2) |
|
|
38 | (2) |
|
|
40 | (3) |
|
|
40 | (1) |
|
Throughput costs of compaction |
|
|
41 | (1) |
|
|
41 | (1) |
|
|
41 | (1) |
|
Limitations of mark-compact algorithms |
|
|
42 | (1) |
|
4 Copying garbage collection |
|
|
43 | (14) |
|
4.1 Semispace copying collection |
|
|
43 | (3) |
|
Work list implementations |
|
|
44 | (2) |
|
|
46 | (1) |
|
4.2 Traversal order and locality |
|
|
46 | (7) |
|
|
53 | (4) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
55 | (2) |
|
|
57 | (20) |
|
5.1 Advantages and disadvantages of reference counting |
|
|
58 | (2) |
|
|
60 | (1) |
|
5.3 Deferred reference counting |
|
|
61 | (2) |
|
5.4 Coalesced reference counting |
|
|
63 | (3) |
|
5.5 Cyclic reference counting |
|
|
66 | (6) |
|
5.6 Limited-field reference counting |
|
|
72 | (1) |
|
|
73 | (4) |
|
|
73 | (1) |
|
|
74 | (3) |
|
6 Comparing garbage collectors |
|
|
77 | (10) |
|
|
77 | (1) |
|
|
78 | (1) |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
80 | (1) |
|
6.6 A unified theory of garbage collection |
|
|
80 | (7) |
|
Abstract garbage collection |
|
|
81 | (1) |
|
Tracing garbage collection |
|
|
81 | (1) |
|
Reference counting garbage collection |
|
|
82 | (5) |
|
|
87 | (16) |
|
7.1 Sequential allocation |
|
|
87 | (1) |
|
|
88 | (5) |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
90 | (2) |
|
Speeding free-list allocation |
|
|
92 | (1) |
|
|
93 | (1) |
|
7.4 Segregated-fits allocation |
|
|
93 | (3) |
|
|
95 | (1) |
|
|
95 | (1) |
|
7.5 Combining segregated-fits with first-, best- and next-fit |
|
|
96 | (1) |
|
7.6 Additional considerations |
|
|
97 | (4) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
98 | (2) |
|
|
100 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
7.7 Allocation in concurrent systems |
|
|
101 | (1) |
|
|
102 | (1) |
|
|
103 | (8) |
|
|
103 | (1) |
|
|
103 | (5) |
|
|
104 | (1) |
|
|
104 | (1) |
|
|
104 | (1) |
|
|
105 | (1) |
|
|
105 | (1) |
|
Partitioning for responsiveness |
|
|
106 | (1) |
|
Partitioning for locality |
|
|
106 | (1) |
|
|
107 | (1) |
|
Partitioning by availability |
|
|
107 | (1) |
|
Partitioning by mutability |
|
|
108 | (1) |
|
|
108 | (1) |
|
|
109 | (2) |
|
9 Generational garbage collection |
|
|
111 | (26) |
|
|
112 | (1) |
|
|
113 | (1) |
|
9.3 Generational hypotheses |
|
|
113 | (1) |
|
9.4 Generations and heap layout |
|
|
114 | (1) |
|
|
115 | (1) |
|
|
116 | (5) |
|
|
116 | (1) |
|
|
116 | (3) |
|
Survivor spaces and flexibility |
|
|
119 | (2) |
|
9.7 Adapting to program behaviour |
|
|
121 | (2) |
|
Appel-style garbage collection |
|
|
121 | (2) |
|
Feedback controlled promotion |
|
|
123 | (1) |
|
9.8 Inter-generational pointers |
|
|
123 | (3) |
|
|
124 | (1) |
|
|
125 | (1) |
|
|
126 | (1) |
|
9.10 Older-first garbage collection |
|
|
127 | (3) |
|
|
130 | (2) |
|
9.12 Analytic support for generational collection |
|
|
132 | (1) |
|
|
133 | (1) |
|
9.14 Abstract generational garbage collection |
|
|
134 | (3) |
|
10 Other partitioned schemes |
|
|
137 | (24) |
|
|
137 | (3) |
|
The Treadmill garbage collector |
|
|
138 | (1) |
|
Moving objects with operating system support |
|
|
139 | (1) |
|
|
140 | (1) |
|
10.2 Topological collectors |
|
|
140 | (9) |
|
Mature object space garbage collection |
|
|
140 | (3) |
|
Connectivity-based garbage collection |
|
|
143 | (1) |
|
Thread-local garbage collection |
|
|
144 | (3) |
|
|
147 | (1) |
|
|
148 | (1) |
|
10.3 Hybrid mark-sweep, copying collectors |
|
|
149 | (7) |
|
|
150 | (1) |
|
|
151 | (3) |
|
Copying collection in a constrained memory space |
|
|
154 | (2) |
|
10.4 Bookmarking garbage collection |
|
|
156 | (1) |
|
10.5 Ulterior reference counting |
|
|
157 | (1) |
|
|
158 | (3) |
|
|
161 | (52) |
|
11.1 Interface to allocation |
|
|
161 | (5) |
|
|
164 | (1) |
|
|
165 | (1) |
|
|
166 | (18) |
|
Conservative pointer finding |
|
|
166 | (2) |
|
Accurate pointer finding using tagged values |
|
|
168 | (1) |
|
Accurate pointer finding in objects |
|
|
169 | (2) |
|
Accurate pointer finding in global roots |
|
|
171 | (1) |
|
Accurate pointer finding in stacks and registers |
|
|
171 | (10) |
|
Accurate pointer finding in code |
|
|
181 | (1) |
|
Handling interior pointers |
|
|
182 | (1) |
|
Handling derived pointers |
|
|
183 | (1) |
|
|
184 | (1) |
|
11.4 References from external code |
|
|
185 | (1) |
|
|
186 | (1) |
|
11.6 GC-safe points and mutator suspension |
|
|
187 | (3) |
|
11.7 Garbage collecting code |
|
|
190 | (1) |
|
11.8 Read and write barriers |
|
|
191 | (12) |
|
|
191 | (1) |
|
Precision of write barriers |
|
|
192 | (2) |
|
|
194 | (1) |
|
|
195 | (1) |
|
|
196 | (1) |
|
|
197 | (2) |
|
|
199 | (2) |
|
|
201 | (1) |
|
Hardware and virtual memory techniques |
|
|
202 | (1) |
|
Write barrier mechanisms: in summary |
|
|
202 | (1) |
|
|
203 | (1) |
|
11.9 Managing address space |
|
|
203 | (2) |
|
11.10 Applications of virtual memory page protection |
|
|
205 | (3) |
|
|
206 | (1) |
|
Applications of no-access pages |
|
|
206 | (2) |
|
|
208 | (2) |
|
|
210 | (3) |
|
12 Language-specific concerns |
|
|
213 | (16) |
|
|
213 | (8) |
|
|
214 | (1) |
|
Which thread runs a finaliser? |
|
|
215 | (1) |
|
Can finalisers run concurrently with each other? |
|
|
216 | (1) |
|
Can finalisers access the object that became unreachable? |
|
|
216 | (1) |
|
When are finalised objects reclaimed? |
|
|
216 | (1) |
|
What happens if there is an error in a finaliser? |
|
|
217 | (1) |
|
Is there any guaranteed order to finalisation? |
|
|
217 | (1) |
|
The finalisation race problem |
|
|
218 | (1) |
|
|
219 | (1) |
|
Finalisation in particular languages |
|
|
219 | (2) |
|
|
221 | (1) |
|
|
221 | (7) |
|
|
222 | (1) |
|
Supporting multiple pointer strengths |
|
|
223 | (2) |
|
Using Phantom objects to control finalisation order |
|
|
225 | (1) |
|
Race in weak pointer clearing |
|
|
226 | (1) |
|
Notification of weak pointer clearing |
|
|
226 | (1) |
|
Weak pointers in other languages |
|
|
226 | (2) |
|
|
228 | (1) |
|
13 Concurrency preliminaries |
|
|
229 | (46) |
|
|
229 | (5) |
|
|
229 | (1) |
|
|
230 | (1) |
|
|
231 | (1) |
|
|
231 | (1) |
|
|
232 | (1) |
|
Cache coherence performance example: spin locks |
|
|
232 | (2) |
|
13.2 Hardware memory consistency |
|
|
234 | (3) |
|
Fences and happens-before |
|
|
236 | (1) |
|
|
236 | (1) |
|
|
237 | (6) |
|
|
237 | (1) |
|
Load-linked/store-conditionally |
|
|
238 | (2) |
|
Atomic arithmetic primitives |
|
|
240 | (1) |
|
|
240 | (1) |
|
|
240 | (2) |
|
Overheads of atomic primitives |
|
|
242 | (1) |
|
|
243 | (2) |
|
Progress guarantees and concurrent collection |
|
|
244 | (1) |
|
13.5 Notation used for concurrent algorithms |
|
|
245 | (1) |
|
|
246 | (2) |
|
13.7 Work sharing and termination detection |
|
|
248 | (5) |
|
|
251 | (2) |
|
13.8 Concurrent data structures |
|
|
253 | (14) |
|
|
256 | (1) |
|
Concurrent queue implemented with singly linked list |
|
|
256 | (5) |
|
Concurrent queue implemented with array |
|
|
261 | (6) |
|
A concurrent deque for work stealing |
|
|
267 | (1) |
|
13.9 Transactional memory |
|
|
267 | (6) |
|
What is transactional memory? |
|
|
267 | (3) |
|
Using transactional memory to help implement collection |
|
|
270 | (2) |
|
Supporting transactional memory in the presence of garbage collection |
|
|
272 | (1) |
|
|
273 | (2) |
|
14 Parallel garbage collection |
|
|
275 | (32) |
|
14.1 Is there sufficient work to parallelise? |
|
|
276 | (1) |
|
|
277 | (1) |
|
|
278 | (1) |
|
|
279 | (1) |
|
|
279 | (10) |
|
Processor-centric techniques |
|
|
280 | (9) |
|
|
289 | (10) |
|
Processor-centric techniques |
|
|
289 | (5) |
|
Memory-centric techniques |
|
|
294 | (5) |
|
|
299 | (1) |
|
|
299 | (3) |
|
|
302 | (5) |
|
|
302 | (1) |
|
Is parallel collection worthwhile? |
|
|
303 | (1) |
|
Strategies for balancing loads |
|
|
303 | (1) |
|
|
303 | (2) |
|
Low-level synchronisation |
|
|
305 | (1) |
|
|
305 | (1) |
|
|
306 | (1) |
|
15 Concurrent garbage collection |
|
|
307 | (16) |
|
15.1 Correctness of concurrent collection |
|
|
309 | (6) |
|
The tricolour abstraction, revisited |
|
|
309 | (1) |
|
|
310 | (2) |
|
The strong and weak tricolour invariants |
|
|
312 | (1) |
|
|
313 | (1) |
|
|
313 | (1) |
|
|
314 | (1) |
|
Incremental update solutions |
|
|
314 | (1) |
|
Snapshot-at-the-beginning solutions |
|
|
314 | (1) |
|
15.2 Barrier techniques for concurrent collection |
|
|
315 | (6) |
|
|
315 | (2) |
|
|
317 | (1) |
|
Completeness of barrier techniques |
|
|
317 | (1) |
|
Concurrent write barrier mechanisms |
|
|
318 | (1) |
|
|
319 | (1) |
|
|
319 | (1) |
|
|
320 | (1) |
|
|
321 | (2) |
|
|
323 | (14) |
|
|
323 | (1) |
|
|
324 | (1) |
|
|
325 | (1) |
|
16.4 Concurrent marking and sweeping |
|
|
326 | (2) |
|
|
328 | (3) |
|
Write barriers for on-the-fly collection |
|
|
328 | (1) |
|
|
329 | (1) |
|
Doligez-Leroy-Gonthier for Java |
|
|
330 | (1) |
|
|
331 | (1) |
|
16.6 Abstract concurrent collection |
|
|
331 | (4) |
|
|
334 | (1) |
|
|
334 | (1) |
|
|
334 | (1) |
|
|
334 | (1) |
|
|
335 | (1) |
|
|
335 | (2) |
|
17 Concurrent copying & compaction |
|
|
337 | (26) |
|
17.1 Mostly-concurrent copying: Baker's algorithm |
|
|
337 | (3) |
|
Mostly-concurrent, mostly-copying collection |
|
|
338 | (2) |
|
17.2 Brooks's indirection barrier |
|
|
340 | (1) |
|
17.3 Self-erasing read barriers |
|
|
340 | (1) |
|
|
341 | (1) |
|
17.5 Multi-version copying |
|
|
342 | (3) |
|
Extensions to avoid copy-on-write |
|
|
344 | (1) |
|
|
345 | (6) |
|
|
346 | (5) |
|
|
351 | (1) |
|
|
351 | (1) |
|
17.7 Concurrent compaction |
|
|
351 | (10) |
|
|
352 | (3) |
|
|
355 | (6) |
|
|
361 | (2) |
|
18 Concurrent reference counting |
|
|
363 | (12) |
|
18.1 Simple reference counting revisited |
|
|
363 | (3) |
|
18.2 Buffered reference counting |
|
|
366 | (1) |
|
18.3 Concurrent, cyclic reference counting |
|
|
366 | (2) |
|
18.4 Taking a snapshot of the heap |
|
|
368 | (1) |
|
18.5 Sliding views reference counting |
|
|
369 | (5) |
|
|
370 | (1) |
|
|
370 | (2) |
|
Sliding views cycle reclamation |
|
|
372 | (1) |
|
|
373 | (1) |
|
|
374 | (1) |
|
19 Real-time garbage collection |
|
|
375 | (44) |
|
|
375 | (1) |
|
19.2 Scheduling real-time collection |
|
|
376 | (1) |
|
19.3 Work-based real-time collection |
|
|
377 | (9) |
|
Parallel, concurrent replication |
|
|
377 | (7) |
|
Uneven work and its impact on work-based scheduling |
|
|
384 | (2) |
|
19.4 Slack-based real-time collection |
|
|
386 | (5) |
|
Scheduling the collector work |
|
|
389 | (1) |
|
|
390 | (1) |
|
|
391 | (1) |
|
19.5 Time-based real-time collection: Metronome |
|
|
391 | (8) |
|
|
391 | (2) |
|
Supporting predictability |
|
|
393 | (2) |
|
|
395 | (4) |
|
|
399 | (1) |
|
19.6 Combining scheduling approaches: Tax-and-Spend |
|
|
399 | (4) |
|
|
400 | (1) |
|
Tax-and-Spend prerequisites |
|
|
401 | (2) |
|
19.7 Controlling fragmentation |
|
|
403 | (12) |
|
Incremental compaction in Metronome |
|
|
404 | (1) |
|
Incremental replication on uniprocessors |
|
|
405 | (1) |
|
Stopless: lock-free garbage collection |
|
|
406 | (1) |
|
Staccato: best-effort compaction with mutator wait-freedom |
|
|
407 | (3) |
|
Chicken: best-effort compaction with mutator wait-freedom for x86 |
|
|
410 | (1) |
|
Clover: guaranteed compaction with probabilistic mutator lock-freedom |
|
|
410 | (2) |
|
Stopless versus Chicken versus Clover |
|
|
412 | (1) |
|
|
412 | (3) |
|
|
415 | (4) |
Glossary |
|
419 | (14) |
Bibliography |
|
433 | (36) |
Index |
|
469 | |