Lecture Conservative Garbage Collection. 3.2 Precise Garbage Collectors. 3.3 Other Garbage Collection Techniques

Similar documents
Lecture 15 Garbage Collection

CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Lecture 15 Advanced Garbage Collection

Managed runtimes & garbage collection

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

A new Mono GC. Paolo Molaro October 25, 2006

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

Garbage Collection. Weiyuan Li

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Garbage Collection (2) Advanced Operating Systems Lecture 9

Garbage Collection Algorithms. Ganesh Bikshandi

CS577 Modern Language Processors. Spring 2018 Lecture Garbage Collection

Shenandoah An ultra-low pause time Garbage Collector for OpenJDK. Christine H. Flood Roman Kennke

Compilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1

Garbage Collection. Hwansoo Han

Lecture Notes on Advanced Garbage Collection

CMSC 330: Organization of Programming Languages

Garbage-First Garbage Collection by David Detlefs, Christine Flood, Steve Heller & Tony Printezis. Presented by Edward Raff

the gamedesigninitiative at cornell university Lecture 9 Memory Management

Simple Garbage Collection and Fast Allocation Andrew W. Appel

Deallocation Mechanisms. User-controlled Deallocation. Automatic Garbage Collection

Implementation Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

Concurrent Garbage Collection

Garbage Collection. Vyacheslav Egorov

The Generational Hypothesis

CMSC 330: Organization of Programming Languages

Heap Management. Heap Allocation

Programming Language Implementation

Lecture Notes on Garbage Collection

Run-Time Environments/Garbage Collection

CS 345. Garbage Collection. Vitaly Shmatikov. slide 1

Exploiting the Behavior of Generational Garbage Collector

MC 2 : High-Performance Garbage Collection for Memory-Constrained Environments

CSE P 501 Compilers. Memory Management and Garbage Collec<on Hal Perkins Winter UW CSE P 501 Winter 2016 W-1

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35

the Cornell Checkpoint (pre-)compiler

Reference Counting. Reference counting: a way to know whether a record has other users

Last week, David Terei lectured about the compilation pipeline which is responsible for producing the executable binaries of the Haskell code you

CS842: Automatic Memory Management and Garbage Collection. GC basics

The C4 Collector. Or: the Application memory wall will remain until compaction is solved. Gil Tene Balaji Iyengar Michael Wolf

High-Level Language VMs

Habanero Extreme Scale Software Research Project

Opera&ng Systems CMPSCI 377 Garbage Collec&on. Emery Berger and Mark Corner University of Massachuse9s Amherst

Garbage Collection Techniques

Run-time Environments -Part 3

Memory Management: The Details

Lecture 13: Garbage Collection

Garbage Collection (1)

Configuring the Heap and Garbage Collector for Real- Time Programming.

Yaffs Tuning. Charles Manning

Shenandoah: An ultra-low pause time garbage collector for OpenJDK. Christine Flood Roman Kennke Principal Software Engineers Red Hat

Garbage Collection. Steven R. Bagley

code://rubinius/technical

Motivation for Dynamic Memory. Dynamic Memory Allocation. Stack Organization. Stack Discussion. Questions answered in this lecture:

JVM Performance Tuning with respect to Garbage Collection(GC) policies for WebSphere Application Server V6.1 - Part 1

Quantifying the Performance of Garbage Collection vs. Explicit Memory Management

Reference Counting. Reference counting: a way to know whether a record has other users

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

Announcements. Persistence: Crash Consistency

Java Performance Tuning

G Programming Languages - Fall 2012

Memory management has always involved tradeoffs between numerous optimization possibilities: Schemes to manage problem fall into roughly two camps

JVM Troubleshooting MOOC: Troubleshooting Memory Issues in Java Applications

ECE 574 Cluster Computing Lecture 19

Cooperative Memory Management in Embedded Systems

Manual Allocation. CS 1622: Garbage Collection. Example 1. Memory Leaks. Example 3. Example 2 11/26/2012. Jonathan Misurda

Memory Management william stallings, maurizio pizzonia - sistemi operativi

One-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection.

Myths and Realities: The Performance Impact of Garbage Collection

Parallel GC. (Chapter 14) Eleanor Ainy December 16 th 2014

Automatic Memory Management

Java Internals. Frank Yellin Tim Lindholm JavaSoft

The G1 GC in JDK 9. Erik Duveblad Senior Member of Technical Staf Oracle JVM GC Team October, 2017

EECS 482 Introduction to Operating Systems

Procedure and Function Calls, Part II. Comp 412 COMP 412 FALL Chapter 6 in EaC2e. target code. source code Front End Optimizer Back End

Incremental Parallel Garbage Collection

Order Is A Lie. Are you sure you know how your code runs?

Shenandoah: An ultra-low pause time garbage collector for OpenJDK. Christine Flood Principal Software Engineer Red Hat

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep

I J C S I E International Science Press

Real-Time Garbage Collection Panel JTRES 2007

Register Allocation. CS 502 Lecture 14 11/25/08

Heckaton. SQL Server's Memory Optimized OLTP Engine

White Box Testing III

UNIT-4 (COMPILER DESIGN)

CS 318 Principles of Operating Systems

