Incremental Garbage Collection Part II Roland Schatz Incremental - - PowerPoint PPT Presentation

incremental garbage collection
SMART_READER_LITE
LIVE PREVIEW

Incremental Garbage Collection Part II Roland Schatz Incremental - - PowerPoint PPT Presentation

Incremental Garbage Collection Part II Roland Schatz Incremental Garbage Collection p.1/22 Baker Disadvantages not concurrent Incremental Garbage Collection p.2/22 Baker Disadvantages not concurrent not even threadsafe


slide-1
SLIDE 1

Incremental Garbage Collection

Part II

Roland Schatz

Incremental Garbage Collection – p.1/22

slide-2
SLIDE 2

Baker – Disadvantages

not concurrent

Incremental Garbage Collection – p.2/22

slide-3
SLIDE 3

Baker – Disadvantages

not concurrent not even threadsafe

Incremental Garbage Collection – p.2/22

slide-4
SLIDE 4

Baker – Disadvantages

not concurrent not even threadsafe expensive read trap

Incremental Garbage Collection – p.2/22

slide-5
SLIDE 5

Baker – Disadvantages

not concurrent not even threadsafe expensive read trap requires hardware support

Incremental Garbage Collection – p.2/22

slide-6
SLIDE 6

Appel-Ellis-Li Collector

no black ⇒ white pointers

Incremental Garbage Collection – p.3/22

slide-7
SLIDE 7

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant

Incremental Garbage Collection – p.3/22

slide-8
SLIDE 8

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant mutator never sees white pointers

Incremental Garbage Collection – p.3/22

slide-9
SLIDE 9

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant mutator never sees white pointers intercept all pointer reads

Incremental Garbage Collection – p.3/22

slide-10
SLIDE 10

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant mutator never sees white pointers intercept all pointer reads slightly stricter constraint

Incremental Garbage Collection – p.3/22

slide-11
SLIDE 11

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant mutator never sees white pointers intercept all pointer reads slightly stricter constraint mutator only sees black objects

Incremental Garbage Collection – p.3/22

slide-12
SLIDE 12

Appel-Ellis-Li Collector

no black ⇒ white pointers Baker’s invariant mutator never sees white pointers intercept all pointer reads slightly stricter constraint mutator only sees black objects use page protection hardware

Incremental Garbage Collection – p.3/22

slide-13
SLIDE 13

Memory Layout

fromspace

potential garbage

start

tospace

scanned objects scanned unscanned objects unscanned free space alloc new objects end

Incremental Garbage Collection – p.4/22

slide-14
SLIDE 14

Page Protection

black pages

Incremental Garbage Collection – p.5/22

slide-15
SLIDE 15

Page Protection

black pages contain only tospace pointers

Incremental Garbage Collection – p.5/22

slide-16
SLIDE 16

Page Protection

black pages contain only tospace pointers no problem

Incremental Garbage Collection – p.5/22

slide-17
SLIDE 17

Page Protection

black pages contain only tospace pointers no problem white pages

Incremental Garbage Collection – p.5/22

slide-18
SLIDE 18

Page Protection

black pages contain only tospace pointers no problem white pages mutator never sees white pointers

Incremental Garbage Collection – p.5/22

slide-19
SLIDE 19

Page Protection

black pages contain only tospace pointers no problem white pages mutator never sees white pointers so we don’t care

Incremental Garbage Collection – p.5/22

slide-20
SLIDE 20

Page Protection

gray pages

Incremental Garbage Collection – p.6/22

slide-21
SLIDE 21

Page Protection

gray pages mutator may see gray pointers

Incremental Garbage Collection – p.6/22

slide-22
SLIDE 22

Page Protection

gray pages mutator may see gray pointers mutator must not see gray objects

Incremental Garbage Collection – p.6/22

slide-23
SLIDE 23

Page Protection

gray pages mutator may see gray pointers mutator must not see gray objects set to no access

Incremental Garbage Collection – p.6/22

slide-24
SLIDE 24

Handling Page Faults

Mutator Tospace before the trap Read barrier

Incremental Garbage Collection – p.7/22

slide-25
SLIDE 25

Handling Page Faults

Mutator Tospace before the trap Read barrier

Incremental Garbage Collection – p.7/22

slide-26
SLIDE 26

Handling Page Faults

Mutator Tospace before the trap Tospace after the trap Read barrier

Incremental Garbage Collection – p.7/22

slide-27
SLIDE 27

Handling Page Faults

Mutator Tospace before the trap Tospace after the trap Read barrier

Incremental Garbage Collection – p.7/22

slide-28
SLIDE 28

Summary

advantages

Incremental Garbage Collection – p.8/22

slide-29
SLIDE 29

Summary

advantages concurrent scanning possible

Incremental Garbage Collection – p.8/22

slide-30
SLIDE 30

Summary

