Concurrent Copying Garbage Collection
Filip Pizlo, Erez Petrank, Bjarne Steensgaard Purdue, Technion/Microsoft, Microsoft PLDI’08 - Tucson, AZ
1
Concurrent Copying Garbage Collection Filip Pizlo, Erez Petrank, - - PowerPoint PPT Presentation
Concurrent Copying Garbage Collection Filip Pizlo, Erez Petrank, Bjarne Steensgaard Purdue, Technion/Microsoft, Microsoft PLDI08 - Tucson, AZ 1 Introduction RTGC is gaining acceptance as an alternative to manual memory management for
Filip Pizlo, Erez Petrank, Bjarne Steensgaard Purdue, Technion/Microsoft, Microsoft PLDI’08 - Tucson, AZ
1
2
3
From To Mutator The Heap
4
Original Object (From) Object Copy (To)
Mutator Field
5
Original Object (From) Object Copy (To)
Mutator Field
Already Copied
5
Original Object (From) Object Copy (To)
Mutator Field
Already Copied
5
Original Object (From) Object Copy (To)
Mutator
Already Copied
Field
6
Original Object (From) Object Copy (To)
Mutator
Already Copied
Field
6
Original Object (From) Object Copy (To)
Mutator
Already Copied
Field
6
Original Object (From) Object Copy (To)
Mutator
Already Copied
But: how do you know when to switch from the
space object? Field
6
Original Object (From) Object Copy (To)
Mutator
Already Copied
Field
Immediately after you check which version
copier may advance past it.
6
7
8
9
10
11
12
12
12
Mutator
12
Mutator
12
13
Mutator
13
14
14
14
15
15
15
15
15
16
17
17
17
18
19
Mutator
Field Not Copied
20
Mutator
Field Not Copied
The idea is to allow the mutator to always write to the original object, and to have such writes force the collector to recopy the field at a later time.
20
Mutator
Field Not Copied
The idea is to allow the mutator to always write to the original object, and to have such writes force the collector to recopy the field at a later time.
20
Mutator
Field Copied
21
Mutator
Field Copied
If the field is already copied, access to-space.
21
Mutator
Field Copied
If the field is already copied, access to-space.
21
Collector
Field Not Copied
22
Collector
Field Not Copied
Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
22
Collector
Field Not Copied
Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
22
Collector
Field Not Copied
Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
22
Collector
Field Not Copied
Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
FIELD COPIED
22
23
24
Easy for reference fields - but really hard for integer fields!
25
26
R can be huge - it can be the largest CAS-able word - 128 bits on Intel!
27
28
29
30
Mutator
31
Mutator The mutator writes to the from-space using a CAS that asserts that the field is not copied (does not equal R).
31
Mutator The mutator writes to the from-space using a CAS that asserts that the field is not copied (does not equal R).
31
Mutator
32
Mutator If the CAS fails, the mutator just writes to to- space.
32
Mutator If the CAS fails, the mutator just writes to to- space.
32
Collector
33
Collector Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
33
Collector Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
33
Collector Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
33
Collector Collector repeatedly attempts to copy and assert the field as copied until it does so without the field’s value changing.
33
34
35
36
37
38
39
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 sat lcsc zing Bartok go
xlisp crafty Geometric mean
Execution times relative to non-copying concurrent collector
Stopless5 Clover5 Chicken5
40
41
Concurrent MS STOPLESS CLOVER CHICKEN
Ê Ê Ê Ê Ê Ê ‡ ‡ ‡ ‡ ‡ ‡ Ï Ï Ï Ï Ï Ï Ú Ú Ú Ú Ú Ú
1 2 3 4 5 6 10000 20000 30000 40000 50000 60000 Number of Warehouses JBB Transactions per Second
42
43
44
Ê Ê Ê ÊÊ Ê Ê Ê ÊÊÊÊÊÊÊÊ ÊÊÊ ÊÊ 5 10 15 20 1 100 104 106
45
Ê Ê Ê ÊÊ Ê Ê Ê ÊÊÊÊÊÊÊÊ ÊÊÊ ÊÊ 5 10 15 20 1 100 104 106
45
Ê Ê Ê ÊÊ Ê Ê Ê ÊÊÊÊÊÊÊÊ ÊÊÊ ÊÊ 5 10 15 20 1 100 104 106
45
Ê Ê Ê ÊÊ Ê Ê Ê ÊÊÊÊÊÊÊÊ ÊÊÊ ÊÊ 5 10 15 20 1 100 104 106
45
Ê Ê Ê ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ 5 10 15 20 1 100 104 106
46
Ê Ê Ê ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ 5 10 15 20 1 100 104 106
46
Ê Ê Ê ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ 5 10 15 20 1 100 104 106
46
47
Ê Ê Ê Ê 20 40 60 80 1 10 100 1000 104 105 106
48
Ê Ê 20 40 60 80 1 10 100 1000 104 105 106
49
50
51