The Metronome Washington University in St. Louis Tobias Mann October 2003.

Slides:



Advertisements
Similar presentations
1 Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center.
Advertisements

Lecture 10: Heap Management CS 540 GMU Spring 2009.
Garbage Collection What is garbage and how can we deal with it?
Reducing Pause Time of Conservative Collectors Toshio Endo (National Institute of Informatics) Kenjiro Taura (Univ. of Tokyo)
Memory Management Chapter 7.
MC 2 : High Performance GC for Memory-Constrained Environments - Narendran Sachindran, J. Eliot B. Moss, Emery D. Berger Sowmiya Chocka Narayanan.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
On-the-Fly Garbage Collection: An Exercise in Cooperation Edsget W. Dijkstra, Leslie Lamport, A.J. Martin and E.F.M. Steffens Communications of the ACM,
By Jacob SeligmannSteffen Grarup Presented By Leon Gendler Incremental Mature Garbage Collection Using the Train Algorithm.
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.
Parallel Garbage Collection Timmie Smith CPSC 689 Spring 2002.
CPSC 388 – Compiler Design and Construction
Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet
CS 536 Spring Automatic Memory Management Lecture 24.
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.
1 The Compressor: Concurrent, Incremental and Parallel Compaction. Haim Kermany and Erez Petrank Technion – Israel Institute of Technology.
CS 1114: Data Structures – memory allocation Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
On the limits of partial compaction Anna Bendersky & Erez Petrank Technion.
G Robert Grimm New York University Cool Pet Tricks with… …Virtual Memory.
Garbage Collection Mooly Sagiv html://
MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI.
0 Parallel and Concurrent Real-time Garbage Collection Part I: Overview and Memory Allocation Subsystem David F. Bacon T.J. Watson Research Center.
Virtual Memory Primitives for User Programs Andrew W. Appel and Kai Li Presented by: Khanh Nguyen.
21 September 2005Rotor Capstone Workshop Parallel, Real-Time Garbage Collection Daniel Spoonhower Guy Blelloch, Robert Harper, David Swasey Carnegie Mellon.
Memory Management Memory Areas and their use Memory Manager Tasks:
Runtime The optimized program is ready to run … What sorts of facilities are available at runtime.
Incremental Garbage Collection
Compilation 2007 Garbage Collection Michael I. Schwartzbach BRICS, University of Aarhus.
An Adaptive, Region-based Allocator for Java Feng Qian & Laurie Hendren 2002.
1 An Efficient On-the-Fly Cycle Collection Harel Paz, Erez Petrank - Technion, Israel David F. Bacon, V. T. Rajan - IBM T.J. Watson Research Center Elliot.
Garbage Collection Mooly Sagiv
Linked lists and memory allocation Prof. Noah Snavely CS1114
Damien Doligez Georges Gonthier POPL 1994 Presented by Eran Yahav Portable, Unobtrusive Garbage Collection for Multiprocessor Systems.
Jangwoo Shin Garbage Collection for Real-Time Java.
Uniprocessor Garbage Collection Techniques Paul R. Wilson.
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.
A Parallel, Real-Time Garbage Collector Author: Perry Cheng, Guy E. Blelloch Presenter: Jun Tao.
1 Overview Assignment 6: hints  Living with a garbage collector Assignment 5: solution  Garbage collection.
Memory Management Last Update: July 31, 2014 Memory Management1.
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
David F. Bacon Perry Cheng V.T. Rajan IBM T.J. Watson Research Center The Metronome: A Hard Real-time Garbage Collector.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
A Mostly Non-Copying Real-Time Collector with Low Overhead and Consistent Utilization David Bacon Perry Cheng (presenting) V.T. Rajan IBM T.J. Watson Research.
Message Analysis-Guided Allocation and Low-Pause Incremental Garbage Collection in a Concurrent Language Konstantinos Sagonas Jesper Wilhelmsson Uppsala.
1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir.
Incremental Garbage Collection Uwe Kern 23. Januar 2002
1 Lecture 22 Garbage Collection Mark and Sweep, Stop and Copy, Reference Counting Ras Bodik Shaon Barman Thibaud Hottelier Hack Your Language! CS164: Introduction.
Computer Science Department Daniel Frampton, David F. Bacon, Perry Cheng, and David Grove Australian National University Canberra ACT, Australia
Garbage Collection and Memory Management CS 480/680 – Comparative Languages.
Concurrent Garbage Collection Presented by Roman Kecher GC Seminar, Tel-Aviv University 23-Dec-141.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
David F. Bacon Perry Cheng V.T. Rajan IBM T.J. Watson Research Center ControllingFragmentation and Space Consumption in the Metronome.
A REAL-TIME GARBAGE COLLECTOR WITH LOW OVERHEAD AND CONSISTENT UTILIZATION David F. Bacon, Perry Cheng, and V.T. Rajan IBM T.J. Watson Research Center.
Memory Management -Memory allocation -Garbage collection.
Runtime The optimized program is ready to run … What sorts of facilities are available at runtime.
2/4/20161 GC16/3011 Functional Programming Lecture 20 Garbage Collection Techniques.
Real-time collection for multithreaded Java Microcontroller Garbage Collection. Garbage Collection. Application of Java in embedded real-time systems.
® 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.
Real-time Garbage Collection By Tim St. John Low Overhead and Consistent Utilization. Low Overhead and Consistent Utilization. Multithreaded Java Microcontroller.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
Garbage Collection What is garbage and how can we deal with it?
Concepts of programming languages
David F. Bacon, Perry Cheng, and V.T. Rajan
Chapter 12 Memory Management
Reference Counting.
Garbage Collection What is garbage and how can we deal with it?
Presentation transcript:

