Presentation is loading. Please wait.

Presentation is loading. Please wait.

Incremental Garbage Collection Uwe Kern 23. Januar 2002

Similar presentations


Presentation on theme: "Incremental Garbage Collection Uwe Kern 23. Januar 2002"— Presentation transcript:

1 Incremental Garbage Collection Uwe Kern 23. Januar 2002 kern@cs.uni-sb.de

2 Incremental GC Mutator runs while collecting is performed Collecting is done in small, partial steps Drastically reduced pause times Extension of existing tracing GC's

3 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

4 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

5 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

6 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

7 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

8 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

9 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

10 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

11 Problem: Intertwined mutation Root AB C completed found unvisited/garbage Cells & GC state

12 Solution: Synchronization Idea: Intercept access to or modification of references in objects (barrier) Do something in barrier to prevent race conditions

13 Example Barrier Which kind of mutations are fatal ? 1.Reference to white object X written into one or more black objects. 2.All references from white/grey objects to X deleted.

14 Example Barrier Which kind of mutations are fatal ? 1.Reference to white object X written into one or more black objects. 2.All references from white/grey objects to X deleted. Idea: Eliminate black-white pointers by coloring black object grey again

15 Example Barrier Root AB C

16 Example Barrier Root AB C

17 Example Barrier Root AB C

18 Example Barrier Root AB C

19 Example Barrier Root AB C

20 Example Barrier Root AB C

21 Example Barrier Root AB C

22 Example Barrier Root AB C

23 Example Barrier Root AB C

24 Example Barrier Root AB C

25 Example Barrier Root AB C

26 Example Barrier Root AB C

27 Example Barrier Root AB C

28 Example Barrier Root AB C

29 Example Barrier Root AB C

30 Example Barrier Root AB C

31 Example Barrier Root AB C

32 Example Barrier Root AB C

33 Example Barrier Root AB C

34 Example Barrier Root AB C

35 Example Barrier Root AB C

36 Example Barrier Root AB C

37 Example Barrier Root AB C

38 Example Barrier Root AB C

39 Example Barrier Root AB C

40 Incremental GC Properties

41 Collector sees conservative approximation of reachability graph

42 Incremental GC Properties Collector sees conservative approximation of reachability graph Conservatism leads to floating garbage

43 Incremental GC Properties Collector sees conservative approximation of reachability graph Conservatism leads to floating garbage Strong approximations decrease incrementality

44 Quality Criterias

45 Conservatism: level of floating garbage produced

46 Quality Criterias Conservatism: level of floating garbage produced Incrementality: more fine-grained is better

47 Quality Criterias Conservatism: level of floating garbage produced Incrementality: more fine-grained is better Mutator overhead: processor and memory costs

48 Concurrent Mark-Sweep

49 [Steele, 1975]

50 Concurrent Mark-Sweep [Steele, 1975] mutator and collector running parallel

51 Concurrent Mark-Sweep [Steele, 1975] mutator and collector running parallel write barrier as in example

52 Concurrent Mark-Sweep mark stack R1 R3 R2 A BC

53 Concurrent Mark-Sweep mark stack R1 R3 R2 ABC Mark R1

54 Concurrent Mark-Sweep mark stack R1 R3 R2 BC Mark R1 A A

55 Concurrent Mark-Sweep mark stack R1 R3 R2 BC Mark R1 A A

56 Concurrent Mark-Sweep mark stack R1 R3 R2 BC Mark R1 A

57 Concurrent Mark-Sweep mark stack R1 R3 R2 BC Mark R2 A

58 Concurrent Mark-Sweep mark stack R1 R3 R2 BC Mark R2 A A

59 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B

60 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B

61 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B B D

62 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B B D

63 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A BD

64 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B D R1

65 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B D R1

66 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B D R1 A

67 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B D R1 A C

68 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A A B D R1 A

69 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A B D R1 A

70 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A B D R1 A

71 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 A B D A

72 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark R2 B D A

73 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark B D A

74 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark B D A R3

75 Concurrent Mark-Sweep mark stack R1 R3 R2 C Mark B D A

76 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep B D A

77 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep B A

78 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep A B E

79 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep A B E F

80 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep A B E F

81 Concurrent Mark-Sweep mark stack R1 R3 R2 C Sweep A B E F

82 Concurrent Mark-Sweep mark stack R1 R3 R2 Sweep A B E F C

83 Concurrent Mark-Sweep mark stack R1 R3 R2 A B E F C

84 Concurrent Mark-Sweep

85 Conservatism

86 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation)

87 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning

88 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality

89 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality fine-grained barrier, no large other atomic operations

90 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality fine-grained barrier, no large other atomic operations Mutator Overhead

91 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality fine-grained barrier, no large other atomic operations Mutator Overhead costs of synchronization not negligible

92 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality fine-grained barrier, no large other atomic operations Mutator Overhead costs of synchronization not negligible barrier comparatively cheap

93 Concurrent Mark-Sweep Conservatism few floating garbage (used barrier, white allocation) used method results in more scanning Incrementality fine-grained barrier, no large other atomic operations Mutator Overhead costs of synchronization not negligible barrier comparatively cheap additional allocation costs

94 Performance of Steele's Collector

95 algorithm has never been used

96 Performance of Steele's Collector algorithm has never been used synchronization is main bottleneck

97 Performance of Steele's Collector algorithm has never been used synchronization is main bottleneck author: hardware support needed

98 Incremental Copying

99 [Baker, 1978]

100 Incremental Copying [Baker, 1978] collector runs as coroutine of mutator

101 Incremental Copying [Baker, 1978] collector runs as coroutine of mutator mutator operates in tospace

102 Incremental Copying [Baker, 1978] collector runs as coroutine of mutator mutator operates in tospace new kind of barrier: read barrier

103 R1 R3 C A R2 B bottom & top

104 R1 R3 C A R2 B bottom & top

105 scan bottom top R1 R3 C A R2 B F T

106 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2

107 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2

108 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2

109 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2

110 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2A

111 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2A

112 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A

113 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D

114 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D

115 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D

116 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B

117 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B

118 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B

119 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B

120 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C

121 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C

122 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

123 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

124 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

125 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

126 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

127 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

128 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

129 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

130 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

131 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

132 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

133 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E

134 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E F

135 scan bottomtop R1 R3 C A R2 B F T R3 R1 R2 A D B C E F

136 bottomtop C F T R3 R1 R2 A D B E F

137 Incremental Copying

138 Conservatism

139 Incremental Copying Conservatism very early graying of cells

140 Incremental Copying Conservatism very early graying of cells black cell allocation

141 Incremental Copying Conservatism very early graying of cells black cell allocation Incrementality

142 Incremental Copying Conservatism very early graying of cells black cell allocation Incrementality barrier/allocation fine-grained (cell size dependent)

143 Incremental Copying Conservatism very early graying of cells black cell allocation Incrementality barrier/allocation fine-grained (cell size dependent) root set scanning atomic operation

144 Incremental Copying Conservatism very early graying of cells black cell allocation Incrementality barrier/allocation fine-grained (cell size dependent) root set scanning atomic operation Mutator Overhead

145 Incremental Copying Conservatism very early graying of cells black cell allocation Incrementality barrier/allocation fine-grained (cell size dependent) root set scanning atomic operation Mutator Overhead read barrier extremely expensive on stock hardware

146 Performance of Baker's Collector

147 various researchers measured 10-30% CPU costs

148 Performance of Baker's Collector various researchers measured 10-30% CPU costs reason: read barrier on stock hardware

149 Performance of Baker's Collector various researchers measured 10-30% CPU costs reason: read barrier on stock hardware hardware support needed

150 Replicating Copying

151 [Nettles, 1992]

152 Replicating Copying [Nettles, 1992] modification of SML/NJ generational collector

153 Replicating Copying [Nettles, 1992] modification of SML/NJ generational collector replaces old generation collection

154 Replicating Copying [Nettles, 1992] modification of SML/NJ generational collector replaces old generation collection mutator runs in fromspace parallel to collector

