Dusty Caches for Reference Counting Garbage Collection Scott
Dusty Caches for Reference Counting Garbage Collection Scott Friedman, Praveen Krishnamurthy, Roger Chamberlain, Ron K. Cytron, Jason Fritts Dept. of Computer Science and Engineering Washington University in St. Louis Sponsored by NSF grant ITR-0313203
Outline • Introduction – Reference counting garbage collection • Dusty cache – Design and policy • Evaluating dusty caches – Quantifying performance using JVM – Experiment on Liquid Architecture • Conclusions 2
Introduction • Garbage collection – Java, C# – Unused objects are reclaimed • Techniques – Reference counting – Mark and sweep – Copy and collect … 3
Reference Counts P = new Integer(. . ); P Integer class members 1 reference count 4
Reference Counts P = new Integer(. . ); Q = P; Integer P class members Q 2 reference count 5
Reference Counts P = new Integer(. . ); Q = new Integer(. . ); P class members 1 Q class members 1 6
Reference Counts P = Q; P class members “Garbage” 0 Q class members 2 7
Ref. counts & Memory Traffic • Short-lived (temporary) changes in reference counts – Linked lists, trees, sorting, hashtables etc. head node 0 node 1 node 2 node n 8
Ref. counts & Memory Traffic linked. List list; iterator iter = list. iterator(); while(iter. has. Next()) { Object item = iter. next(); foo(item); } head node 0 1 node 1 1 node 2 1 node n 1 9
Ref. counts & Memory Traffic linked. List list; iterator iter = list. iterator(); while(iter. has. Next()) { Object item = iter. next(); foo(item); } head node 0 2 node 1 1 node 2 1 node n 1 iter 10
Ref. counts & Memory Traffic linked. List list; iterator iter = list. iterator(); while(iter. has. Next()) { Object item = iter. next(); foo(item); } head node 0 1 node 1 2 node 2 1 node n 1 iter 11
Ref. counts & Memory Traffic linked. List list; iterator iter = list. iterator(); while(iter. has. Next()) { Object item = iter. next(); foo(item); } head node 0 1 node 1 1 node 2 2 node n 1 iter 12
Ref. counts & Memory Traffic linked. List list; iterator iter = list. iterator(); while(iter. has. Next()) { Object item = iter. next(); foo(item); } head node 0 1 node 1 1 node 2 1 node n 2 iter 13
Ref. counts & Memory Traffic head node 0 1 node 1 1 node 2 1 node n 1 • Consequence – Every object is marked dirty in the cache • Will be written back to RAM upon eviction – Unnecessary writes to RAM • Temporally silent stores (Lepak & Lipasti, 2002) • Our solution - Dusty Cache – Eliminates all such unnecessary writes to memory 14
Outline • Introduction – Reference counting • Dusty caches – Design and operations • Evaluating dusty caches – Quantifying performance using JVM – Experiment on Liquid Architecture • Conclusions 15
Cache Design: Write. Back tag ddata cache lines A x x x B C D 0 1 1 x x 1 Write: Read: update the dirty tag, andvalid data and data address tag cached value offset valid dirty 16
Cache Design: Dusty cache lines tag ddata x x dimage x x A B C D A B E D 0 1 1 Writes: Read: update tagtag, anddata and image 1 address tag cached value offset valid mem value dirty ivalid 17
Outline • Introduction – Reference counting • Dusty cache – Design and operations • Evaluating dusty caches – Quantifying performance using JVM – Experiment on Liquid Architecture • Conclusions 18
Evaluating Dusty Cache • Traces from JVM instrumentation – Sun’s Java Virtual Machine • Reference counting garbage collection – Reference count for all objects – # of JVM instructions between reference count changes – # of cache altering instructions between changes • Eviction from cache window: for a window of size ‘k’ cache writes, a value ‘v’ written at write ‘i’ will be evicted at write ‘i+k’ 19
JVM: Quantifying Memory Savings • Cache configurations – Unified, Non-unified caches • Write. Through, Write. Back, Dusty • Measured as “memory writes saved” – Baseline was a Write. Through cache 20
1. SPEC Data. Base 8, 088 objs ~10% 21
2. SPEC JESS 46, 129 objs ~15% 22
Experiments on a flexible processor • Liquid Architecture – Platform to study microarchitecture refinements – Softcore LEON 2: 5 -stage SPARC compliant 32 -bit – Statsmod: ‘non intrusive’ performance measurement tool • Limitations – 4 MB of SRAM, No JVM 23
Experiment on Liquid Architecture • Deployed LEON with a ‘dusty’ cache policy – Replicated all of the L 1 cache • Monte Carlo Experiment – Determine probability of cache altering events • Reads, Writes, Heap. Ref. Count++, Heap. Ref. Count-- – Events access random addresses in memory – Experiments monitored both RC and non-RC traffic 24
Emulation using Liquid Architecture Results of the Monte Carlo Experiment 50% reduction 25
Conclusions • Dusty cache policy effectively filters the unnecessary reference counting traffic – Savings around 5 - 25 % over WB cache • Microarchitecture optimization – Dusty cache can be a small subset of the cache • Could potentially reduce writes even in nonreference counting traffic – Inferred from Characterization of silent stores (Bell et al. 2000) 26
Liquid Architecture Project http: //www. arl. wustl. edu/liquid Email: liquid@cs. wustl. edu Sponsored by NSF grant ITR-0313203 27
- Slides: 27