1 / 29

Unpicking The Knot : Teasing Apart VM/Application Interdependencies

Unpicking The Knot : Teasing Apart VM/Application Interdependencies. Yi Lin, Steve Blackburn, Daniel Frampton The Australian National University. Introduction. Introduction. Understanding VMs is important. Resource Management Security Performance / Profiling Unfortunately this is hard!

Download Presentation

Unpicking The Knot : Teasing Apart VM/Application Interdependencies

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. Unpicking The Knot:Teasing Apart VM/Application Interdependencies Yi Lin, Steve Blackburn, Daniel Frampton The Australian National University

  2. Introduction Unpicking the knot | Lin, Blackburn and Frampton

  3. Introduction Understanding VMs is important • Resource Management • Security • Performance/Profiling Unfortunately this is hard! VMs are complex.HotSpot (~250,000LOC) [1] Ogata et al. [OOPSLA’10] [2] Eeckhout et al. [OOPSLA’03] Unpicking the knot | Lin, Blackburn and Frampton

  4. Introduction Hardware Is Getting More Complex! • Goal: reliable, portable software • Confounded by h/w complexity • High-level language • Abstraction • Safety • Productivity Unpicking the knot | Lin, Blackburn and Frampton

  5. Introduction Metacircularity • Potential consequence when we choose a high level language • Language runtime depends on itself • PyPy (Python / Python) • Singluarity (C# / C#) • JikesRVM (Java / Java) Opinion: Metacircularity is not a meaningful end,but it may be a natural choice Unpicking the knot | Lin, Blackburn and Frampton

  6. Introduction Unclear VM/APP Context • Metacircular runtime can re-enter itself • Ambiguous static context Application Application Language Library VM VM HashMap Classloader MM Allocation for VM or App? Unpicking the knot | Lin, Blackburn and Frampton

  7. Introduction VM/APP Inter-dependency • VM/APP tangled like a knot • Contextual Ambiguity • VM? • Application? Unpicking the knot | Lin, Blackburn and Frampton

  8. Introduction Tease Apart Interdependencies We propose a low-overhead framework to • Track dynamic context • Maximize static context clarity We use metacircular implementation • Problem is most vivid there Unpicking the knot | Lin, Blackburn and Frampton

  9. Tracking ContextContext, Transition Point, Runtime Service Unpicking the knot | Lin, Blackburn and Frampton

  10. Tracking Context OS Analogy? • Kernel/User User Kernel • Binary divide: kernel/user • Crisply defined boundary • Explicit transitions How much of what we learn from OS can be applied to VM? Unpicking the knot | Lin, Blackburn and Frampton

  11. Tracking Context Binary Context? • Binary context divide (VM/APP): insufficient • Re-entrancy • Application needs classloading • actual downcall • Classloader needs Allocation • reentry, but essential • Allocator needs allocation • infinite regression ✗ Unpicking the knot | Lin, Blackburn and Frampton

  12. Tracking Context Dynamic Context • Detailed contexts: holding runtime request • Rules:Context as DAG Unpicking the knot | Lin, Blackburn and Frampton

  13. Tracking Context Context Transition Point Methods where context transition occurs Unpicking the knot | Lin, Blackburn and Frampton

  14. Tracking Context Context Transition Points (cont.) Dynamic switching • switchContextTo(VM) in the beginning • switchContextBack(oldContext) in the end @DownCall(Context=Classloader) public synchronized void resolve() { /* original code */ } public synchronized void resolve() { intold = switchContextTo(Context.Classloader) try{ /*original code*/ } finally{ switchContextBack(old); } } • switchContextTo(Context.Classloader); • switchContextBack(old); Unpicking the knot | Lin, Blackburn and Frampton

  15. Tracking Context Dependency Between Contexts ‘Substantive’ vs. lightweight publicclassRVMClass { privatebytestate; ... public synchronized void resolve() { ... // heavyweight resolving code state = CLASS_RESOLVED; } @Inline public booleanisResolved(){ returnstate >= CLASS_RESOLVED; } } Substantive dependency Context Transition • @DownCall(Context=Classloader) Lightweight dependency @RuntimeService No Context Transition • @RuntimeService Unpicking the knot | Lin, Blackburn and Frampton

  16. Tracking Context @RuntimeService • Allow lightweight code run out of context • Fastpath (alloc/wb/etc) is @RuntimeService • Reasonable choice for better performance • Properly track current context (request) • Avoid a large number of unnecessary context transitions • Impedance matching • DRLVM(C++) implements service code in Java Unpicking the knot | Lin, Blackburn and Frampton

  17. Tracking Context Transition Point Placement • Consideration to transitions when designing new VMs • VM-Application interface • VM-Library interface • Modular design for VM components • Identifying transitions in existing VMs • Experimental approach • @AssertExecutionContext to dump stack Unpicking the knot | Lin, Blackburn and Frampton

  18. Tracking Context Transition Point Placement (cont.) Example : new() DownCall -- Stack –- at Lorg/mmtk/policy/Space; acquire at Lorg/mmtk/utility/alloc/BumpPointer; allocSlow at Lorg/mmtk/utility/alloc/BumpPointer;alloc … at Lorg/jikesrvm/mm/mminterface/MemoryManager; resolvedNewScalar at Lavrora/sim/clock/RippleSynchronizer; advance at Lavrora/sim/clock/RippleSynchronizer; waitForNeighbors at Lavrora/sim/radio/Medium$Receiver; waitForNeighbors -- Stack -- at Lorg/mmtk/policy/Space; acquire at Lorg/mmtk/utility/alloc/BumpPointer; allocSlow at Lorg/mmtk/utility/alloc/BumpPointer; alloc … at Lorg/jikesrvm/mm/mminterface/MemoryManager; resolvedNewScalar at Lavrora/sim/clock/RippleSynchronizer; advance at Lavrora/sim/clock/RippleSynchronizer; waitForNeighbors at Lavrora/sim/radio/Medium$Receiver; waitForNeighbors MM ~ ? Service code APP @Inline Fast path Lightweight operations Always gets executed @NoInline Slow path Heavy-weight ‘substantive’ ~0.1% chance of being executed Unpicking the knot | Lin, Blackburn and Frampton

  19. publicclassBumpPointerSpace{ ... @DownCall(Context=MemoryManager) @NoInline public Address allocSlow(intbytes) { /* slow path */ } ... Tracking Context Refactoring @RuntimeServices @RuntimeService publicclassBumpPointer { ... @Inline public Address alloc(intbytes) { /* fast path */ } } publicclassBumpPointer { ... @Inline public Address alloc(intbytes) { /* fast path */ } @NoInline public Address allocSlow(intbytes) { /* slow path */ } } • @RuntimeService @Inline publicAddress alloc(intbytes) { /* fast path */ } • @DownCall(Context=MemoryManager) @NoInline publicAddress allocSlow(intbytes) { /* slow path */ } Unpicking the knot | Lin, Blackburn and Frampton

  20. Tracking Context Refactored VM Application Language Library VM Classloader MM Compiler …… Service / Context ambiguous area Code that has specific context Unpicking the knot | Lin, Blackburn and Frampton

  21. Tracking Context Service Unpicking the Knot Statically VM? Application? VM VM Application At any given time Application Unpicking the knot | Lin, Blackburn and Frampton

  22. Tracking Context Performance • Low transition frequency: 10-850/ms • Low overhead: 0.6% slower • Prototype on JikesRVM • DaCapo + SpecJVM98 Unpicking the knot | Lin, Blackburn and Frampton

  23. ResultsPerformance, use cases Unpicking the knot | Lin, Blackburn and Frampton

  24. Results Use cases • Profiling • CPU cycles in different contexts • Allocation volume • Object survival ratio • Resource management • Heap footprint Unpicking the knot | Lin, Blackburn and Frampton

  25. Results Allocation in contexts Application Compiler Booting Classloader Other Runtime Unpicking the knot | Lin, Blackburn and Frampton

  26. Results Survival ratio in contexts Fraction of objects that can survive first gc Unpicking the knot | Lin, Blackburn and Frampton

  27. Results Survival ratio in contexts (cont.) x axis is benchmarks These suggest we could use different heap/mm policy for different contexts Unpicking the knot | Lin, Blackburn and Frampton

  28. Results Memory footprint 43.3% by Application, 56.7% by VM Unpicking the knot | Lin, Blackburn and Frampton

  29. Summary • Understanding VM/APP is important • benefits, difficulties, our goal • Tracking context & Results • context, transition point, runtime service, low overhead, use cases • Conclusion • metacircular VMs closer to product quality • better insight for designing regular VMs Unpicking the knot | Lin, Blackburn and Frampton

More Related