Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.

Slides:



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

Part IV: Memory Management
Dynamic Memory Management
Chapter 2: Memory Management, Early Systems
Chapter 2: Memory Management, Early Systems
PZ10B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ10B - Garbage collection Programming Language Design.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
File Systems.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
5. Memory Management From: Chapter 5, Modern Compiler Design, by Dick Grunt et al.
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
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 Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Chapter 9 – Real Memory Organization and Management
Memory Management Memory Areas and their use Memory Manager Tasks:
1 Optimizing Malloc and Free Professor Jennifer Rexford
Memory Management A memory manager should take care of allocating memory when needed by programs release memory that is no longer used to the heap. Memory.
Memory Organization.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
A Parallel, Real-Time Garbage Collector Author: Perry Cheng, Guy E. Blelloch Presenter: Jun Tao.
Memory Management Last Update: July 31, 2014 Memory Management1.
Memory Allocation CS Introduction to Operating Systems.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao ISBN: CMPBooks.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
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.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Lecture 10 : Introduction to Java Virtual Machine
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.
1 Tuning Garbage Collection in an Embedded Java Environment G. Chen, R. Shetty, M. Kandemir, N. Vijaykrishnan, M. J. Irwin Microsystems Design Lab The.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Virtual Machines, Interpretation Techniques, and Just-In-Time Compilers Kostis Sagonas
11/26/2015IT 3271 Memory Management (Ch 14) n Dynamic memory allocation Language systems provide an important hidden player: Runtime memory manager – Activation.
Heap storage & Garbage collection Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
GARBAGE COLLECTION IN AN UNCOOPERATIVE ENVIRONMENT Hans-Juergen Boehm Computer Science Dept. Rice University, Houston Mark Wieser Xerox Corporation, Palo.
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.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo 1 Memory management & paging.
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.
Lecture 7 Page 1 CS 111 Summer 2013 Dynamic Domain Allocation A concept covered in a previous lecture We’ll just review it here Domains are regions of.
® 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.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Memory Management What if pgm mem > main mem ?. Memory Management What if pgm mem > main mem ? Overlays – program controlled.
Memory Management.
Topic: Java Garbage Collection
Memory Management 6/20/ :27 PM
Chapter 9 – Real Memory Organization and Management
CS 153: Concepts of Compiler Design November 28 Class Meeting
Concepts of programming languages
Chapter 8: Main Memory.
Optimizing Malloc and Free
CS Introduction to Operating Systems
Simulated Pointers.
David F. Bacon, Perry Cheng, and V.T. Rajan
Simulated Pointers.
Lecture 32 Syed Mansoor Sarwar
Adaptive Code Unloading for Resource-Constrained JVMs
Chapter 12 Memory Management
Heap storage & Garbage collection
Heap storage & Garbage collection
Garbage collection Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
COMP755 Advanced Operating Systems
Run-time environments
CMPE 152: Compiler Design May 2 Class Meeting
Presentation transcript:

Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages & Systems November 27, 2001

Introduction Fragmentation is a serious problem in dynamic memory management. Most Java garbage collection algorithms are not adequate to handle fragmentation in real-time systems. A non-moving garbage collection algorithm eliminates fragmentation.

Internal and External Fragmentation Internal: “Memory lost due to the allocator’s policy of object alignment and padding.” External: “Memory lost because free memory is non-contiguous in a way that an allocation request cannot be satisfied even though the total amount of free memory would be sufficient for the request.”

Moving Collectors Moves memory in a way that free memory is contiguous. Compacting mark & sweep collector used in the Sun JDK. All references to an object that has moved must be updated. This can be avoided with forwarding pointers.

Fixed Size Blocks Heap is divided into a set of equal size blocks. Allocations are satisfied with a set of possibly non-contiguous blocks. Blocks don’t move. Any block can satisfy any allocation request.

Building Objects Out of Blocks A linked-list of blocks is used to represent Java objects. Typical Java object is between 12 and 23 bytes. One word per block is reserved for the link.

Linked-List Example Field 2 Link Type Field 1 Field 5 Link Field 3 Field 4 Field 6 Field 7  Object with 7 fields composed out of 3 blocks of 16 bytes each.

Building Arrays Out Of Blocks A linked-list would impose a very high cost on array accesses. A tree can be used to represent arrays. Depth of tree is stored in the array. Array data is stored in the leaf nodes only.

Tree Example Depth: 2 Elements Array Type Length: 11 Link Link 0..3 Link 4..7 Data[2] Data[3] Data[0] Data[1] Data[6] Data[7] Data[4] Data[5] Data[10] Data[8] Data[9]  Tree representation of an array of 11 word elements composed out of 5 blocks of 16 bytes.

Optimizing Arrays Use linear representation for arrays whenever possible. Can be used whenever a sufficiently large contiguous range of free blocks is available and can be found quickly enough. Try for linear representation, if not available, use tree representation.

Moving Collectors & References If an object is moved, all references to it must be updated. All reference variables must be known and modifiable by the collector. Handles can be used to avoid changing all references to an object. Incurs significant run-time overhead. Objects still might be accessed directly by compiled code.

Non-Moving Collectors & References Objects are never moved. Collector does not have to update references. Collector only needs to find 1 reference to an object. Handles are not needed. Compiler may use direct references to objects without informing the garbage collector.

Moving Large Objects Moving collector must move objects atomically. This could create a long pause that is unacceptable for real-time systems. Incremental moving would impose an unacceptable run-time overhead. Non-moving collector never moves objects so this is not a problem.

Scanning Large Objects Moving collectors will typically atomically scan an object for references during the mark phase. This could create a long pause that is unacceptable for real-time systems. Non-moving collectors scan blocks for references. All blocks are same size, so there is an constant worst-case upper bound.

The Jamaica Virtual Machine Implementation of a JVM and static compiler that use fixed-size blocks. Arrays are allocated in the contiguous representation if possible. The first free range in the free list and the largest free range found during the last garbage collection cycle are checked. If a large enough chunk of memory is not found then the tree representation is used.

The Jamaica Virtual Machine Garbage Collection Algorithm Does not know about Java objects. Works on fixed-size blocks. Simple mark and sweep collector Reference-bit-vector is used to indicate if each word on the heap is a reference. Activated whenever an allocation is performed.

Block Size Different applications will perform best with different block sizes. Jamaica VM Block size is configurable between 16 and 128 bytes. Optimal general block size is 32 bytes.

Run-Time Performance Run-Time performance of the SPECjvm98 benchmarks using different block sizes

Memory Performance Minimum heap required for different block sizes

Memory Performance Amount of memory allocated for contiguous arrays, tree arrays, and objects for different block sizes

Memory Performance Number of memory accesses performed for array elements and object fields using different block sizes

Memory Performance Average number of memory accesses required to access object fields and array elements for different block sizes

Conclusion A new object model using fixed-size blocks to avoid fragmentation has been presented. This model gives hard real-time guarantees concerning fragmentation that traditional garbage collectors cannot. Applications that do not require hard real-time behavior can benefit.

References Fridtjof Siebert: Eliminating External Fragmentation in a Non-Moving Garbage Collector For Java, Compilers, Architectures and Synthesis for Embedded Systems (CASES), San Jose, December 1999 Fridtjof Siebert: Hard Real-Time Garbage Collection in the Jamaica Virtual Machine, Real-Time Computing Systems and Applications (RTCSA ’99), Hong Kong, December 1999