An Efficient, Incremental, Automatic Garbage Collector P. Deutsch and D. Bobrow Ivan JibajaCS 395T.

Slides:



Advertisements
Similar presentations
(Chapter 5) Deleting Objects
Advertisements

Lecture 10: Heap Management CS 540 GMU Spring 2009.
Garbage Collection What is garbage and how can we deal with it?
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree.
File Systems.
Garbage Collecting the World. --Bernard Lang, Christian and Jose Presented by Shikha Khanna coen 317 Date – May25’ 2005.
By Jacob SeligmannSteffen Grarup Presented By Leon Gendler Incremental Mature Garbage Collection Using the Train Algorithm.
Efficient Concurrent Mark-Sweep Cycle Collection Daniel Frampton, Stephen Blackburn, Luke Quinane and John Zigman (Pending submission) Presented by Jose.
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.
An Efficient Machine-Independent Procedure for Garbage Collection in Various List Structures, Schorr and Waite CACM August 1967, pp Curtis Dunham.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
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.
Chapter 11: File System Implementation
1 The Compressor: Concurrent, Incremental and Parallel Compaction. Haim Kermany and Erez Petrank Technion – Israel Institute of Technology.
File System Implementation
Chapter 12: File System Implementation
Chapter 10 Storage Management Implementation details beyond programmer’s control Storage/CPU time trade-off Binding times to storage.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
1 Reducing Generational Copy Reserve Overhead with Fallback Compaction Phil McGachey and Antony L. Hosking June 2006.
Uniprocessor Garbage Collection Techniques Paul R. Wilson.
File System Implementation
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.
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
Flexible Reference-Counting-Based Hardware Acceleration for Garbage Collection José A. Joao * Onur Mutlu ‡ Yale N. Patt * * HPS Research Group University.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
A Real-Time Garbage Collector Based on the Lifetimes of Objects Henry Lieberman and Carl Hewitt (CACM, June 1983) Rudy Kaplan Depena CS395T: Memory Management.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Memory management (CTM 2.5) Carlos Varela RPI April 6, 2015.
March 16 & 21, Csci 2111: Data and File Structures Week 9, Lectures 1 & 2 Indexed Sequential File Access and Prefix B+ Trees.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Garbage Collection and Memory Management CS 480/680 – Comparative Languages.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Memory Management -Memory allocation -Garbage collection.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
Chapter 5 Record Storage and Primary File Organizations
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.
GARBAGE COLLECTION Student: Jack Chang. Introduction Manual memory management Memory bugs Automatic memory management We know... A program can only use.
Garbage Collecting the World Presentation: Mark Mastroieni Authors: Bernard Lang, Christian Queinne, Jose Piquer.
Garbage Collection What is garbage and how can we deal with it?
Lecture 6 of Computer Science II
Jonathan Walpole Computer Science Portland State University
Module 11: File Structure
File-System Implementation
CS522 Advanced database Systems
CS522 Advanced database Systems
Chapter 11: File System Implementation
Concepts of programming languages
Practice Six Chapter Eight.
Arrays and Linked Lists
Chapter 11: File System Implementation
Strategies for automatic memory management
Presentation: Cas Craven
Overview: File system implementation (cont)
File Storage and Indexing
File Storage and Indexing
José A. Joao* Onur Mutlu‡ Yale N. Patt*
Chapter 14: File-System Implementation
Chapter 11: File System Implementation
COMP755 Advanced Operating Systems
Reference Counting.
Garbage Collection What is garbage and how can we deal with it?
Reference Counting vs. Tracing
Presentation transcript:

An Efficient, Incremental, Automatic Garbage Collector P. Deutsch and D. Bobrow Ivan JibajaCS 395T

Historical Context Intel 8080 dominates the PC market – 8-bit processor – 2 MhZ Hard Drive and Tape for secondary storage

What is Reference Counting (RC)? Basic Idea: – Objects that do not have external references are unreachable – Unreachable objects are not live Every object stores the count of external references to itself

Reference Counting (RC) Advantages – Immediate reclamation of dead objects – Easy to implement Disadvantages – Circular structures – Computation overhead (per pointer mutation) – Space overhead

Efficiency and Scalability Reference Counting – Overhead is proportional to the amount of work performed by the mutator Tracing algorithms – Overhead is proportional to the amount of allocated space

Memory Characterization – LISP Clark and Green analyzed Lisp programs – Most data have a reference count of one – Else, data is mostly temporary (esp. local data) – Very few cells are referenced by more than one cell ( ~ 2% - 10%)

Deferred RC – Motivation I Transactional. Stored in sequential file – Three events can modify the RC: 1.Allocation of a new object 2.Creation of a pointer to an object 3.Destruction of a pointer to an object Benefit No immediate time overhead for adjusting RC

Deferred RC – Motivation II Statement: Most data have a reference count of one Adjustment: -Only store the RC for objects with 2 or more references -Store RC separately from data: Multireference Table (MRT) Benefit: -Reduce space overhead -No paging (MRT is always in memory)

Deferred RC – Motivation III Statement: Local data is mostly temporary Adjustment – Do not keep track of local references (from stack) – Store unreferenced from other cells (and pointed from stack) objects in Zero Count Table (ZCT) Benefit – Reduce space overhead – Optimized for local variables

Deferred RC - Visualization Unreferenced objects from other objects (RC = 0) || Pointed from stack Unreferenced objects from other objects (RC = 0) || Pointed from stack RC >= 2 Zero Count Table (ZCT) Multireference Table (MRT) RC = 1

Deferred RC – Implementation I On “Allocation” – Add to the Zero Count Table

Deferred RC – Implementation II On “Creation of pointer p” If ( inZCT(p) ) { RemoveFromZCT(p) // After: RC = 1 } else { if ( inMRT(p) ) { IncrementRC(p); // After: RC > 2 } else { AddToMRT(p,2); // After: RC = 2 }

Deferred RC – Implementation III On “Destruction of pointer p” If ( inMRT(p) ) { if ( getRCfromMRT(p) == 2 ) { removeFromMRT(p); // After: RC = 1 } else { decrementRC(p); // After: RC >= 2 } } else { AddToZCT(p);// After: RC = 0 }

Deferred RC - Reclamation All objects present in the ZCT not referenced by variables in the stack ARE reclaimable Optimization: – Create a Variable Reference Table (VRT) Hash table to store all the objects pointed by variables in the stack Result: – If p is in ZCT and not in VRT then its reclaimable

Deferred RC - Optimization Use buffer in core to store hash table (bit for allocate) where the value is the RC Benefit: Do not need to process some transactions – “allocate - create” pairs – “create – destroy” pairs – Abandoned data is left with only “allocate”

What about cycles? All RC schemes require an independent collector for cycles This collector can also perform compaction and reorganization (for locality) Paper describes a copying algorithm and the details for Deferred RC

Discussion CMP: Concurrent vs. heterogeneous cores? Static analysis Find possible transaction pairs that cancel each other Generations: – RC vs. tracing. Young vs. Old Spaces Does it really reduce space overhead? – Ungar claims Deferred RC uses 25 Kb more than traditional RC (for his 1 large lisp sample)

Discussion “For a ‘create pointer’ transaction: if the datum referenced is in the ZCT, just delete it, since the effective RC is 1”. Can we really just remove this entry? How about references from stack?

Linearizing Cycle Collection Expand MRT to include forwarding pointers and actually count stack references for MRT. Store expanded MRT sorted (rather than hashed) so that the access is sequential