1 / 35

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 2.216. Last few times: GUI Today: Research in Programming Languages introduction to memory management. Announcements & Review. Software Developer Dreams.

cleo
Télécharger la présentation

Announcements & Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 2.216 Last few times: GUI Today: Research in Programming Languages introduction to memory management Announcements & Review Lecture 36: Programming Languages & Memory Management

  2. Software Developer Dreams Lecture 36: Programming Languages & Memory Management

  3. 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

  4. 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

  5. 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

  6. 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

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

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

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

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

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

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

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

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

  15. Dish Washer: Automatic Memory ManagementGarbage 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 • Dadruns dishwasher Lecture 36: Programming Languages & Memory Management

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

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

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

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

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

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

  22. 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

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

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

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

  26. Garbage Collectionwith Contiguous Allocation Wait longer Lecture 36: Programming Languages & Memory Management

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

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

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

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

  31. Allocation withSize-Class Free-Lists Lecture 36: Programming Languages & Memory Management

  32. Allocation withSize-Class Free-Lists Free (b3) Free (s1) Lecture 36: Programming Languages & Memory Management

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

  34. 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

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

More Related