1 / 27

Running a Java VM inside an Operating System kernel - a networking case study -

Running a Java VM inside an Operating System kernel - a networking case study -. Department of Computer Science University of Pittsburgh. Takashi Okumura , Bruce Childers, Daniel Mosse’. Introduction. Takashi Okumura, M.D., Ph.D.

zuzela
Download Presentation

Running a Java VM inside an Operating System kernel - a networking case study -

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. Running a Java VM insidean Operating System kernel- a networking case study - Department of Computer Science University of Pittsburgh Takashi Okumura, Bruce Childers, Daniel Mosse’

  2. Introduction • Takashi Okumura, M.D., Ph.D. • Doctor of Medicine (Mar 2007)Asahikawa Medical College, Japan. • Ph.D. in Computer Science (April 2007)Department of Computer Science, University of Pittsburgh • Current appointment • resident @ Furano hospital, Hokkaido • rotating the department of surgery • Research Interest • Network I/O virtualization • Semantics-aware medical network

  3. Implementation ofcurrent network I/O Code • Independent implementations • With similar functionality • Without compatibility • Hardcoded inside the operating systems

  4. Prototyping and Deployment Write-once Run-anywhere...? Deployment Porting Prototyping • Prohibitive development cost • Wasted programming efforts • Limited # of kernel programmers

  5. Yes, Java! Architecture neutral Simplified memory management Easy extension of kernel functionality Code-reuse Write Once Run Anywhere A reasonable approach for kernel extensibility of network I/O

  6. Need for an in-kernel JVM A Java Virtual Machine that is… Compact enough to be embedded in kernel Efficient enough to run in kernel Open-source, usable for research No such VM present... We built such an in-kernel JVM that meets the criteria and is reusable for other purposes

  7. MotivationDesign & ImplementationEvaluationDiscussionConcluding Remark

  8. ioctl() dequeue() conf log JVM write() stdout stdin VIFlet enqueue() VIF Packets Design Overview P1 P2 P3 S1 S2 VIF11 VIF12 VIF23 VIF1 Network interface

  9. dequeue() JVM enqueue() import org.netnice.*; public class PriQVIFlet extends VIFlet { private static final int NCLASS = 4; private Queue[] queue; private PacketClassifier pc = new SimplePacketClassifier(); private int length = 0; PriQVIFlet() { queue = new Queue[NCLASS]; for (int i = 0; i < NCLASS; i++) queue[i] = new Queue(); } public void enqueue(Packet p) { if (p == null) return; p.mark = pc.classify(p); queue[p.mark % NCLASS].enqueue(p); this.length++; } public Packet dequeue() { for (int i = 0; i < NCLASS; i++) if (queue[i].isEmpty() != true) { this.length--; return queue[i].dequeue(); } return null; } }

  10. NVM/NYAA Lightweight In-kernel JVM/JIT NVM Interpreter (based on Waba VM) Integrated Class library 64K (incl. classlib) NYA JIT for NVM (reusing code mgmt framework of TYA) Simple table-driven translator 64K Many Optimizations and Protection features added

  11. Optimizations • Specification • Supports only 32 bit variable • Omitted several Java constructs, such as Exception, Thread, and Monitor • Omitted the code verification • Optimization algorithms • Register cache of locals, Instruction folding, Object cache, Array object cache, Method cache, fast invocation routine, etc… • Run Time • Native functions for costly processing • Enforce only one reference to a packet object • Discourage users to create objects in event handlers,not to start GC

  12. Protection Features Stack Depth Counter to avoid recursive calls Software Timer to avoid infinite loops Isolation of Execution VIF framework partitions each execution No code verification (ostrich approach) Terminates when illegal instruction is executed Access is strictly limited within the Java heap

  13. Implementation Steps 1) Class Coding 2) VM Implementation 3) Embedding userland run ROMize VIFlet lib lib kernel Test Traffic Source eclipse Embed run BPF device file NVM/NYA run console out NPF diverting socket BPF Dump file viflettester Traffic Generator vifletd Java2 SE VIF

  14. MotivationDesign & ImplementationEvaluationDiscussionConcluding Remark

  15. Eratosthenes Sieve benchmark 91% 11x boosting

  16. Object sort benchmark 6x boosting

  17. 93% Priority Queuing throughput

  18. + VIF FTP code / blocking for disk I/O / buffer copy Kernel VM 8% Function Profiling (FTP send) VM code occupies just a limited portionin the entire processing

  19. Performance breakdown • Avoid method invocation by smart in-lining • Reduce the native call cost • Avoid (packet) object creation in the kernel • pre-allocate necessary objects at system boot time!

  20. Compilation Cost • Invest on the class-loading cost, for performance boosting • by a sophisticated class loader… • Invest on the translation cost (register allocation) • by a better ISA more suitable for dynamic code generation...

  21. MotivationDesign & ImplementationEvaluationDiscussionConcluding Remark

  22. Our work! Even the most straightforward approachexhibited practical performance An ISA more suitable for dynamic compilation would perform much better! Kernel Extensibility favors Optimizations! Virtualization spoils performance?

  23. With an ISA more suitable for dynamic optimization(than Java Bytecode) • AOT approach (by M. Welsh) is advantageous, because it can afford costly optimizations • However, AOT performs only static optimizations • JIT is a primitive way of dynamic optimization • It would perform much better,by incorporating execution profile of running programs... AOT vs JIT

  24. Kernel Extensibility favors Optimizations! Socket Socket Socket Socket Socket TCP/UDP TCP/UDP IP IP TCP/UDP / IP Cache EE Traffic Control Ethernet Filter Ethernet Ethernet DD DD DD DD DD Hardcode Customization Layer Integration Speculative Execution Instrumentation We can extend the VIFlet modelfor further flexibility!

  25. MotivationDesign & ImplementationEvaluationDiscussionConcluding Remark

  26. Produced an Empirical proof Virtualized code does not jeopardize OS performance,dismissing the common belief… Found practical optimizations to efficiently execute packet processing Java programs in kernel, such as simplification of the language specification, restriction of the packet duplication, heuristics in garbage collection, etc… Produced an efficient in-kernel JVM reusable for many other purposes, with a variety of lessons leaned and execution profiles to guide future research efforts in the domain Contributions

  27. ? || /* */ The source will be released at SourceForge, shortly. Check for the latest news at http://www.netnice.org!

More Related