The Metronome Washington University in St. Louis Tobias Mann October 2003

Developers IBM T.J Watson Research Center  David F. Bacon  Perry Cheng  V.T. Rajan A Real-time Garbage Collector with low Overhead and Consistent Utilization. Jan 2003 Controlling Fragmentation and Space Consumption in the Metronome, a Real-time Garbage Collector for Java. June 03

Overview Garbage Collection Techniques What is the Metronome Segregated Free List Tri-Color Marking Read Barrier Copying Algorithm Write Barrier Snapshot-in-the-beginning Stack processing Scheduling User must supply Questions

Garbage Collection Techniques One can classify garbage collection algorithms into two categories  Copying collectors Copies live objects to a reserved portion of memory  Non-copying collectors Dead objects are marked and collected using various techniques Copying collectors use extra memory but prevents external fragmentation

What is the Metronome? A garbage collector implemented in Jikes RVM that is:  A mostly non-copying hybrid  An incremental uniprocessor collector targeted at embedded systems Concurrent but not parallel

Segregated Free List Memory is divided into pages of a fixed size (may differ from the OS page size) Each page is divided into fixed sized blocks Geometric progression of block sizes  S i = S i-1 (1 + ρ)  Choose ρ = 1/8 Worst case internal fragmentation of 12.5% ρ = 0 would mean that all blocks are the same size ρ = 1 would be the buddy system

Segregated Free List cont. Segregated Free List is kept as a chain of pages.  Each page has an associated mark array  Allocation cursor pointing to both a page and a block When a list is empty a new page is chosen and broken up into blocks of appropriate size  How is a new page chosen?

Tri-Color Marking White = Untouched by collector (considered dead at the end of collection) Grey = Touched but not scanned Black = Scanned Tri-color invariant – No black object can hold a pointer directly pointing to a white object Problem

Tri-Color Marking cont. Metronome allocates black Weak tri-color invariant

Read and Write Barrier Problem

Read and Write Barrier cont. Read Barrier  Detects when the mutator attempts to access a pointer pointing to a white object and immediately colors that object grey. (Wilson 1995) Write Barrier  Detects when the mutator attempts to write a pointer into an object and traps or records the write. (Wilson 1995)

Read Barrier Brooks-style read barrier  To-space invariant mutator only sees objects in to-space  Forwarding pointer From-spaceTo-space

Read Barrier cont. Eager Barrier  Register and stack cells always point into to space  Forwarding is performed “eagerly” as soon as quantity is loaded

Read Barrier cont. The collector handles all the work of finding and moving objects This circumvents the problem of uneven utilization suffered by other implementations of a to-space invariant  How does this solve the under utilization issue that is claimed to be endemic to implementations of to-space invariants?

Copying Semispace Root set A B C D free from-space to-space BCDA scan free