155 Replicating Copying [Nettles, 1992] modification of SML/NJ generational collector replaces old generation collection mutator runs in fromspace parallel to collector write barrier used

156 C A B scan free Root F T

157 C A B scan free Root Shadow Root F T

158 C A B scan free Root Shadow Root F T

159 C A B scan free Root Shadow Root A F T

160 C A B scan free Root Shadow Root A relocation map F T

161 C A B scan free Root Shadow Root A relocation map A F T

162 C A B scan free Root Shadow Root A relocation map A F T

163 C A B scan free Root Shadow Root A relocation map A F T

164 C A B scan free Root Shadow Root A relocation map A F T

165 C A B scan free Root Shadow Root A relocation map A mutation log F T

166 C A B scan free Root Shadow Root A relocation map A mutation log Ac F T

167 C A B scan free Root Shadow Root A relocation map A mutation log Ac F T

168 C A B scan free Root Shadow Root A relocation map A mutation log Ac F T

169 C A B scan free Root Shadow Root A relocation map A mutation log Ac F T

170 C A B scan free Root Shadow Root A relocation map A mutation log Ac F T B

171 C A B scan free Root Shadow Root A relocation map A F T B mutation log Bc Ac

172 C A B scan Root Shadow Root A relocation map A D F T B free mutation log Bc Ac

173 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Bc Ac

174 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Bc Ac

175 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc Ac

176 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc Ac

177 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc Ac

178 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc Ac

179 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc Ac

180 C A B scan free Root Shadow Root A relocation map A D B B F T mutation log Cd Bc

181 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log Cd Bc

182 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log Cd Bc

183 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log Cd Bc

184 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log Cd

185 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log Cd

186 C A B scan free Root Shadow Root A relocation map A D B B C C F T mutation log

187 C A B scan free Root Shadow Root A relocation map A D B B C C D D F T mutation log

188 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D F T

189 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

190 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

191 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

192 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

193 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

194 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

195 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

196 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

197 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E F T

198 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E E F T

199 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

200 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

201 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

202 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

203 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

204 C A B scan free Root Shadow Root A relocation map A mutation log D B B C C D D E E F T E

205 scan free Root A relocation map mutation log B C D F T E

206 free Root A relocation map mutation log B C D F T E

207 Replicating Copying

208 Conservatism

209 Replicating Copying Conservatism white cell allocation

210 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white

211 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality

212 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality fine-grained barrier; begin/end of collection atomic

213 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality fine-grained barrier; begin/end of collection atomic Mutator Overhead

214 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality fine-grained barrier; begin/end of collection atomic Mutator Overhead low synchronization costs

215 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality fine-grained barrier; begin/end of collection atomic Mutator Overhead low synchronization costs barrier causes memory or time penalty

216 Replicating Copying Conservatism white cell allocation barrier reverts black cells back to grey if target white Incrementality fine-grained barrier; begin/end of collection atomic Mutator Overhead low synchronization costs barrier causes memory or time penalty less write operations result in less overhead

217 Performance of Nettle's Collector

218 very short collection pauses

219 Performance of Nettle's Collector very short collection pauses collection time sometimes shorter than stop-copy

220 Performance of Nettle's Collector very short collection pauses collection time sometimes shorter than stop-copy minor collection time increases compared to pure stop-and-copy

221 Performance of Nettle's Collector very short collection pauses collection time sometimes shorter than stop-copy minor collection time increases compared to pure stop-and-copy Important: SML matches lots of necessary properties to make replicating collector effective !

222 Summary

223 operates in small steps (reduced pause times)

224 Summary operates in small steps (reduced pause times) application domain: interactive/real time

225 Summary operates in small steps (reduced pause times) application domain: interactive/real time barriers used to ensure synchronization

226 Summary operates in small steps (reduced pause times) application domain: interactive/real time barriers used to ensure synchronization each tracing technique usable as base

227 Summary operates in small steps (reduced pause times) application domain: interactive/real time barriers used to ensure synchronization each tracing technique usable as base usable incremental GCs exist


Download ppt "Incremental Garbage Collection Uwe Kern 23. Januar 2002"

Similar presentations


Ads by Google