Lecture 36: Programming Languages & Memory Management Announcements & Review Read Ch GU1 & GU2 Cohoon & Davidson Ch 14 Reges & Stepp Lab 10 set game due.

Slides:



Advertisements
Similar presentations
Dynamic Memory Management
Advertisements

Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Hastings Purify: Fast Detection of Memory Leaks and Access Errors.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
CPSC 388 – Compiler Design and Construction
CSC321: Programming Languages 11-1 Programming Languages Tucker and Noonan Chapter 11: Memory Management 11.1 The Heap 11.2 Implementation of Dynamic Arrays.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
CS 1114: Data Structures – memory allocation Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
CS 1114: Data Structures – Implementation: part 1 Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
CS 153 Design of Operating Systems Spring 2015
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Run time vs. Compile time
Memory Allocation and Garbage Collection. Why Dynamic Memory? We cannot know memory requirements in advance when the program is written. We cannot know.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Linked lists and memory allocation Prof. Noah Snavely CS1114
Lecture 1CS 380C 1 380C Last Time –Course organization –Read Backus et al. Announcements –Hadi lab Q&A Wed 1-2 in Painter 5.38N –UT Texas Learning Center:
Reference Counters Associate a counter with each heap item Whenever a heap item is created, such as by a new or malloc instruction, initialize the counter.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
Names and Bindings Introduction Names Variables The concept of binding Chapter 5-a.
Garbage Collection and High-Level Languages Programming Languages Fall 2003.
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.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Overview of the Course Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University.
Advanced Programming Collage of Information Technology University of Palestine, Gaza Prepared by: Mahmoud Rafeek Alfarra Lecture 2: Major Concepts of Programming.
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
Introduction and Overview Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 1-Introduction to Java Topic 1.1 Basics of Java Produced by Harvey Peters, 2008 Copyright.
Lecture 11 Page 1 CS 111 Online Memory Management: Paging and Virtual Memory CS 111 On-Line MS Program Operating Systems Peter Reiher.
OOPLs /FEN March 2004 Object-Oriented Languages1 Object-Oriented Languages - Design and Implementation Java: Behind the Scenes Finn E. Nordbjerg,
MEMORY ORGANIZTION & ADDRESSING Presented by: Bshara Choufany.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Chapter 4 – Threads (Pgs 153 – 174). Threads  A "Basic Unit of CPU Utilization"  A technique that assists in performing parallel computation by setting.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Operating Systems Lecture 14 Segments Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software Engineering.
CSE 425: Control Abstraction I Functions vs. Procedures It is useful to differentiate functions vs. procedures –Procedures have side effects but usually.
CS333 Intro to Operating Systems Jonathan Walpole.
1 Lecture07: Memory Model 5/2/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
(Superficial!) Review of Uniprocessor Architecture Parallel Architectures and Related concepts CS 433 Laxmikant Kale University of Illinois at Urbana-Champaign.
Introduction to Garbage Collection. Garbage Collection It automatically reclaims memory occupied by objects that are no longer in use It frees the programmer.
LECTURE 19 Subroutines and Parameter Passing. ABSTRACTION Recall: Abstraction is the process by which we can hide larger or more complex code fragments.
Lecture 1 Page 1 CS 111 Summer 2013 Important OS Properties For real operating systems built and used by real people Differs depending on who you are talking.
GARBAGE COLLECTION Student: Jack Chang. Introduction Manual memory management Memory bugs Automatic memory management We know... A program can only use.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Dynamic Bug Detection & Tolerance Kathryn S McKinley The University of Texas at Austin.
CSC 533: Programming Languages Spring 2016
CMSC 611: Advanced Computer Architecture
Non Contiguous Memory Allocation
Jonathan Walpole Computer Science Portland State University
CSC 533: Programming Languages Spring 2015
Outline Paging Swapping and demand paging Virtual memory.
Basic Performance Parameters in Computer Architecture:
Chapter 9 – Real Memory Organization and Management
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Chapter 9: Virtual-Memory Management
Arrays and Linked Lists
Page Replacement.
Closure Representations in Higher-Order Programming Languages
Miss Rate versus Block Size
CSE 451: Operating Systems Autumn 2005 Memory Management
File-System Structure
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Introduction to Computer Systems
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSC 533: Programming Languages Spring 2019
Presentation transcript:

Lecture 36: Programming Languages & Memory Management Announcements & Review Read Ch GU1 & GU2 Cohoon & Davidson Ch 14 Reges & Stepp Lab 10 set game due 4/26 Exam 2 Wed 5/2 5:30-7:30 GEO Last few times: GUI Today: Research in Programming Languages introduction to memory management

Lecture 36: Programming Languages & Memory Management Software Developer Dreams

Lecture 36: Programming Languages & Memory Management Software Developer Dreams Easy to implement specifications Easy to get correct Robust to errors of all sorts Easy to maintain Runs fast

