semi automatic region based memory management for real
play

Semi-Automatic Region-Based Memory Management for Real-Time Java - PowerPoint PPT Presentation

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems G. Salagnac, C. Rippert, S. Yovine Verimag Lab. Universit Joseph Fourier Grenoble, France http://www-verimag.imag.fr/~salagnac salagnac@imag.fr G. Salagnac


  1. Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems G. Salagnac, C. Rippert, S. Yovine Verimag Lab. Université Joseph Fourier Grenoble, France http://www-verimag.imag.fr/~salagnac salagnac@imag.fr G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 1 / 16

  2. Motivation The Java programming language ◮ Attractive language ◮ Automatic memory management Implementation pitfalls ◮ Garbage Collection ⇒ pause times and fragmentation ⇒ Difficult to use in a real-time embedded context = G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 2 / 16

  3. Our approach Non-determinism of Garbage Collector pause times: the problem is in the JVM, not in the language! Proposition: ◮ Keep the language ◮ no manual memory management ◮ Change the implementation ◮ replace the GC by a predictable allocator ◮ use region-based memory management ◮ automatically compute object lifetimes at compilation ◮ undecidable problem ◮ find a reasonable over-approximation G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 3 / 16

  4. Our approach Non-determinism of Garbage Collector pause times: the problem is in the JVM, not in the language! Proposition: ◮ Keep the language ◮ no manual memory management ◮ Change the implementation ◮ replace the GC by a predictable allocator ◮ use region-based memory management ◮ automatically compute object lifetimes at compilation ◮ undecidable problem ◮ find a reasonable over-approximation G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 3 / 16

  5. Outline Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 4 / 16

  6. Memory management using regions a java heap... ...organised in regions program variables region 1 region 2 Objects in a region will share the same (physical) lifetime ◮ Benefits: a more real-time -compatible behaviour ◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times ◮ Drawbacks: more difficult bookkeeping ◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

  7. Memory management using regions a java heap... ...organised in regions program variables region 1 region 2 Objects in a region will share the same (physical) lifetime ◮ Benefits: a more real-time -compatible behaviour ◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times ◮ Drawbacks: more difficult bookkeeping ◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

  8. Memory management using regions a java heap... ...organised in regions program variables region 1 region 2 Objects in a region will share the same (physical) lifetime ◮ Benefits: a more real-time -compatible behaviour ◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times ◮ Drawbacks: more difficult bookkeeping ◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

  9. Outline Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 6 / 16

  10. Region analysis and allocation policy Hypothesis: Objects within the same data structure (i.e. connected together) will often have similar (logical) lifetimes ⇒ one region for each data structure = ◮ no inter-region pointer Static analysis: ◮ identify variables that may point to connected objects Allocation Policy: ◮ place objects so that each structure is grouped in a region G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 7 / 16

  11. Region analysis and allocation policy Hypothesis: Objects within the same data structure (i.e. connected together) will often have similar (logical) lifetimes ⇒ one region for each data structure = ◮ no inter-region pointer Static analysis: ◮ identify variables that may point to connected objects Allocation Policy: ◮ place objects so that each structure is grouped in a region G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 7 / 16

  12. Example: pointer interference analysis class ArrayList { Object[] data; int index; main() { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; Object o1=new Object; } Object o2=new Object; void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } } G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  13. Example: pointer interference analysis for all methods, class ArrayList { Object[] data; main() int index; main() { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  14. Example: pointer interference analysis identify local variables class ArrayList { Object[] data; main() int index; main() list o1 o2 { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  15. Example: pointer interference analysis identify local variables class ArrayList { Object[] data; main() int index; main() list o1 o2 { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; this tmp void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  16. Example: pointer interference analysis identify local variables class ArrayList { Object[] data; main() int index; main() list o1 o2 { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; this tmp void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } this o G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  17. Example: pointer interference analysis local interference: v 1 .f=v 2 = ⇒ v 1 ∼ v 2 class ArrayList { Object[] data; main() int index; main() list o1 o2 { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; this ∼ tmp void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } this o G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

  18. Example: pointer interference analysis local interference: v 1 .f=v 2 = ⇒ v 1 ∼ v 2 class ArrayList { Object[] data; main() int index; main() list o1 o2 { <init>(int capacity) ArrayList list = { new ArrayList; this.index = 0; list.<init>(3); tmp = new Object[capacity]; this.data = tmp; <init>() Object o1=new Object; } Object o2=new Object; this ∼ tmp void add(Object o) list.add(o1); { } this.data[this.index] = o; this.index ++; } add() } this ∼ o G. Salagnac (Verimag) Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend