Upload
zuzela
View
33
Download
0
Embed Size (px)
DESCRIPTION
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. - PowerPoint PPT Presentation
Citation preview
Running a Java VMRunning a Java VM inside inside
an Operating System kernelan Operating System kernel- a networking case study -- a networking case study -
Department of Computer ScienceUniversity of Pittsburgh
Takashi OkumuraTakashi Okumura, Bruce Childers, Daniel Mosse’, Bruce Childers, Daniel Mosse’
2/27Running a Java VM inside an Operating System kernelVEE 2008
• 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
Introduction
3/27Running a Java VM inside an Operating System kernelVEE 2008
Implementation ofcurrent network I/O Code
• Independent implementations• With similar functionality• Without compatibility• Hardcoded inside the operating systems
4/27Running a Java VM inside an Operating System kernelVEE 2008
• Prohibitive development cost• Wasted programming efforts• Limited # of kernel programmers
Porting
Prototyping
Prototyping and Deployment
Write-once Run-anywhere...?
Deployment
5/27Running a Java VM inside an Operating System kernelVEE 2008
Yes, Java!
• Architecture neutral• Simplified memory management• Easy extension of kernel functionality• Code-reuse
A reasonable approach forkernel extensibility of network I/O
Write Once Run Anywhere
6/27Running a Java VM inside an Operating System kernelVEE 2008
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
Motivation
Design & Implementation
Evaluation
Discussion
Concluding Remark
8/27Running a Java VM inside an Operating System kernelVEE 2008
Design Overview
P1 P2 P3
VIF23
VIF1
VIF11 VIF12
S1 S2
Network interface
JVM
Packets
VIF
VIFlet
ioctl()
write()
conf log
stdin
stdout
enqueue()
dequeue()
9/27Running a Java VM inside an Operating System kernelVEE 2008
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;}
}
JVM
enqueue()
dequeue()
10/27Running a Java VM inside an Operating System kernelVEE 2008
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/27Running a Java VM inside an Operating System kernelVEE 2008
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/27Running a Java VM inside an Operating System kernelVEE 2008
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/27Running a Java VM inside an Operating System kernelVEE 2008
Implementation Steps
VIFlet
eclipse
viflettester
run console out
lib
NVM/NYA
lib
vifletdJava2 SE
run
2) VM Implementation
Test Traffic Source
Embed run
1) Class Coding 3) Embedding
Traffic Generator
BPF Dump file
BPF device file
NPF diverting socket
ROMize
VIF
kernel
userland
Motivation
Design & Implementation
Evaluation
Discussion
Concluding Remark
15/27Running a Java VM inside an Operating System kernelVEE 2008
Eratosthenes Sieve benchmark
11x boosting91%
16/27Running a Java VM inside an Operating System kernelVEE 2008
Object sort benchmark
6x boosting
17/27Running a Java VM inside an Operating System kernelVEE 2008
Priority Queuing throughput
93%
18/27Running a Java VM inside an Operating System kernelVEE 2008
Function Profiling (FTP send)
FTP code / blocking for disk I/O / buffer copy Kernel VM
8%
+ VIF
VM code occupies just a limited portionin the entire processing
19/27Running a Java VM inside an Operating System kernelVEE 2008
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/27Running a Java VM inside an Operating System kernelVEE 2008
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...
Motivation
Design & Implementation
Evaluation
Discussion
Concluding Remark
22/27Running a Java VM inside an Operating System kernelVEE 2008
Virtualization spoils performance?
An ISA more suitable for dynamic compilation would perform much better!
Kernel Extensibility favors Optimizations!
Even the most straightforward approachexhibited practical performance
Our work!
23/27Running a Java VM inside an Operating System kernelVEE 2008
• 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
With an ISA more suitable for dynamic optimization
(than Java Bytecode)
24/27Running a Java VM inside an Operating System kernelVEE 2008
DD
Ethernet
Filter
TCP/UDP
Socket
Traffic Control
IP
Hardcode
Socket
DD
Cache
SpeculativeExecution
Socket
DD
Ethernet
TCP/UDP / IP
LayerIntegration
Socket
DD
Instrumentation
EE
DD
Ethernet
TCP/UDP
Socket
IP
Customization
Kernel Extensibility favors Optimizations!
We can extend the VIFlet modelfor further flexibility!
Motivation
Design & Implementation
Evaluation
Discussion
Concluding Remark
26/27Running a Java VM inside an Operating System kernelVEE 2008
• 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, su
ch 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
? || /* */
The source will be released at SourceForge, shortly. Check for the latest news at http://www.netnice.org!