290 likes | 313 Views
Multitasking without Compromise: a Virtual Machine Evolution. Grzegorz Czajkowski Laurent Daynes Sun Microsystems Laboratories Presented by: Subodh J. Lele. Introduction - Java VM. Used by applications, applets Appears as an OS. Problems. Interference between two apps Examples
E N D
Multitasking without Compromise:a Virtual Machine Evolution Grzegorz Czajkowski Laurent Daynes Sun Microsystems Laboratories Presented by: Subodh J. Lele CS 5204 - Fall 2004
Introduction - Java VM • Used by applications, applets • Appears as an OS CS 5204 - Fall 2004
Problems • Interference between two apps • Examples • Monopoly over heap space • Leaky object references • Sharing event and finalization queues • Internalized strings • All are undesired! CS 5204 - Fall 2004
Internalized Strings • Avoids duplicates • String a = “abc”; • String b = a.intern(); • Need to use synchronized (a) { … } CS 5204 - Fall 2004
Solutions • Separate VMs • Each VM as a OS process • Multitasking VM (MVM) • Multitasking version of JVM • OS-style multitasking CS 5204 - Fall 2004
Separate VMs • Advantages • Fault isolation • Higher Programmer productivity • Disadvantages • Inefficient resource utilization • Downgraded performance • Poor scalability • Poor application startup time CS 5204 - Fall 2004
MVM • Applications are protected from each other • TASKS • Multitasking features • Safe • Secure • Scalable • NO COMPROMISE approach CS 5204 - Fall 2004
MVM • Goals • No interference • JVM illusion • Perform and scale well • Just like those of an OS CS 5204 - Fall 2004
Design decisions • Examine each component • Shareable • Non-Shareable… replicate • Changes to JVM • No bytecode editing • Separate task data sets • End task at any time CS 5204 - Fall 2004
MVM Design • Lightweight Isolation • Memory Management • User-Level Native Code CS 5204 - Fall 2004
Lightweight Isolation • Share as much as possible • Replicate everything else • Issues • Class Initialization • Accessing appropriate copy • Efficient retrieval • Making it scalable CS 5204 - Fall 2004
In MVM CS 5204 - Fall 2004
Class Initialization • Different from object initialization • Done by <clinit> CS 5204 - Fall 2004
Loading and Linking • Loading • Create main memory representation • Create TCM • Add static variables • Mark “loaded” • Linking • Verify class • Check loader constraints • Build constant pool cache CS 5204 - Fall 2004
Dynamic code rewriting • Class initialization barrier • Check for entry in TCM table • Once per task • Necessitates two entries • Link resolution barrier • Unchanged from JVM CS 5204 - Fall 2004
Other issues • Quickened bytecodes • Re-introduce barriers • Affects only four methods • Sharing Complied Code • Native code for method • Patching stubs • Class initialization barriers CS 5204 - Fall 2004
Performance – Memory footprint CS 5204 - Fall 2004
Performance – Time overheads CS 5204 - Fall 2004
Memory Management • Heap Memory • Mechanisms • Surplus memory management • Memory accountability • Per-task Garbage Collections CS 5204 - Fall 2004
In HSVM • New Generation • Eden • For new objects • Aging • From-space • Objects garbage collected (GC) • To-space • Old Generation • Collection triggered when filled up CS 5204 - Fall 2004
In MVM • Old generation shared • New generation common • More activities occur here • Eliminates heap-related interference CS 5204 - Fall 2004
Surplus Memory Management • Postpone or avoid GC • Given to new generation • Handled by New Space Manager (NSM) CS 5204 - Fall 2004
Memory Accounting CS 5204 - Fall 2004
Performance – Memory Management • Overheads • Replicated new generation • Memory accounting • Extending eden and book-keeping • Conclusion • Execution time benefits from larger eden CS 5204 - Fall 2004
Handling Native Code • Isolation layer • Native library replicated • Redefines functions to include arguments CS 5204 - Fall 2004
My evaluation - pros • MVM is a complete system • Appears just like a JVM for apps • Provides excellent multitasking features • Safe • Secure • Scalable CS 5204 - Fall 2004
My evaluation - cons • One app can crash the VM • When interaction is required, costly local RPC needed • GC forced by one task can interfere with another task’s performance • It does compromise! CS 5204 - Fall 2004
Questions? CS 5204 - Fall 2004