advantages concurrent scanning possible cheaper read trap

Incremental Garbage Collection – p.8/22

slide-31
SLIDE 31

Summary

advantages concurrent scanning possible cheaper read trap problems

Incremental Garbage Collection – p.8/22

slide-32
SLIDE 32

Summary

advantages concurrent scanning possible cheaper read trap problems relies on virtual memory

Incremental Garbage Collection – p.8/22

slide-33
SLIDE 33

Summary

advantages concurrent scanning possible cheaper read trap problems relies on virtual memory global lock is bottleneck

Incremental Garbage Collection – p.8/22

slide-34
SLIDE 34

Summary

advantages concurrent scanning possible cheaper read trap problems relies on virtual memory global lock is bottleneck flip is still stop-the-world

Incremental Garbage Collection – p.8/22

slide-35
SLIDE 35

Nettle’s Replicating Collector

read barrier is still expensive

Incremental Garbage Collection – p.9/22

slide-36
SLIDE 36

Nettle’s Replicating Collector

read barrier is still expensive use write barrier instead

Incremental Garbage Collection – p.9/22

slide-37
SLIDE 37

Nettle’s Replicating Collector

Mutator Fromspace forward ptr

  • riginal

Tospace header word replica

GC

getHeader read write

Incremental Garbage Collection – p.10/22

slide-38
SLIDE 38

Nettle’s Replicating Collector

Mutator Fromspace forward ptr

  • riginal

Tospace header word replica

GC

Mutation Log getHeader read write

Incremental Garbage Collection – p.10/22

slide-39
SLIDE 39

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects

Incremental Garbage Collection – p.11/22

slide-40
SLIDE 40

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects e.g. ML

Incremental Garbage Collection – p.11/22

slide-41
SLIDE 41

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects e.g. ML immutable objects

Incremental Garbage Collection – p.11/22

slide-42
SLIDE 42

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects e.g. ML immutable objects replicating collection

Incremental Garbage Collection – p.11/22

slide-43
SLIDE 43

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects e.g. ML immutable objects replicating collection mutable objects

Incremental Garbage Collection – p.11/22

slide-44
SLIDE 44

Huelsbergen-Laurus Collector

distinguish mutable/immutable objects e.g. ML immutable objects replicating collection mutable objects classic copying collection

Incremental Garbage Collection – p.11/22

slide-45
SLIDE 45

Doligez-Leroy Collector

Problem: heavy synchronization

Incremental Garbage Collection – p.12/22

slide-46
SLIDE 46

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data

Incremental Garbage Collection – p.12/22

slide-47
SLIDE 47

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data young generation

Incremental Garbage Collection – p.12/22

slide-48
SLIDE 48

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data young generation thread-local

Incremental Garbage Collection – p.12/22

slide-49
SLIDE 49

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data young generation thread-local immutable

Incremental Garbage Collection – p.12/22

slide-50
SLIDE 50

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data young generation thread-local immutable

  • ld generation

Incremental Garbage Collection – p.12/22

slide-51
SLIDE 51

Doligez-Leroy Collector

Problem: heavy synchronization seperate thread-local data young generation thread-local immutable

  • ld generation

the rest

Incremental Garbage Collection – p.12/22

slide-52
SLIDE 52

Thread Local Heaps

thread 1 thread 2 thread 3 young generation

  • ld generation

Global variables

Incremental Garbage Collection – p.13/22

slide-53
SLIDE 53

In-Place Garbage Collection

uncooperative environment

Incremental Garbage Collection – p.14/22

slide-54
SLIDE 54

In-Place Garbage Collection

uncooperative environment relaxed consistency requirements

Incremental Garbage Collection – p.14/22

slide-55
SLIDE 55

In-Place Garbage Collection

uncooperative environment relaxed consistency requirements Fragmentation!

Incremental Garbage Collection – p.14/22

slide-56
SLIDE 56

Four-Color Abstraction

black: scanned

Incremental Garbage Collection – p.15/22

slide-57
SLIDE 57

Four-Color Abstraction

black: scanned gray: marked, not scanned

Incremental Garbage Collection – p.15/22

slide-58
SLIDE 58

Four-Color Abstraction

black: scanned gray: marked, not scanned white: not marked

Incremental Garbage Collection – p.15/22

slide-59
SLIDE 59

Four-Color Abstraction

black: scanned gray: marked, not scanned white: not marked dead-white: free objects

Incremental Garbage Collection – p.15/22

slide-60
SLIDE 60

Four-Color Implementation

fromspace

potential garbage

start

tospace

scanned objects scanned unscanned objects unscanned free space alloc new objects end

Incremental Garbage Collection – p.16/22

slide-61
SLIDE 61

Baker’s Treadmill

new objects Tospace Fromspace free list scan top free bottom

Incremental Garbage Collection – p.17/22

slide-62
SLIDE 62

Baker’s Treadmill

