Download Java Virtual Machine and Managed Runtime Environment Architecture

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Java Virtual Machine and Managed
Runtime Environment Architecture
Introduction
Sergey Salshev
Virtual Machine
 A VM was originally defined by Popek and Goldberg as
"an efficient, isolated duplicate of a real machine"
 A virtual machine (VM) is a generic software
implementation of a dedicated machine (i.e. a specific
computer or dedicated software runtime) that executes
programs like a dedicated machine
 Program might be as big as an OS (System level VM) or
as small as a single process (Process level VM)
 The program code can be interpreted, compiled (JIT or
AOT) or just run under control of VM
 Examples: Xen, VMWare,JVM, LLVM, Parrot,
ScrummVM, DosBox, Sega Emulator
 Java designers initially thought about JM without V
Runtime Environment
 Runtime Environment implements the core behavior of a
computer language





Program entry/exit
Low level OS-like services (io, file, …)
Runtime-Type-Checking
Exception handling
Code generation and execution
 Runtime doesn’t always mean OS

OS-less system is called baremetal
 Programs in low level languages such as C and ASM
can run without Runtime

In most situations it is impractical
Managed Runtime Environment
 Term was coned in by .NET architects to define Java
without saying Java
 It defines the runtime environment that guaranties
potential recovery of all errors in the “managed code”




Erroneous code shouldn’t run free
Exceptions should be thrown immediately on error and in the
context of the high level language statement
Other features are just consequences
Type safety, Pointer safety, Thread safety, Garbage collection,
Interface unification, Security, Basic managed libraries,
Hardware Isolation, Code Verification, Cross-Platform Code,
Reflection
Alternative: Binary compilation
 Full access to hardware

Platform specific optimizations
 Platform specific binaries


Platform specific optimizations
No cross-platform binaries
 Static compilation


Bigger code
Faster startup
 Inherent security vulnerabilities


Code is not semantically verified for correctness
Inherent vulnerability to data execution
MRE: Pros
 Smaller code
 Cross-platform binaries






Binaries might be equal to source code
Code is semantically verified on loading
Better Security
Better debugging
Profile driven dynamic optimization is possible
Potential OS replacement
MRE: Cons





Bigger Runtime
Bigger performance overhead on runtime
Slower startup with JIT
Limited platform specific optimizations
Limited usage for system programming
MRE/VM Examples
 Specialized

RIP for PostScript, SQL Server
 Generic

PHP, Python, Ruby, CLISP, TCL, Lua, Java
RE, CLI(.NET), Google V8 (Java Script),
Mozilla Spider Monkey (Java Script), Android
Dalvik (Java)
Ultimate system programming test
 Compiler


Java in Java (Odersky GJ Compiler, Eclipse)
C# in C# (Mono)
 MRE



Java (Jikes RVM)
Python (PyPy)
Smalltalk (Squeak)
 OS Drivers

Java (Experimental Solaris Drivers)
 OS Kernel



LISP (Genera OS)
Java (JNode OS)
C# (Singularity OS)
Java language design (1991)
 Requirements





It should be "simple, object-oriented and familiar"
It should be "robust and secure"
It should be "architecture-neutral and portable"
It should execute with "high performance"
It should be "interpreted, threaded, and dynamic“
 Principles



Remove all unsafe language features
Transparent translation to ISA bytecode
Bytecode verification
Java: Early History
 Design



1991 Oak – programming language for consumer electronics
1993 Green – programming language for the internet
1995 Java early release
 Early History







1996 Java 1.0, HotJava web browser
1996 Java Card
1998 Java 1.1.6 with JIT from Microsoft
1998 Generic Java compiler (Odersky)
1998 J2SE, J2EE, J2ME (JDK 1.2)
1999 Java HotSpot dynamic compiler (JDK 1.2.x)
1999 HotJava web browser discontinued
Java: Current History
 2000 JDK 1.3
 2002 JDK 1.4 XML, Regex, NIO, SSL
 2004 JDK 1.5 Generics, Boxing, Annotations,
java.util.concurrent
 2006 JDK 1.6
 2007 Sun Spot ultra-low power baremetal Java
 2010 Sun bought by Oracle
 2011 JDK 1.7 Dynamic Language support
Java at Google
 2003 Android, Inc
 2005 Google acquired Android Inc.
 2008 Android 1.0 Dalvik VM, Iterpreter,
Java Lib code taken from Apache
Harmony
 2010 Android 2.2 Dalvik VM JIT
 2013 Android 4.4 ART (AOT)
Java Application Examples
• Mobile

Whole Android Market, Java ME for Symbian OS (Opera Mini, Games)
• Client

Eclipse, NetBeans, JetBrain IDEA, jEdit
• Server

Big Data
• Hadoop

App Server
• Tomcat, Geronimo, Axis, jBoss

Database
• Java DB, HSQLDB, H2, JOBD

App Frameworks
• Server Faces, Springs, Hibernate, GWT
CLI History
 Design




1998 MS JRE 1.1.6 with JIT
1998 J++ 6.0
2000 CLI ECMA standard draft
2000 .NET 1.0 Beta
 Early history




2002 .NET 1.0
2004 Mono 1.0
2005 CLI 3ed ECMA standard
2005 .NET 2.0 Generics
 Current history





2006 .NET 3.0
2008 Mono 2.0
2009 .NET micro framework baremetal Apache License
2010 .NET 4.0 Major Lib update
2012 Mono 3.0
Related documents