Lecture 36: Programming Languages & Memory Management Impediments to the Dream Applications growing bigger & more complex –Application knowledge spread thin –Testing is not enough Architectures growing more complex –Single core complexity –Multicore The glue is more complicated –Dynamic optimization & runtime systems –Coordination between multiple languages and runtime systems –Impossible to test all scenarios Difficult to understand the program or its runtime behavior

Lecture 36: Programming Languages & Memory Management Multi-pronged Approach to Correct High Performance Software Better languages –Java and C# are not the last programming languages Validation when possible –We probably will not be able to validate substantial parallel applications any time soon –Is application growth outpacing validation advances? Analysis and development tools –Static bug finding tools –Dynamic optimization –Dynamic bug finding tools Self healing systems –Don’t crash Dynamically updatable systems Evaluation Performance still matters unobtrusive, low overhead approaches

Lecture 36: Programming Languages & Memory Management Java put garbage collection into widespread use In Java –programs use “new” –objects abstract their location, i.e., a program never records an object address –Therefore, objects can move –programs contain no “free/delete” –easier to program, since you don’t have to figure out when an object becomes unreachable In C and C++ –programmers use “new” and “free/delete” –programs can record the address of an object in variables which causes errors, e.g., buffer overflow –Therefore, objects may not move

Lecture 36: Programming Languages & Memory Management Example Program with classes for plates, bowls, & silverware What happens in memory when the program says new?

Lecture 36: Programming Languages & Memory Management Select Plates, Bowls, Silverware Objects

Lecture 36: Programming Languages & Memory Management Select Plates, Bowls, Silverware

Lecture 36: Programming Languages & Memory Management Explicit Memory Management: Hand Wash Dishes

Lecture 36: Programming Languages & Memory Management Explicit Memory Management: Hand Wash Dishes

Lecture 36: Programming Languages & Memory Management Explicit Memory Management: Hand Wash Dishes

Lecture 36: Programming Languages & Memory Management Explicit Memory Management: Hand Wash Dishes

Lecture 36: Programming Languages & Memory Management Explicit Memory Management: Hand Wash Dishes

Lecture 36: Programming Languages & Memory Management Dish Washer: Automatic Memory Management Garbage Collection Dad is the garbage collector Do forever –Prepare meal –Select plates, bowls, silverware –Serve food & Eat –Dad put dishes in dishwasher Dad checks if dishwasher full or Out of plates, bowls or silverware –Dad runs dishwasher

Lecture 36: Programming Languages & Memory Management Select Plates, Bowls, Silverware

Lecture 36: Programming Languages & Memory Management Select Plates, Bowls, Silverware

Lecture 36: Programming Languages & Memory Management Dad Runs Dish Washer & Puts Up Dishes

Lecture 36: Programming Languages & Memory Management Memory System Organization Registers CPU Central Processing Unit Instruction Cache Data Cache Level 2 Cache Memory

Lecture 36: Programming Languages & Memory Management Mapping Dishes to Computer Resources Class Declarations chunks of memory

Lecture 36: Programming Languages & Memory Management Contiguous Allocation Plate p = new Plate();

Lecture 36: Programming Languages & Memory Management Contiguous Allocation Plate p1 = new Plate(); Plate p2 = new Plate(); Bowl b1 = new Bowl(); Fork f1 = new Fork(); Fork f2 = new Fork(); Spoon s1 = new Spoon();

Lecture 36: Programming Languages & Memory Management Contiguous Allocation etc.

Lecture 36: Programming Languages & Memory Management Explicit Memory Management Free with Continuous Allocation Free (b3)

Lecture 36: Programming Languages & Memory Management Free with Contiguous Allocation Free (b3) Free (s1)

Lecture 36: Programming Languages & Memory Management Garbage Collection with Contiguous Allocation Wait longer

Lecture 36: Programming Languages & Memory Management Garbage Collection with Contiguous Allocation Find live objects: L LL LL

Lecture 36: Programming Languages & Memory Management Find live objects: L Copy live objects to new area L Garbage Collection with Contiguous Allocation

Lecture 36: Programming Languages & Memory Management Find live objects: L Copy live objects to new area Reclaim old space L Garbage Collection with Contiguous Allocation

Lecture 36: Programming Languages & Memory Management Find live objects: L Copy them to new area Reclaim old space Allocate into new space Garbage Collection with Contiguous Allocation

Lecture 36: Programming Languages & Memory Management Allocation with Size-Class Free-Lists

Lecture 36: Programming Languages & Memory Management Free (b3) Free (s1) Allocation with Size-Class Free-Lists

Lecture 36: Programming Languages & Memory Management We can use linked lists for each list of free sizes to find the free ones Allocation with Size-Class Free-Lists... free list size 24 bytes free list size 20 bytes

Lecture 36: Programming Languages & Memory Management Memory Management All memory management uses one of these two basic mechanisms –Contiguous allocation –Size-Class Free-Lists Classic Computer Science Problem in Space-Time tradeoff

Lecture 36: Programming Languages & Memory Management Other Key Ideas in Memory Management Locality Incrementality Generational behavior Older-first behavior –My research group introduced this one!