new objects Tospace Fromspace free list scan top free bottom

Incremental Garbage Collection – p.17/22

slide-63
SLIDE 63

Baker’s Treadmill

new objects Tospace Fromspace free list scan top free bottom

Incremental Garbage Collection – p.17/22

slide-64
SLIDE 64

Baker’s Treadmill

new objects Tospace Fromspace free list s c a n top free bottom

Incremental Garbage Collection – p.17/22

slide-65
SLIDE 65

Baker’s Treadmill

new objects Tospace Fromspace free list s c a n top f r e e bottom

Incremental Garbage Collection – p.17/22

slide-66
SLIDE 66

Baker’s Treadmill

new objects Tospace Fromspace free list scan top f r e e bottom

Incremental Garbage Collection – p.17/22

slide-67
SLIDE 67

Baker’s Treadmill

new objects Tospace Fromspace free list scan top f r e e bottom

Incremental Garbage Collection – p.17/22

slide-68
SLIDE 68

Baker’s Treadmill

new objects Tospace Fromspace free list scan top f r e e bottom

Incremental Garbage Collection – p.17/22

slide-69
SLIDE 69

Baker’s Treadmill

new objects Tospace Fromspace scan top free bottom

Incremental Garbage Collection – p.17/22

slide-70
SLIDE 70

Baker’s Treadmill

Fromspace free list s c a n t

  • p

free bottom

Incremental Garbage Collection – p.17/22

slide-71
SLIDE 71

Baker’s Treadmill

Tospace Fromspace free list s c a n top free bottom

Incremental Garbage Collection – p.17/22

slide-72
SLIDE 72

Baker’s Treadmill

Tospace Fromspace free list scan t

  • p

free bottom

Incremental Garbage Collection – p.17/22

slide-73
SLIDE 73

Baker’s Treadmill

new Tospace Fromspace free list scan t

  • p

f r e e bottom

Incremental Garbage Collection – p.17/22

slide-74
SLIDE 74

Advantages

compared to incremental mark/sweep

Incremental Garbage Collection – p.18/22

slide-75
SLIDE 75

Advantages

compared to incremental mark/sweep easy allocation

Incremental Garbage Collection – p.18/22

slide-76
SLIDE 76

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object

Incremental Garbage Collection – p.18/22

slide-77
SLIDE 77

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip

Incremental Garbage Collection – p.18/22

slide-78
SLIDE 78

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip compared to copying collector

Incremental Garbage Collection – p.18/22

slide-79
SLIDE 79

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip compared to copying collector write barrier

Incremental Garbage Collection – p.18/22

slide-80
SLIDE 80

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip compared to copying collector write barrier equal or better memory utilization

Incremental Garbage Collection – p.18/22

slide-81
SLIDE 81

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip compared to copying collector write barrier equal or better memory utilization compared to both

Incremental Garbage Collection – p.18/22

slide-82
SLIDE 82

Advantages

compared to incremental mark/sweep easy allocation easy to “blacken” object easy flip compared to copying collector write barrier equal or better memory utilization compared to both depth first traversal for free

Incremental Garbage Collection – p.18/22

slide-83
SLIDE 83

Problems

heterogenous objects

Incremental Garbage Collection – p.19/22

slide-84
SLIDE 84

Problems

heterogenous objects multiple Treadmills

Incremental Garbage Collection – p.19/22

slide-85
SLIDE 85

Problems

heterogenous objects multiple Treadmills memory fragmentation

Incremental Garbage Collection – p.19/22

slide-86
SLIDE 86

Improvements

  • ne Treadmill for big objects

Incremental Garbage Collection – p.20/22

slide-87
SLIDE 87

Improvements

  • ne Treadmill for big objects

seperate Treadmills for small objects

Incremental Garbage Collection – p.20/22

slide-88
SLIDE 88

Improvements

  • ne Treadmill for big objects

seperate Treadmills for small objects free page migration between Treadmills

Incremental Garbage Collection – p.20/22

slide-89
SLIDE 89

Improvements

  • ne Treadmill for big objects

seperate Treadmills for small objects free page migration between Treadmills page-wise collection for fast migration

Incremental Garbage Collection – p.20/22

slide-90
SLIDE 90

Improvements

  • ne Treadmill for big objects

seperate Treadmills for small objects free page migration between Treadmills page-wise collection for fast migration free page remapping for large allocations

Incremental Garbage Collection – p.20/22

slide-91
SLIDE 91

Improvements

  • ne Treadmill for big objects

seperate Treadmills for small objects free page migration between Treadmills page-wise collection for fast migration free page remapping for large allocations page-filling allocation

Incremental Garbage Collection – p.20/22

slide-92
SLIDE 92

Questions?

Incremental Garbage Collection – p.21/22

slide-93
SLIDE 93

Thanks for your attention!

Incremental Garbage Collection – p.22/22