Precise Garbage Collection for C. Jon Rafkind * Adam Wick + John Regehr * Matthew Flatt *
|
|
- Gabriel Simpson
- 6 years ago
- Views:
Transcription
1 Slide No. 1 Precise Garbage Collection for C Jon Rafkind * Adam Wick + John Regehr * Matthew Flatt * * University of Utah + Galois, Inc.
2 Slide No. 2 Motivation C Used to implement important programs Web servers Operating systems Virtual machines Memory management is difficult to get right
3 Slide No. 3 Conservative GC Scans for pointer values Works well for weakly typed languages Objects are stored in memory as sequences of bytes Unobtrusive to the original program Works for many C programs
4 Slide No. 4 Liveness void * void * void * Registers
5 Slide No. 5 Liveness Boehm 02 void * void * void * Registers Long running programs have possibility of liveness errors
6 Slide No. 6 Liveness inaccuracy Machine state outside the realm of C Registers Non-pointer values as pointers void * x long y 0xba xbd100000
7 Slide No. 7 Mitigating liveness Atomic blocks (memory regions with no pointers) Custom tracers Liveness errors have non-zero chance of occurring
8 Slide No. 8 thread 1 Memory leaks thread 2 thread 3 void * void * void * Heap size (mb) conservative Iterations
9 Slide No. 9 Precise GC void * void * void * Root
10 Slide No. 10 Precise GC Liveness is apparent at the source level struct painter * p =...; p->brush =...; p->color =...; p->brush = 0;
11 Slide No. 11 Precise GC Successfully added a precise garbage collector to long running C programs PLT Scheme ZSnes Emulator Nano text editor Linux
12 Slide No. 12 Precise All live objects must be reachable through pointers starting from roots Run-time type of objects must match their static allocation type
13 Slide No. 13 Precise for C All live objects must be reachable through pointers starting from roots Globals Stack Source to source transformation Run-time type of objects must match their static allocation type Type information
14 Slide No. 14 Insight C programs provide enough type information to precisely distinguish pointers from non-pointers
15 Slide No. 15 Transformation Register global variables as roots Dynamically register stack variables Rewrite allocations with run-time information Add traversal routines for structures
16 Slide No. 16 Precise for C All live objects must be reachable through pointers starting from roots Globals Stack Run-time type of objects must match their static allocation type Type information
17 Slide No. 17 Roots int * counter; int * maker(int * value){ int * x = malloc(10); *x = *value; *counter += 1; return x; }
18 Slide No. 18 int * counter; int * maker(int * value){ int * x = malloc(10); *x = *value; *counter += 1; Shadow stack void * frame[3]; frame[0] = POINTER; frame[1] = &x; frame[2] = &value; GC_set_stack(frame); Henderson 02 } return x;
19 Slide No. 19 int * counter; int * maker(int * value){ int * x = GC_malloc(10); *x = *value; *counter += 1; Shadow stack void * frame[3]; frame[0] = POINTER; frame[1] = &x; frame[2] = &value; GC_set_stack(frame); Henderson 02 } return x; GC_set_stack(last_stack);
20 Slide No. 20 Shadow stack Garbage collection Roots Globals Stack Frame Stack Frame Stack Frame
21 Slide No. 21 Stack optimizations Call graph analysis detects functions that do not need shadow stacks Potentially allocates Does not allocate Need shadow stacks Gzip: 80% non-allocating H264: 40% non-allocating Don't need shadow stacks
22 Slide No. 22 Precise for C All live objects must be reachable through pointers starting from roots Globals Stack Run-time type of objects must match their static allocation type Type information
23 Allocation rules Heuristic used to statically detect run-time type var = malloc(<expr>); sizeof(t) allocate single t structure sizeof(t) * e allocate array of t structures sizeof(t*) * e allocate pointer array e allocate atomic block Slide No. 23
24 Slide No. 24 Transforming allocations var = malloc(sizeof(struct cat)); sizeof(t) allocate single t structure sizeof(t) * e allocate array of t structures sizeof(t*) * e allocate pointer array e allocate atomic block var = GC_malloc(gc_tag_struct_cat, sizeof(struct cat));
25 Slide No. 25 Traversal functions struct cat { int * paws; char * nose; }; Used during mark phase void gc_struct_cat_mark(struct cat * c){ GC_mark(c->paws); GC_mark(c->nose); } void gc_struct_cat_repair(struct cat * c){ GC_repair(&c->paws); GC_repair(&c->nose); } Generate traversal functions Updates references to moved objects
26 Slide No. 26 Result of transformation The transformed source program will operate semantically equivalent to what it did before and is capable of supporting a moving collector
27 Slide No. 27 Internal pointers C Support Int * x = obj->x; Pointer arithmetic char * p =...; while (*p){ p++; }
28 Slide No. 28 Unions Active variant is tracked union object { int value; void * info; }; union object o; o.value = 1; GC_autotag(&o, 0); o.info = get(); GC_autotag(&o, 1);
29 Slide No. 29 External libraries Libraries that store pointers Annotate objects that should not be moved by the collector Memory allocated by libraries Safe to use because the GC will ignore it
30 Slide No. 30 Unsupported C Pointer obfuscation int * p = malloc(20); p - = 10; p[10] = 2; GC cannot traverse the pointer Pointers as integers long make(){ return malloc(); } GC cannot find pointer Ruby Constructing pointers int * x = (int*) 0x323429; Liveness issues Arrays of open sized arrays struct foo{ char rest[0]; }; GC doesn't know how large individual elements are Perl
31 Slide No. 31 Tool support GUI that verifies allocation heuristic and traversal functions
32 Slide No. 32 Tool support Two tools that can be used on C programs ~2500 line Ocaml program based on CIL (Necula 2002) Capable of parsing the Linux kernel source Fully automatic
33 Slide No. 33 Benchmarks Precise vs Conservative memory runtime Source transformation overhead
34 Slide No. 34 Precise is bounded Heap size (mb) conservative precise Repeated executions of drscheme Iterations
35 Slide No. 35 PLT Scheme Performance Benchmark: CPStack GC Mutator Duration (ms) conservative precise
36 Slide No. 36 PLT Scheme Performance Benchmark: Takl Duration (ms) GC Mutator 0 conservative precise
37 Slide No. 37 GC overhead Spec 2k benchmarks Slowdown % vpr gzip twolf hmmer h264 lame Benchmark
38 Slide No. 38 Linux kernel Test the limits of precise for C Longest running program in a system Harsh C environment
39 Slide No. 39 Linux kernel: Implementation Transformed 74,975 lines of C code Ext3 and ipv4 85 manual changes GC is non-moving / non-generational Interface to non-transformed modules
40 Slide No. 40 Linux kernel: Stack Stack limit reached with additional shadow stack information Over 4k
41 Linux kernel: Memory regions Separate memory regions kmalloc Physically contiguous Slide No. 41 vmalloc Virtually contiguous GC only returns physically contiguous memory
42 Slide No. 42 Linux kernel: heuristics Allocation heuristic broken X = kmalloc(sizeof(...)) Y = kmem_cache_alloc(cache) Type of Y is cannot be discerned
43 Slide No. 43 Linux kernel: finalizers RCU (Read-Copy-Update) is a finalizer mechanism in Linux CPU 1 CPU 3 CPU 2 CPU 4
44 Slide No. 44 Performance dbench filesystem benchmark GC Normal GC every second
45 Slide No. 45 dd on memory filesystem Performance dd on disk filesystem
46 Slide No. 46 Conclusions Precise garbage collection is a practical for C because most C programs embed enough information required to extract the required properties Long running programs benefit from precise garbage collection Thank you rafkind@cs.utah.edu
47 Slide No. 47 Precise Garbage Collection for C Jon Rafkind Adam Wick John Regehr Matthew Flatt
48 Slide No. 48
49 Slide No. 49 Precise Garbage Collection for C C is a weakly typed language Magpie Written a tool that makes C programs use precise garbage collection Applied to PLT Scheme, Linux kernel, benchmarks
50 Garbage Collection Techniques Slide No. 50 Precise collection Conservative collection
51 Garbage Collection Techniques Slide No. 51 Precise collection Conservative collection
52 Slide No. 52 Garbage Collection Techniques Precise collection Conservative collection int void* void* void* void*
53 Slide No. 53 Linked lists Thread 1 Thread 2 Lists of threads and stacks create unreclaimable chains Thread 3
54 Slide No. 54 Long running programs Web servers, OS's, etc can experience unstable memory usage with conservative collectors
55 Slide No. 55 Background Core of Drscheme written in C 10+ years of managing Boehm collector
56 Slide No. 56 Conservative collection Certain classes of programs are susceptible to memory leaks
57 Slide No. 57 Other programs ZSNes emulator Super Nintendo emulator Nano text editor Unbounded memory with conservative, stable with precise
58 Slide No. 58 Main idea Source to source transformation of C code can embed information to let precise garbage collection work: Invariants: All pointers are known Run-time type of objects is the same as their static allocation type
59 Slide No. 59 Precise Registers are not scanned for pointers All live pointers in the system are known stack Type information Roots Object Shapes
60 Slide No. 60 Precise Source transformation to retain this information stack Type information Roots Object Shapes
61 Slide No. 61 Allocation rules var = malloc(<expr>); sizeof(t) allocate single t structure sizeof(t) * e allocate array of t structures sizeof(t*) * e allocate pointer array e allocate atomic block
62 Slide No. 62 Copying hybrid-compacting Traverse objects: Marking Updating pointers collector
63 Slide No. 63 struct cat{ int * paws; char * nose; }; Traversal functions void gc_struct_cat_mark(struct cat * c){ GC_mark(c->paws); GC_mark(c->nose); } void gc_struct_cat_repair(struct cat * c){ GC_repair(&c->paws); GC_repair(&c->nose); } Generate traversal functions
64 Slide No. 64 Unions Active variant is tracked union object{ int value; void * info; }; union object o; o.value = 1; GC_autotag(&o, 0); o.info = get(); GC_autotag(&o, 1);
65 Slide No. 65 Unsupported idioms Pointer obfuscation int * p = malloc(20); p - = 10; p[10] = 2; Pointers as integers int make(){ return malloc(); } Constructing pointers Int * x = (int*) 0x323429; Arrays of open sized arrays struct foo{ char rest[0]; };
66 Slide No. 66 Mzscheme Performance Benchmark: CPStack Conservative GC Precise GC 0 conservative precise
67 Slide No. 67 Mzscheme Performance 1.2 Benchmark: Takl Conservative precise conservative precise
68 Slide No. 68 Spec Performance Factor vpr gzip twolf hmmer h264 lame Benchmark
69 Slide No. 69 Tool support Two tools that can be used on C programs
70 Slide No. 70 Tool support Two tools that can be used on C programs Based on Cil (Necula 2002) Parses C and GCC extensions Fully automatic
71 Slide No. 71 Linux Too large to fully transform Subsystems: Ext3 IPV4
72 Slide No. 72 Linux User Mode Linux stack is limited to 4k GC shadow stack went over this limit Shadow stack
73 Slide No. 73 Linux Manual changes RCU (Read-Copy-Update) finalizers Important structures allocated with vmalloc Custom allocators (kmem_cache_alloc)
74 Slide No. 74 Performance GC can cause high latencies
75 Slide No. 75 Performance GC overhead
76 Slide No. 76 Conclusions Precise garbage collection is a practical alternative for C Long running programs benefit from precise garbage collection
77 Slide No. 77 Mzscheme Performance CPStack Takl conservative precise
Precise Garbage Collection for C
Precise Garbage Collection for C Jon Rafkind Adam Wick John Regehr Matthew Flatt University of Utah rafkind@cs.utah.edu Galois, Inc. awick@galois.com University of Utah regehr@cs.utah.edu University of
More informationProgramming Language Implementation
A Practical Introduction to Programming Language Implementation 2014: Week 10 Garbage Collection College of Information Science and Engineering Ritsumeikan University 1 review of last week s topics dynamic
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle
More informationGarbage Collection. Weiyuan Li
Garbage Collection Weiyuan Li Why GC exactly? - Laziness - Performance - free is not free - combats memory fragmentation - More flame wars Basic concepts - Type Safety - Safe: ML, Java (not really) - Unsafe:
More informationA new Mono GC. Paolo Molaro October 25, 2006
A new Mono GC Paolo Molaro lupus@novell.com October 25, 2006 Current GC: why Boehm Ported to the major architectures and systems Featurefull Very easy to integrate Handles managed pointers in unmanaged
More informationAcknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides
Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 Spring 2017 1 Memory Attributes Memory to store data in programming languages has the following lifecycle
More informationRuntime. The optimized program is ready to run What sorts of facilities are available at runtime
Runtime The optimized program is ready to run What sorts of facilities are available at runtime Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis token stream Syntactic
More informationDynamic Memory Allocation
Dynamic Memory Allocation CS61, Lecture 11 Prof. Stephen Chong October 6, 2011 Announcements 1/2 Reminder: No section on Monday Monday sections have been rescheduled See website for details Please attend
More informationCMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle
More informationMotivation for Dynamic Memory. Dynamic Memory Allocation. Stack Organization. Stack Discussion. Questions answered in this lecture:
CS 537 Introduction to Operating Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department Dynamic Memory Allocation Questions answered in this lecture: When is a stack appropriate? When is
More informationMAGPIE: PRECISE GARBAGE COLLECTION FOR C
MAGPIE: PRECISE GARBAGE COLLECTION FOR C by Adam Wick A dissertation submitted to the faculty of The University of Utah in partial fulfillment of the requirements for the degree of Doctor of Philosophy
More informationGarbage Collection Basics
Garbage Collection Basics 1 Freeing memory is a pain Need to decide on a protocol (who frees what when?) Pollutes interfaces Errors hard to track down Remember 211 / 213?... but lets try an example anyway
More informationGarbage Collection. Vyacheslav Egorov
Garbage Collection Vyacheslav Egorov 28.02.2012 class Heap { public: void* Allocate(size_t sz); }; class Heap { public: void* Allocate(size_t sz); void Deallocate(void* ptr); }; class Heap { public: void*
More informationReference Counting. Reference counting: a way to know whether a record has other users
Garbage Collection Today: various garbage collection strategies; basic ideas: Allocate until we run out of space; then try to free stuff Invariant: only the PL implementation (runtime system) knows about
More informationGarbage Collection. CS 351: Systems Programming Michael Saelee
Garbage Collection CS 351: Systems Programming Michael Saelee = automatic deallocation i.e., malloc, but no free! system must track status of allocated blocks free (and potentially reuse)
More informationCS61C Midterm Review on C & Memory Management
CS61C Midterm Review on C & Memory Management Fall 2006 Aaron Staley Some material taken from slides by: Michael Le Navtej Sadhal Overview C Array and Pointer Goodness! Memory Management The Three Three
More informationPerformance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs
Performance of Non-Moving Garbage Collectors Hans-J. Boehm HP Labs Why Use (Tracing) Garbage Collection to Reclaim Program Memory? Increasingly common Java, C#, Scheme, Python, ML,... gcc, w3m, emacs,
More informationDesign Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8
Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns
More informationCS61, Fall 2012 Section 2 Notes
CS61, Fall 2012 Section 2 Notes (Week of 9/24-9/28) 0. Get source code for section [optional] 1: Variable Duration 2: Memory Errors Common Errors with memory and pointers Valgrind + GDB Common Memory Errors
More informationDynamic Memory Allocation II October 22, 2008
15-213 Dynamic Memory Allocation II October 22, 2008 Topics Explicit doubly-linked free lists Segregated free lists Garbage collection Review of pointers Memory-related perils and pitfalls class18.ppt
More informationAgenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1
Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies
More informationDynamic Data Structures. CSCI 112: Programming in C
Dynamic Data Structures CSCI 112: Programming in C 1 It s all about flexibility In the programs we ve made so far, the compiler knows at compile time exactly how much memory to allocate for each variable
More informationSE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms
SE352b Software Engineering Design Tools W3: Programming Paradigms Feb. 3, 2005 SE352b, ECE,UWO, Hamada Ghenniwa SE352b: Roadmap CASE Tools: Introduction System Programming Tools Programming Paradigms
More informationunsigned char memory[] STACK ¼ 0x xC of address space globals function KERNEL code local variables
Graded assignment 0 will be handed out in section Assignment 1 Not that bad Check your work (run it through the compiler) Factorial Program Prints out ENTERING, LEAVING, and other pointers unsigned char
More informationMemory Management: The Details
Lecture 10 Memory Management: The Details Sizing Up Memory Primitive Data Types Complex Data Types byte: char: short: basic value (8 bits) 1 byte 2 bytes Pointer: platform dependent 4 bytes on 32 bit machine
More informationSafe Manual Memory Management
Safe Manual Memory Management David Gay Rob Ennals Eric Brewer Intel Research Berkeley {david.e.gay,robert.ennals,eric.a.brewer}@intel.com Abstract We present HeapSafe, a tool that uses reference counting
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2017 Lecture 3a Andrew Tolmach Portland State University 1994-2017 Binding, Scope, Storage Part of being a high-level language is letting the programmer name things: variables
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.
More informationReview. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young
Generational GC 1 Review Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young 2 Single-partition scanning Stack Heap Partition #1 Partition
More informationHeap Compression for Memory-Constrained Java
Heap Compression for Memory-Constrained Java CSE Department, PSU G. Chen M. Kandemir N. Vijaykrishnan M. J. Irwin Sun Microsystems B. Mathiske M. Wolczko OOPSLA 03 October 26-30 2003 Overview PROBLEM:
More informationToolbox Kernel Korner
Toolbox Kernel Korner In this article, Robert offers a refresher on kernel memory allocation and how it has changed for the 2. by Robert Love Unfortunately for kernel developers, allocating memory in the
More informationSustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)
COMP 412 FALL 2017 Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) Copyright 2017, Keith D. Cooper & Zoran Budimlić, all rights reserved. Students enrolled in Comp 412 at Rice
More informationDynamic Memory Allocation: Advanced Concepts
Dynamic Memory Allocation: Advanced Concepts Keeping Track of Free Blocks Method 1: Implicit list using length links all blocks 5 4 6 Method : Explicit list among the free blocks using pointers 5 4 6 Kai
More informationCling: A Memory Allocator to Mitigate Dangling Pointers. Periklis Akritidis
Cling: A Memory Allocator to Mitigate Dangling Pointers Periklis Akritidis --2010 Use-after-free Vulnerabilities Accessing Memory Through Dangling Pointers Techniques : Heap Spraying, Feng Shui Manual
More informationShort-term Memory for Self-collecting Mutators. Martin Aigner, Andreas Haas, Christoph Kirsch, Ana Sokolova Universität Salzburg
Short-term Memory for Self-collecting Mutators Martin Aigner, Andreas Haas, Christoph Kirsch, Ana Sokolova Universität Salzburg CHESS Seminar, UC Berkeley, September 2010 Heap Management explicit heap
More informationGarbage Collection (1)
Garbage Collection (1) Advanced Operating Systems Lecture 7 This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/
More informationManual Allocation. CS 1622: Garbage Collection. Example 1. Memory Leaks. Example 3. Example 2 11/26/2012. Jonathan Misurda
Manual llocation Dynamic memory allocation is an obvious necessity in a programming environment. S 1622: Garbage ollection Many programming languages expose some functions or keywords to manage runtime
More informationCS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers
CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers Heap allocation is a necessity for modern programming tasks, and so is automatic reclamation of heapallocated memory. However,
More informationGarbage Collection Algorithms. Ganesh Bikshandi
Garbage Collection Algorithms Ganesh Bikshandi Announcement MP4 posted Term paper posted Introduction Garbage : discarded or useless material Collection : the act or process of collecting Garbage collection
More informationJAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder
JAVA PERFORMANCE PR SW2 S18 Dr. Prähofer DI Leopoldseder OUTLINE 1. What is performance? 1. Benchmarking 2. What is Java performance? 1. Interpreter vs JIT 3. Tools to measure performance 4. Memory Performance
More informationCCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs
CCured Type-Safe Retrofitting of C Programs [Necula, McPeak,, Weimer, Condit, Harren] #1 One-Slide Summary CCured enforces memory safety and type safety in legacy C programs. CCured analyzes how you use
More informationMemory Allocation III
Memory Allocation III CSE 351 Winter 2018 Instructor: Mark Wyse Teaching Assistants: Kevin Bi Parker DeWilde Emily Furst Sarah House Waylon Huang Vinny Palaniappan https://xkcd.com/835/ Administrivia Homework
More informationUniSan: Proactive Kernel Memory Initialization to Eliminate Data Leakages
UniSan: Proactive Kernel Memory Initialization to Eliminate Data Leakages Kangjie Lu, Chengyu Song, Taesoo Kim, Wenke Lee School of Computer Science, Georgia Tech Any Problem Here? /* File: drivers/usb/core/devio.c*/
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 16, SPRING 2013 TOPICS TODAY Project 6 Perils & Pitfalls of Memory Allocation C Function Call Conventions in Assembly Language PERILS
More informationLecture 15 Garbage Collection
Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:
More informationCSC C69: OPERATING SYSTEMS
CSC C69: OPERATING SYSTEMS Tutorial 1 Thursday, Jan 17, 2013 TA: Ioan Stefanovici (ioan@cs.toronto.edu) HOW DO YOU SUCCEED IN THIS COURSE? Show up to lectures & tutorials (way too much material) Work on
More informationProgrammer Directed GC for C++ Michael Spertus N2286= April 16, 2007
Programmer Directed GC for C++ Michael Spertus N2286=07-0146 April 16, 2007 Garbage Collection Automatically deallocates memory of objects that are no longer in use. For many popular languages, garbage
More informationReference Counting. Reference counting: a way to know whether a record has other users
Garbage Collection Today: various garbage collection strategies; basic ideas: Allocate until we run out of space; then try to free stuff Invariant: only the PL implementation (runtime system) knows about
More informationGlacier: A Garbage Collection Simulation System
Glacier: A Garbage Collection Simulation System Bruno Dufour Sable Research Group McGill University Glacier: A Garbage Collection Simulation System p.1/19 Outline Introduction Objectives & motivation Requirements
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 4a Andrew Tolmach Portland State University 1994-2017 Semantics and Erroneous Programs Important part of language specification is distinguishing valid from
More informationMemory Allocation III
Memory Allocation III CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Homework 5 Due Wed
More informationCS Computer Systems. Lecture 8: Free Memory Management
CS 5600 Computer Systems Lecture 8: Free Memory Management Recap of Last Week Last week focused on virtual memory Gives each process the illusion of vast, empty memory Offers protection and isolation 31
More informationMyths and Realities: The Performance Impact of Garbage Collection
Myths and Realities: The Performance Impact of Garbage Collection Tapasya Patki February 17, 2011 1 Motivation Automatic memory management has numerous software engineering benefits from the developer
More informationLecture 13: Complex Types and Garbage Collection
Lecture 13: Complex Types and Garbage Collection COMP 524 Programming Language Concepts Stephen Olivier March 17, 2009 Based on slides by A. Block, notes by N. Fisher, F. Hernandez-Campos, and D. Stotts
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level
More informationBinding and Storage. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill
Binding and Storage Björn B. Brandenburg The University of North Carolina at Chapel Hill Based in part on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts. What s
More information6.172 Performance Engineering of Software Systems Spring Lecture 9. P after. Figure 1: A diagram of the stack (Image by MIT OpenCourseWare.
6.172 Performance Engineering of Software Systems Spring 2009 Lecture 9 MIT OpenCourseWare Dynamic Storage Allocation Stack allocation: LIFO (last-in-first-out) Array and pointer A used unused P before
More informationSystem Assertions. Andreas Zeller
System Assertions Andreas Zeller System Invariants Some properties of a program must hold over the entire run: must not access data of other processes must handle mathematical exceptions must not exceed
More informationToday. Dynamic Memory Allocation: Advanced Concepts. Explicit Free Lists. Keeping Track of Free Blocks. Allocating From Explicit Free Lists
Today Dynamic Memory Allocation: Advanced Concepts Explicit free lists Segregated free lists Garbage collection Memory-related perils and pitfalls CSci 01: Machine Architecture and Organization October
More informationFaculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology
Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False
More informationMemory management COSC346
Memory management COSC346 Life cycle of an object Create a reference pointer Allocate memory for the object Initialise internal data Do stuff Destroy the object Release memory 2 Constructors and destructors
More informationName, Scope, and Binding. Outline [1]
Name, Scope, and Binding In Text: Chapter 3 Outline [1] Variable Binding Storage bindings and lifetime Type bindings Type Checking Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur 2
More informationRun-time Environments - 3
Run-time Environments - 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of the Lecture n What is run-time
More informationQualifying Exam in Programming Languages and Compilers
Qualifying Exam in Programming Languages and Compilers University of Wisconsin Fall 1991 Instructions This exam contains nine questions, divided into two parts. All students taking the exam should answer
More informationCompilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1
Compilers 8. Run-time Support Laszlo Böszörmenyi Compilers Run-time - 1 Run-Time Environment A compiler needs an abstract model of the runtime environment of the compiled code It must generate code for
More informationGarbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35
Garbage Collection Akim Demaille, Etienne Renault, Roland Levillain May 15, 2017 CCMP2 Garbage Collection May 15, 2017 1 / 35 Table of contents 1 Motivations and Definitions 2 Reference Counting Garbage
More informationCS842: Automatic Memory Management and Garbage Collection. GC basics
CS842: Automatic Memory Management and Garbage Collection GC basics 1 Review Noting mmap (space allocated) Mapped space Wile owned by program, manager as no reference! malloc (object created) Never returned
More informationData Representation and Storage. Some definitions (in C)
Data Representation and Storage Learning Objectives Define the following terms (with respect to C): Object Declaration Definition Alias Fundamental type Derived type Use pointer arithmetic correctly Explain
More informationCompiler Construction D7011E
Compiler Construction D7011E Lecture 14: Memory Management Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 First: Run-time Systems 2 The Final Component:
More informationParallel Memory Defragmentation on a GPU
Parallel Memory Defragmentation on a GPU Ronald Veldema, Michael Philippsen University of Erlangen-Nuremberg Germany Informatik 2 Programmiersysteme Martensstraße 3 91058 Erlangen Motivation Application
More informationCPSC 213. Introduction to Computer Systems. Instance Variables and Dynamic Allocation. Unit 1c
CPSC 213 Introduction to Computer Systems Unit 1c Instance Variables and Dynamic Allocation 1 Reading For Next 3 Lectures Companion 2.4.4-2.4.5 Textbook Structures, Dynamic Memory Allocation, Understanding
More informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to
More informationOutline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring
Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,
More informationHard Real-Time Garbage Collection in Java Virtual Machines
Hard Real-Time Garbage Collection in Java Virtual Machines... towards unrestricted real-time programming in Java Fridtjof Siebert, IPD, University of Karlsruhe 1 Jamaica Systems Structure Exisiting GC
More informationCPSC 213. Introduction to Computer Systems. Winter Session 2017, Term 2. Unit 1c Jan 24, 26, 29, 31, and Feb 2
CPSC 213 Introduction to Computer Systems Winter Session 2017, Term 2 Unit 1c Jan 24, 26, 29, 31, and Feb 2 Instance Variables and Dynamic Allocation Overview Reading Companion: Reference 2.4.4-5 Textbook:
More informationCS842: Automatic Memory Management and Garbage Collection. Mark and sweep
CS842: Automatic Memory Management and Garbage Collection Mark and sweep 1 Schedule M W Sept 14 Intro/Background Basics/ideas Sept 21 Allocation/layout GGGGC Sept 28 Mark/Sweep Mark/Sweep cto 5 Copying
More informationQ1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100
ECE 2035(A) Programming for Hardware/Software Systems Fall 2013 Exam Three November 20 th 2013 Name: Q1: /8 Q2: /30 Q3: /30 Q4: /32 Total: /100 1/10 For functional call related questions, let s assume
More informationExploiting the Behavior of Generational Garbage Collector
Exploiting the Behavior of Generational Garbage Collector I. Introduction Zhe Xu, Jia Zhao Garbage collection is a form of automatic memory management. The garbage collector, attempts to reclaim garbage,
More informationGarbage Collection. Hwansoo Han
Garbage Collection Hwansoo Han Heap Memory Garbage collection Automatically reclaim the space that the running program can never access again Performed by the runtime system Two parts of a garbage collector
More informationGarbage Collection. Steven R. Bagley
Garbage Collection Steven R. Bagley Reference Counting Counts number of pointers to an Object deleted when the count hits zero Eager deleted as soon as it is finished with Problem: Circular references
More informationCS577 Modern Language Processors. Spring 2018 Lecture Garbage Collection
CS577 Modern Language Processors Spring 2018 Lecture Garbage Collection 1 BASIC GARBAGE COLLECTION Garbage Collection (GC) is the automatic reclamation of heap records that will never again be accessed
More informationMemory Allocation III
Memory Allocation III CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun
More informationIn Java we have the keyword null, which is the value of an uninitialized reference type
+ More on Pointers + Null pointers In Java we have the keyword null, which is the value of an uninitialized reference type In C we sometimes use NULL, but its just a macro for the integer 0 Pointers are
More informationHigh-Level Language VMs
High-Level Language VMs Outline Motivation What is the need for HLL VMs? How are these different from System or Process VMs? Approach to HLL VMs Evolutionary history Pascal P-code Object oriented HLL VMs
More informationCS 5460/6460 Operating Systems
CS 5460/6460 Operating Systems Fall 2009 Instructor: Matthew Flatt Lecturer: Kevin Tew TAs: Bigyan Mukherjee, Amrish Kapoor 1 Join the Mailing List! Reminders Make sure you can log into the CADE machines
More informationhttps://lambda.mines.edu A pointer is a value that indicates location in memory. When we change the location the pointer points to, we say we assign the pointer a value. When we look at the data the pointer
More informationManaged runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley
Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?
More informationDynamic Memory Alloca/on: Advanced Concepts
Dynamic Memory Alloca/on: Advanced Concepts CS 485 Systems Programming Fall 2015 Instructor: James Griffioen Adapted from slides by R. Bryant and D. O Hallaron (hip://csapp.cs.cmu.edu/public/instructors.html)
More informationDAY 3. CS3600, Northeastern University. Alan Mislove
C BOOTCAMP DAY 3 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh and Pascal Meunier s course at Purdue Memory management 2 Memory management Two
More informationECE 598 Advanced Operating Systems Lecture 12
ECE 598 Advanced Operating Systems Lecture 12 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 1 March 2018 Announcements Next homework will be due after break. Midterm next Thursday
More informationIronclad C++ A Library-Augmented Type-Safe Subset of C++
Ironclad C++ A Library-Augmented Type-Safe Subset of C++ Christian DeLozier, Richard Eisenberg, Peter-Michael Osera, Santosh Nagarakatte*, Milo M. K. Martin, and Steve Zdancewic October 30, 2013 University
More informationA program execution is memory safe so long as memory access errors never occur:
A program execution is memory safe so long as memory access errors never occur: Buffer overflows, null pointer dereference, use after free, use of uninitialized memory, illegal free Memory safety categories
More informationManaged runtimes & garbage collection
Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security
More informationDefeat Exploit Mitigation Heap Attacks. compass-security.com 1
Defeat Exploit Mitigation Heap Attacks compass-security.com 1 ASCII Armor Arbitrary Write Overflow Local Vars Exploit Mitigations Stack Canary ASLR PIE Heap Overflows Brute Force Partial RIP Overwrite
More informationExample. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; :
Runtime Environment Relationship between names and data objects (of target machine) Allocation & de-allocation is managed by run time support package Each execution of a procedure is an activation of the
More informationSimple Garbage Collection and Fast Allocation Andrew W. Appel
Simple Garbage Collection and Fast Allocation Andrew W. Appel Presented by Karthik Iyer Background Motivation Appel s Technique Terminology Fast Allocation Arranging Generations Invariant GC Working Heuristic
More informationMemory Management. Disclaimer: some slides are adopted from book authors slides with permission 1
Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 Recap Paged MMU: Two main Issues Translation speed can be slow TLB Table size is big Multi-level page table
More informationImplementation Garbage Collection
CITS 3242 Programming Paradigms Part IV: Advanced Topics Topic 19: Implementation Garbage Collection Most languages in the functional, logic, and object-oriented paradigms include some form of automatic
More informationRobust Memory Management Schemes
Robust Memory Management Schemes Prepared by : Fadi Sbahi & Ali Bsoul Supervised By: Dr. Lo ai Tawalbeh Jordan University of Science and Technology Robust Memory Management Schemes Introduction. Memory
More information