Habanero Extreme Scale Software Research Project

Azul Systems, Inc.

Advances in Memory Management and Symbol Lookup in pqr

CS2210: Compiler Construction. Runtime Environment

KESO Functional Safety and the Use of Java in Embedded Systems

EE382C Lecture 14. Reliability and Error Control 5/17/11. EE 382C - S11 - Lecture 14 1

Capriccio: Scalable Threads for Internet Services (by Behren, Condit, Zhou, Necula, Brewer) Presented by Alex Sherman and Sarita Bafna

The SURE Architecture

Operating Systems. Deadlock. Lecturer: William Fornaciari Politecnico di Milano Homel.deib.polimi.

Short-term Memory for Self-collecting Mutators. Martin Aigner, Andreas Haas, Christoph Kirsch, Ana Sokolova Universität Salzburg

Transcription:

CMPSCI 691ST Systems Fall 2011 Lecture 3 Lecturer: Emery Berger Scribe: Nicolas Scarrci 3.1 Conservative Garbage Collection The Boehm collector is the first example of conservative garbage collection. Conservative garbage collectors are garbage collectors that work without compiler cooperation. For this reason they must discover pointers on their own. Unfortunately pointers and integers look the same from the compiler s point of view causing some integers to be treated as pointers. Conservative garbage collection also requires that the running program stop and wait for the garbage collector to finish before it may proceed. If there are multiple threads all threads are required to stop. 3.2 Precise Garbage Collectors Garbage collectors before the Boehm collector were called precise garbage collectors. These collectors used GC-maps which assumed complete knowledge of pointers. Garbage Collection Terminology Changing a pointer is called mutation. The real program is called the mutator. Garbage Collection Concerns Errors in garbage collection can cause old programs to fail. Conservative GC errs on the side of false positives. GC errors may take a while to surface. 3.3 Other Garbage Collection Techniques Coordination through read and write barriers (uses indirection, see Fig 1.) Mutator: Hey collector, I m going to follow this pointer to an object and then write new stuff into it. Collector: Oh sure, just write that stuff to this other location instead. 3.3.1 Semi space garbage collection Divide all memory into two halves. (flat loss of half of memory) Start by doing bump allocation in the first half. When this half is full trigger garbage collection. Copy live objects over to the other half of memory and leave a reference pointer in their place. Move the allocation pointer to the first free bit of memory in the second half of memory. Clear the first half of memory. Resume allocation. (This algorithm is called a Cheney scan.) 3-1

3-2 Lecture 3: September 15 Semi space garbage collection is a stop the world garbage collector. This scheme still falls prey to the issue of misidentifying an int as a pointer. If the number of live objects is much larger than the number of dead objects then this process can slow down. In addition this process does not yield any benefit if all of the dead objects are at the end of the memory space. 3.3.2 Emery s idea. Run two copies of a program. When checking a suspected pointer check both copies of memory. If the int/pointer in question is the same in both programs it is an int. If the int/pointer has the same base but a different offset then it is a pointer. 3.3.3 Generational garbage collection Generational garbage collection relies on the Generational Hypothesis: most objects die young. While this hypothesis holds true for most programs it is not universal. For this reason generational garbage collection is an example of common case optimization. Initially allocate memory in a nursery. When garbage collection is triggered check each object in the nursery for incoming references. If an object is referenced from outside of the nursery copy it to a space outside of the nursery. Clear all objects remaining in the nursery. Resume memory allocation. Variants: Dynamic nursery size. Multiple generations (nursery levels.) Profiling: Track a program to see what sorts of objects it makes. Intentionally allocate memory chunks of these sizes. Optimization: configuration parameters (or knobs.) Bad because the number of options is very large. Bad because slight code changes may require new knob settings. 3.4 Tangents Where is GC located? Garbage collection is located above the OS. All memory allocation is actually done in the runtime environment of the language in use. Since the initial paper Boehm has created incremental versions of his collector. The current implementation also blacklists integers that look like pointers but are later discovered to be integers. The shuttle program uses multiple sets of hardware. This is to prevent systematic hardware errors across multiple machines. A similar approach can be taken with software, this is called n-variant software. Software engineers argue that this is ineffective as a problem in the software specifications could cause a systematic error across multiple software systems. Another solution is to use checkpointing. Checkpointing is the process

Lecture 3: September 15 3-3 of periodically saving system state. If an error occurs the system can load the most recent checkpoint and retry. This is also called rollback or rety. Cosmic rays may flip a bit. This is a soft error and may go undetected. One solution is to add a checksum bit or a parity bit. Another option is to use Error Correcting Codes (ECC). Eccs allow memory error correction. Unforutnately they are not widely used because they cause a slight performance decrease and memory with ECCs is more expensive. ECCs are in the domain of coding theory. We cannot send people to mars because cosmic radiation will kill them. If we instead send sophisticated robots to mars cosmic radiation will flip their bits. The library problem in programming language design is the problem of having to reimplement popular libraries in the new language to make it more usable/approachable. URLs are direct pointers, hence when a file gets moved we get a broken link. If we had a level of indirection (like that used in garbage collectors which move data) we could avoid this problem.

3-4 Lecture 3: September 15

Lecture 3: September 15 3-5