Copying cont. Copying is only performed when defragmentation is needed If nr of free pages < threshold  Perform defragmentation Threshold is the smallest nr of free pages that allows the mutator to execute for another collection cycle Determined at the end of each sweep phase

Copying cont. for each page compute the nr of live objects for each free list sort pages by occupancy while the target nr of pages to evacuate in this size class has not been met AND there are pages left to defragment move objects form the least occupied to the most occupied pages within a list Target nr of pages is chosen so that the sum of the current nr free pages and target is sufficient for two collection cycles

Write Barrier If the mutator attempts to overwrite a pointer, the overwritten value is pushed onto the marking stack for later examination Root set Marking stack Problem Solution Weak tri-color invariant

Snapshot-in-the-beginning Metronome’s non-copying algorithm Similar to Yuasa’s snapshot-at-the-beginning  Weak tricolor invariant  Extent mark phase to also handle forwarding by redirecting any pointers pointing into from-space so they point into to-space. Objects relocated during the previous collection can now be freed. This maintains the eager read barrier previously mentioned

Snapshot-in-the-beginning cont. Conceptually this algorithm takes a “snapshot” of the graph of reachable nodes in the beginning of collection This conceptual snapshot is maintained by the write barrier

Snapshot-in-the-beginning cont. The objects considered live is the set union of the set of objects that are live when collection starts and the set of objects that are allocated during collection Floating garbage

Stack processing Not incremental Two parts  root scanning  maintenance of eager invariant for read barrier How does this affect real-time performance?  Stop the world while register and stack cells are forwarded? For java why not perform forwarding method by method on demand?  Method A calls method B, forward references in A when B returns

Scheduling Time-based Work-based Are time-based and work-based scheduling different if allocation rate is known?

User must supply Max live Max allocation rate Proportion of memory devoted to the heap (as supposed to thread stacks) Lower bound on average object size Lower bound on nr of pointers per word (object) Upper bound on the fraction of non-null references The last four is needed to calculate the time required to perform a collection at time, t.  T GC (t) = T I + T R (t) + T M (t) + T S (t) + T D (t) Would not the lower bounds simply be 0? Can the nr of pointer per word be anything but 0 or 1?

Questions Segregated Free List  How is a new page “chosen” when a free-list is empty?  Why is this considered together with garbage collection? Is not the maintenance of the free list the responsibility of the allocator?

Questions cont. Is the only difference between the Metronome Mark and Sweep and Yuasa’s algorithm that the Metronome does forwarding during the mark phase? How does the above property solve the under utilization problem that is claimed to be endemic to implementations of to-space invariant? How is list of grey objects maintained?  a separate data structure? (Yuasa uses a stack)  objects linked together in memory?

Questions cont. How does the fact that stack processing is not incremental effect real-time performance? Stack processing is not incremental. Does this mean that Metronome must “stop the world” while register and stack cells are forwarded to maintain the eager invariant? For java why not perform forwarding method by method on demand?  A calls B, forward references in A when B returns

Questions cont. The paper claims that copying algorithms that attempt to collect a subset of the heap at a time can be defeated by an adversarial mutator.  Why is that the case?  Kelvin Nielsen claims his collector performs very well performing copying on a subset of the heap and mark-sweep on the remaining part of the heap.

Questions cont. How is from- and to-space distinguished?  Since copying algorithm only moves objects between pages within a free list how is from- and to-space separated? Are time-based and work-based scheduling different if allocation rate is known? Is not the lower bounds for objects per word and average object size just 0? Can the nr of pointer per word be anything but 0 or 1?

Questions cont. Is it really necessary to consider defragmentation while proving the real-time capabilities of a collector?  If one assumes that each free list has size = max live then garbage collection will still be needed but defragmentation is a non issue.

References Bacon, F. D., Cheng, P., and Rajan, V. T. A Real-time Garbage Collector with Low Overhead and Constant Utilization. Jan 2003 Bacon, F. D., Cheng, P., and Rajan, V. T. Controlling Fragmentation and Space Consumption in the Metronome, a Real-time Garbage Collector for Java. June 2003 Nielsen, K. Doing Firm-Real-Time With J2SE APIs. July 2003 Wilson, R. P. Uniprocessor Garbage Collection Techniques 1995