Rifat Shahriyar Stephen M. Blackburn Australian National University

Slides:



Advertisements
Similar presentations
An Implementation of Mostly- Copying GC on Ruby VM Tomoharu Ugawa The University of Electro-Communications, Japan.
Advertisements

Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Steve Blackburn Department of Computer Science Australian National University Perry Cheng TJ Watson Research Center IBM Research Kathryn McKinley Department.
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Compilation /15a Lecture 13 Compiling Object-Oriented Programs Noam Rinetzky 1.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
Memory Management Tom Roeder CS fa. Motivation Recall unmanaged code eg C: { double* A = malloc(sizeof(double)*M*N); for(int i = 0; i < M*N; i++)
Garbage Collection. Memory Management So Far ● Some items are preallocated and persist throughout the program: ● What are they? Some are allocated on.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
MC 2 : High Performance GC for Memory-Constrained Environments N. Sachindran, E. Moss, E. Berger Ivan JibajaCS 395T *Some of the graphs are from presentation.
380C Where are we & where we are going – Managed languages Dynamic compilation Inlining Garbage collection What else can you do when you examine the heap.
Memory Management. History Run-time management of dynamic memory is a necessary activity for modern programming languages Lisp of the 1960’s was one of.
Using Prefetching to Improve Reference-Counting Garbage Collectors Harel Paz IBM Haifa Research Lab Erez Petrank Microsoft Research and Technion.
Garbage Collection Mooly Sagiv html://
MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI.
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Generational Stack Collection And Profile driven Pretenuring Perry Cheng Robert Harper Peter Lee Presented By Moti Alperovitch
Runtime The optimized program is ready to run … What sorts of facilities are available at runtime.
Incremental Garbage Collection
Memory Allocation and Garbage Collection. Why Dynamic Memory? We cannot know memory requirements in advance when the program is written. We cannot know.
Age-Oriented Concurrent Garbage Collection Harel Paz, Erez Petrank – Technion, Israel Steve Blackburn – ANU, Australia April 05 Compiler Construction Scotland.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
Garbage collection (& Midterm Topics) David Walker COS 320.
Reference Counters Associate a counter with each heap item Whenever a heap item is created, such as by a new or malloc instruction, initialize the counter.
Compiler Optimizations for Nondeferred Reference-Counting Garbage Collection Pramod G. Joisha Microsoft Research, Redmond.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Garbage Collection Memory Management Garbage Collection –Language requirement –VM service –Performance issue in time and space.
1 Overview Assignment 6: hints  Living with a garbage collector Assignment 5: solution  Garbage collection.
Taking Off The Gloves With Reference Counting Immix
380C Lecture 17 Where are we & where we are going –Managed languages Dynamic compilation Inlining Garbage collection –Why you need to care about workloads.
Dynamic Memory Allocation Questions answered in this lecture: When is a stack appropriate? When is a heap? What are best-fit, first-fit, worst-fit, and.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
Fast Conservative Garbage Collection Rifat Shahriyar Stephen M. Blackburn Australian National University Kathryn S. M cKinley Microsoft Research.
Copyright (c) 2004 Borys Bradel Myths and Realities: The Performance Impact of Garbage Collection Paper: Stephen M. Blackburn, Perry Cheng, and Kathryn.
How’s the Parallel Computing Revolution Going? 1How’s the Parallel Revolution Going?McKinley Kathryn S. McKinley The University of Texas at Austin.
A Principled Approach to Nondeferred Reference-Counting Garbage Collection † Pramod G. Joisha HP Labs, Palo Alto † This work was done when the author was.
Compilation (Semester A, 2013/14) Lecture 13b: Memory Management Noam Rinetzky Slides credit: Eran Yahav 1.
Runtime System CS 153: Compilers. Runtime System Runtime system: all the stuff that the language implicitly assumes and that is not described in the program.
Garbage Collection and Memory Management CS 480/680 – Comparative Languages.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Immix: A Mark-Region Garbage Collector Curtis Dunham CS 395T Presentation Feb 2, 2011 Thanks to Steve Blackburn and Jennifer Sartor for their 2008 and.
Introduction to Garbage Collection. Garbage Collection It automatically reclaims memory occupied by objects that are no longer in use It frees the programmer.
2/4/20161 GC16/3011 Functional Programming Lecture 20 Garbage Collection Techniques.
® July 21, 2004GC Summer School1 Cycles to Recycle: Copy GC Without Stopping the World The Sapphire Collector Richard L. Hudson J. Eliot B. Moss Originally.
CS412/413 Introduction to Compilers and Translators April 21, 1999 Lecture 30: Garbage collection.
Reference Counting. Reference Counting vs. Tracing Advantages ✔ Immediate ✔ Object-local ✔ Overhead distributed ✔ Very simple Trivial implementation for.
Simple Generational GC Andrew W. Appel (Practice and Experience, February 1989) Rudy Kaplan Depena CS 395T: Memory Management February 9, 2009.
An Efficient, Incremental, Automatic Garbage Collector P. Deutsch and D. Bobrow Ivan JibajaCS 395T.
GARBAGE COLLECTION Student: Jack Chang. Introduction Manual memory management Memory bugs Automatic memory management We know... A program can only use.
Memory Management What if pgm mem > main mem ?. Memory Management What if pgm mem > main mem ? Overlays – program controlled.
Immix: A Mark-Region Garbage Collector Jennifer Sartor CS395T Presentation Mar 2, 2009 Thanks to Steve for his Immix presentation from
Jonathan Walpole Computer Science Portland State University
Dynamic Compilation Vijay Janapa Reddi
Memory Management 6/20/ :27 PM
Dynamic Memory Allocation
CS 153: Concepts of Compiler Design November 28 Class Meeting
Cycle Tracing Chapter 4, pages , From: "Garbage Collection and the Case for High-level Low-level Programming," Daniel Frampton, Doctoral Dissertation,
Ulterior Reference Counting Fast GC Without The Wait
Memory Management and Garbage Collection Hal Perkins Autumn 2011
Strategies for automatic memory management
Memory Management Kathryn McKinley.
Closure Representations in Higher-Order Programming Languages
José A. Joao* Onur Mutlu‡ Yale N. Patt*
Created By: Asst. Prof. Ashish Shah, J.M.Patel College, Goregoan West
Garbage Collection Advantage: Improving Program Locality
Reference Counting.
CMPE 152: Compiler Design May 2 Class Meeting
Mooly Sagiv html:// Garbage Collection Mooly Sagiv html://
Reference Counting vs. Tracing
Presentation transcript:

Rifat Shahriyar Stephen M. Blackburn Australian National University High Performance Reference Counting and Conservative Garbage Collection Rifat Shahriyar Stephen M. Blackburn Australian National University Kathryn S. McKinley Microsoft Research

Down for the Count? Getting Reference Counting Back in the Ring ISMM’12 What happened 53 years ago?

Why Reference Counting? Advantages Immediacy Object local Basic RC is easy Disadvantages Cycles Performance

Can we get RC back in the ring? Problem One of the two fundamental GC algorithms Many advantages Neglected by performance-conscious VMs So how much slower is it? Can we get RC back in the ring? 30%

RC vs. MS New RC ≈ MS

Summary Old RC New RC Performance 30% slower than MS 40% slower than production New RC Limited bit count Optimization for new objects Performance Matches MS Still 10% slower than production < 2012 2012 6

Taking Off the Gloves with Reference Counting Immix OOPSLA’13

Why So Slow? GC Total Mutator

Looking a Little Deeper… L1 D Cache Misses Instructions Retired Time Using Managed Runtime Systems to Tolerate Holes in Wearable Memories

Looking a Little Deeper… Free List Lets see which GC uses which allocator RC and MS – Free List SS and Immix – Bump pointer L1 D Cache Misses Instructions Retired Time Bump Pointer Using Managed Runtime Systems to Tolerate Holes in Wearable Memories

RC Immix Combines RC and Immix Exploit Immix’s opportunistic copy Line/block reclamation Line live object count with object reference count Exploit Immix’s opportunistic copy Observe new objects can be copied by first GC Observe old objects can be copied by backup GC Using Managed Runtime Systems to Tolerate Holes in Wearable Memories

3% faster then Gen Immix, +6% worst case, -21% best case Total time 3% faster then Gen Immix, +6% worst case, -21% best case

Summary RC Immix Great performance Transforms RC -3% RC Immix Object-local collection Excellent mutator locality Copying with RC Great performance Outperforms fastest production Transforms RC

Fast Conservative Garbage Collection OOPSLA’14 What happened 53 years ago?

GC is Ubiquitous GC implementations Exact Conservative High performance systems use exact GC Conservative GC is popular roots heap roots heap heap roots GC – needs to find all live/dead objects Start from the roots Roots - all references into the heap held by runtime including stacks, registers, statics, and JNI Conservative GC is generally used in less performant systems exact conservative

Root Conservative GC heap roots int We are interested in root conservative GC Where References in the roots are not precisely known But references in the heap objects are precisely known

We are interested in managed languages Why Conservative GC Advantages No cooperation from compiler and runtime Engineering accurate stack maps is challenging Enable some compiler optimizations Disadvantages Must handle ambiguous references Performance We are interested in managed languages Reference counting has some interesting advantages. Our goal is to make it faster than the production. Zoom in on the result

Performance of Conservative GC BDW suffers 12% and MCC suffers 45% overhead

Ambiguous Reference Pointers? – retain their referents and transitively reachable objects (Excess retention) Values? – not modify them and pin the referents (Pinning) Corrupt heap? – guarantee validation before updating per-object metadata (Filtering)

Non-moving Boehm-Demers-Weiser (BDW) widely used Problems free-list allocator mark-sweep trace to reclaim garbage Problems Free-list suffers bad locality than contiguous With object type precision, a overly restrictive design

Mostly copying aka Bartlett Style with many variants Two twists over the classic semi-space to-space and from-space are linked lists of discontiguous pages Promotes page referenced by ambiguous root Problems Semi-space suffers from huge collection cost Space waste due to page level pinning Objects can’t span pages and allocator can’t use pinned page

RC Immixcons matches production Gen Immix Total time RC Immixcons matches production Gen Immix

Summary Conservative GC New designs Conservative RC Immix Dominated by BDW and MCC Significant overheads Heap org. key to performance New designs Low overhead object map Immix line based pinning Conservative RC Immix Matches fastest production

Conclusion