Dynamic Storage Reclamation Course Introduction Roll call and - - PowerPoint PPT Presentation

dynamic storage reclamation
SMART_READER_LITE
LIVE PREVIEW

Dynamic Storage Reclamation Course Introduction Roll call and - - PowerPoint PPT Presentation

Dynamic Storage Reclamation Course Introduction Roll call and introductions Name (nickname) Hometown Local residence Major(s) Something exciting you did over the break 2 Administrivia! Background Syllabus Schedule


slide-1
SLIDE 1

Dynamic Storage Reclamation Course Introduction

slide-2
SLIDE 2

Roll call and introductions

 Name (nickname)  Hometown  Local residence  Major(s)  Something exciting you did over the break

2

slide-3
SLIDE 3

Administrivia!

 Background  Syllabus  Schedule  Index page  First assignment due next Tuesday

3

slide-4
SLIDE 4

4

Course logistics

 Goals

 Explore GC  Perform research

 Discussion and presentations

 Read and present papers

 Individual or group project

 Build a collector

 Documentation

 Important part of project

slide-5
SLIDE 5

Key concepts in managing memory

 Key challenges and key ideas

 Explicit vs Automated memory management

 In which languages is each done?  Why?

 Memory allocation

 Contiguous allocation  Free-list allocation

 Memory reclamation

 Tracing  Reference counting

5

slide-6
SLIDE 6

What is memory management?

 Programs contain

 Objects  Data  Occupy memory

 Runtime system must allocate and reclaim memory for

program in an efficient manner

 Why is this important?  Why is this hard?  Why is this interesting?

6

slide-7
SLIDE 7

Allocation and Reclamation

 Allocation

 Objects dynamically allocated on HEAP  malloc(), new()

 Reclamation

 Manual/Explicit

 free()  delete()

 Automated

 Garbage collection (GC)

7

slide-8
SLIDE 8

Explicit memory management pluses

 Efficiency can be very high  Puts the programmer in control

8

slide-9
SLIDE 9

Explicit memory management challenges

 Consumes software development time

 new  allocate storage for new object  delete  reclaim storage

 Prone to software faults (reclaim too soon)

9

Foo* p = new Foo(); Foo* q = p; delete p; p->DoSomething(); p = NULL; q->ProcessFoo();

  • Statically undecidable
  • Problem for developers
slide-10
SLIDE 10

Explicit memory management challenges

 Memory leak (never reclaim)

10

#include <stdlib.h> void f(void){ void* s; s = malloc(50); return; } int main(void){ while (1) f(); return 0; }

slide-11
SLIDE 11

Automated memory management

 Runtime system automatically

 Detects dead objects (garbage detection)  Reclaims dead objects (garbage reclamation)  Garbage collection

 Preserves software development time

 Relieves programmer burden  Less prone to errors

 Utilized by most modern OOP and scripting

languages

 Python, Java, C#, php

11

slide-12
SLIDE 12

Garbage collection challenges

 Occurs an unpredictable

times

 Duration is unbounded  Performance efficiency

issues

12

public void f(){ startLaser(); Obj o = new Obj(); stopLaser(); } public static void main(…){ while (true) f(); } Time

GC, Bad for Real- Time

slide-13
SLIDE 13

Major concerns

 Explicit memory management

 Reclaiming objects at the right time

 Garbage collection

 Discriminating live objects from garbage

 Both

 Fast allocation  Fast reclamation  Low fragmentation

13