Specialized Reference Counting Garbage Collection using Data Structure Annotations By Eric Watkins and Dzin Avots for CS 343 Spring 2002.

Slides:



Advertisements
Similar presentations
CS 225 Lab #11 – Skip Lists.
Advertisements

Data-Flow Analysis II CS 671 March 13, CS 671 – Spring Data-Flow Analysis Gather conservative, approximate information about what a program.
Interprocedural Shape Analysis for Recursive Programs Noam Rinetzky Mooly Sagiv.
3-Valued Logic Analyzer (TVP) Tal Lev-Ami and Mooly Sagiv.
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Data Structures & Java Generics Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Bounding Space Usage of Conservative Garbage Collectors Ohad Shacham December 2002 Based on work by Hans-J. Boehm.
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++)
Designing Indexing Structure for Discovering Relationships in RDF Graphs Stanislav Bartoň.
File System Interface CSCI 444/544 Operating Systems Fall 2008.
CPSC 388 – Compiler Design and Construction
CS 61C L07 More Memory Management (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C.
Establishing Local Temporal Heap Safety Properties with Applications to Compile-Time Memory Management Ran Shaham Eran Yahav Elliot Kolodner Mooly Sagiv.
Graphs CS-240/341. Uses for Graphs computer networks and routing airline flights geographic maps course prerequisite structures tasks for completing a.
Improving code generation. Better code generation requires greater context Over expressions: optimal ordering of subtrees Over basic blocks: Common subexpression.
Graphs.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
The Most Commonly-used Data Structures
Improving Code Generation Honors Compilers April 16 th 2002.
Improving code generation. Better code generation requires greater context Over expressions: optimal ordering of subtrees Over basic blocks: Common subexpression.
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
Review of Graphs A graph is composed of edges E and vertices V that link the nodes together. A graph G is often denoted G=(V,E) where V is the set of vertices.
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
Chapter 8 Data Abstractions Introduction to CS 1 st Semester, 2015 Sanghyun Park.
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.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
Shape Analysis Overview presented by Greta Yorsh.
Chap 10 File-System Interface. Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
CS 363 Comparative Programming Languages Semantics.
Graphs. 2 Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
University of Washington Wouldn’t it be nice… If we never had to free memory? Do you free objects in Java? 1.
Tree Traversals, TreeSort 20 February Expression Tree Leaves are operands Interior nodes are operators A binary tree to represent (A - B) + C.
Interprocedural Path Profiling David Melski Thomas Reps University of Wisconsin.
Consider Starting with 160 k of memory do: Starting with 160 k of memory do: Allocate p1 (50 k) Allocate p1 (50 k) Allocate p2 (30 k) Allocate p2 (30 k)
Lecture Topics: 11/29 File System Interface –Files and Directories –Access Methods –Protection –Consistency.
Access Methods File store information When it is used it is accessed & read into memory Some systems provide only one access method IBM support many access.
Smart Pointers. Dumb Pointers Pointers Necessary – Dynamic memory – Sharing memory.
CS61C L07 More Memory Management (1) Garcia, Spring 2010 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C.
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.
Lecture 14 Page 1 CS 111 Online File Systems: Naming, Reliability, and Advanced Issues CS 111 On-Line MS Program Operating Systems Peter Reiher.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
Lists List Implementations. 2 Linked List Review Recall from CMSC 201 –“A linked list is a linear collection of self- referential structures, called nodes,
18-1 Chapter 18 Binary Trees Data Structures and Design in Java © Rick Mercer.
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Memory Management What if pgm mem > main mem ?. Memory Management What if pgm mem > main mem ? Overlays – program controlled.
Directory Structure Single Level Directory Two Level Directory
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Seminar in automatic tools for analyzing programs with dynamic memory
Data Structures Interview / VIVA Questions and Answers
Capriccio – A Thread Model
Storage.
Arrays and Linked Lists
Smart Pointers.
Parametric Shape Analysis via 3-Valued Logic
CS Introduction to Operating Systems
Graphs Chapter 11 Objectives Upon completion you will be able to:
What to do when you don’t know anything know nothing
Parametric Shape Analysis via 3-Valued Logic
Graphs.
Chapter 10: File-System Interface
Graphs.
Graphs.
Graphs.
Graphs.
Automating Memory Management
Program Verification with Graph Types and Monadic Second-order Logic
Presentation transcript:

Specialized Reference Counting Garbage Collection using Data Structure Annotations By Eric Watkins and Dzin Avots for CS 343 Spring 2002

Motivation Improve use of ref counting for C++ Problem: cycles can’t be freed automatically, expensive to determine what is unreachable Solution: Use user specified data structure annotations to improve performance

Goals & Techniques Avoid unnecessary mark & sweeps –Acyclic Data Structure Optimizations Avoid some memory leaks –Reference Removal Invariant Model

Reference Counting using Smart Pointers

Garbage Example #1 Doubly Linked List Everything is strongly connected Nothing can be freed until all external refs are gone How can we recognize this data structure? ext ptr

Abstract Description of Data Structures The compiler can’t differentiate these two even though they will obviously be connected in different ways. ADDS can tell us how to customize smart pointer usage for certain data structures

Doubly Linked List ADDS

Binary Tree w/ Parents ADDS

ADDS spec Dimensions (1-d, 2-d, etc.) Directionality (forward and backward) Uniqueness of forward references (DAGs vs. lists) Cyclicity

Linked List Optimization The entire dimension is strongly connected, forwards and backwards Summarize with single ref counter for all external references to dimension

Dimensional Independence Dimensions X and Y are dependent if one traversal along X and another traversal along Y may lead to a common node by different paths

Other ADDS issues What about describing relations between different acyclic data structures? Could avoid marking & sweeping this structure etc.

Primary & Secondary Pointers Primary pointers – if these point to an object, then object is still in use Secondary pointers – point to object, but don’t affect use status Memory leak – Primary pointers are all removed, but a secondary pointer remains

Garbage Example #2 Bug BugManagerGrid Bug Secondary refsPrimary refs Programs can contain complicated, interconnected relationships between objects

Garbage Example #2 Bug BugManagerGrid Bug Secondary refsPrimary ref If the user forgets to remove the secondary reference, the Bug won’t be deleted.

Primary & Secondary Pointers User specifies primary & secondary pointers in ADDS specification Primary & Secondary pointer invariant can be expressed as instrumentation predicate in 3-valued logic Generate shape analysis to detect leak condition

Plan of Action Investigate use of ADDS specs to improve refcount performance Generate interprocedural shape analysis from primary & secondary edge specs Look into other improvements from user specifications

Related Work ADDS work: L. Hendren and J. Hummel, Abstractions for Recursive Pointer Data Structures: Improving the Analysis and Transformation of Imperative Programs Shape Analysis: M. Sagiv, T. Reps and R. Wilhelm, Parametric Shape Analysis via 3- Valued Logic