1 Poster Abstract: fVM, a hard real-time Java implementation for cyber-physical systems Filip Pizlo, Lukasz Ziarek, Jan Vitek Abstract—Real-time Java is emerging as a platform for building mission-critical embedded systems. The real-time variants of Java, including [3], [4], are attractive alternatives to Ada and C as they provide a cleaner, simpler, and safer programming model. Unfortunately, current real-time Java implementations have trouble scaling down to very hard realtime embedded settings, where memory is scarce and processing power is limited. In this poster, we describe a new real-time Java implementation, the fVM, intended for use in avionics, space, and cyber-physical systems. F 1 I NTRODUCTION S CALING modern, mainstream languages and their runtimes down to powerconstrained embedded settings is hard, especially if real-time guarantees must be ensured. While Java is emerging in a wide variety of application domains, the availability of standards-compliant Java implementations for embedded systems is limited, especially if automatic memory management is desired. Over the past six years, our group at Purdue has been developing the Ovm [1], [6] – a Java-in-Java metacircular virtual machine that aims to provide hard real-time guarantees, while complying with a large subset of the Java language. Development of Ovm has resulted in the first UAV flight using avionics written in Java [1], [7] and the first opensource real-time garbage collector with high throughput and good mutator utilization [5]. Though Ovm’s footprint is quite competitive with other hard real-time VMs, it’s still larger than we would desire. Its ability to perform high-level compiler optimizations is also limited, leading to sub-optimal performance. Thus, over the past year we have been developing a new Java VM, the fVM, which applies lessons learned from Ovm and applies them to create • F. Pizlo, L. Ziarek, and J. Vitek are with the Department of Computer Science, Purdue University, W. Lafayette, IN, 47909, as well as Fiji Systems, LLC, Indianapolis, IN 46202. E-mail: {filip,lziarek,jv}@cs.purdue.edu a fast and light-weight virtual machine targetted at power-constrained embedded real-time systems and cyber-physical systems. 2 F VM D ESIGN Like Ovm, fVM is designed as an ahead-oftime compiler for Java programs. Our goal is to provide developers with an automated mechanism for converting high-level Java applications into small and compact real-time executables. fVM consists of two components: fVMc, the compiler, which reads in Java bytecodes and produces compact, high-performance machine code, and fVMr, a light-weight portable runtime written in a combination of C and Java. 2.1 fVMr: the runtime component fVM is designed to have a light-weight runtime inspired by the proven design philosophies of runtimes for languages such as C. The runtime footprint is around 0.2 MB on IA-32. fVMr provides the following functionality: (i) a novel real-time garbage collector with provable space bounds in the style of JamaicaVM [8], but with multicore support, higher throughput and tighter worst-case execution time (WCET) bounds, (ii) a threading library that directly maps Java threads to operating system threads, and (iii) a complete implementation of the Java Native Interface, a standard API for performing calls between Java and C code. This simple 2 1.1 have 1000 classes or less can typically be compiled in under a minute resulting in a 1.5 MB 1.0 binary, of which 200 KB is the fVM runtime. 0.9 The rest is global data, debug information, and executable code, including everything neces0.8 sary to support Java features such as JNI and 0.7 reflection. The work that remains prior to a 1.0 release 0.6 is fixing bugs that are preventing the remainder 0.5 of the SPECjvm98 from executing, and complecompress db mpegaudio GEOMEAN tion of our real-time garbage collector. HowRelative execution time of fVM versus Ovm ever, even with our current implementation, Fig. 1. Performance of fVM versus Ovm on a small set fVM outperforms Ovm; see Fig. 1. Programs of SPECjvm98 benchmarks. The Y-axis shows the relative compiled with fVM are on average 14% faster. execution time of fVM versus Ovm. On average, programs We believe that fVM is running slower than run faster in fVM, taking roughly 14% less time to execute. Ovm on the larger benchmark due to the incomplete garbage collector. design has the benefit of allowing fVM to be ported not just to large-scale main-stream op- 4 C ONCLUSION erating systems like Windows, Linux, and Mac We are developing a new Java virtual machine, OS X, but also embedded hard real-time operfVM, targetted at power-constrained real-time ating systems such RTEMS or vxWorks. Since systems. By reducing the footprint and improvfVMr only relies on an OS threading library ing performance, we hope to enable high-level and some basic C functionality, applications real-time Java applications to run seamlessly on compiled with fVM can be run even on a very hardware that previously could only support minimal RTEMS profile, minimizing footprint applications written in lower-level languages. and maximizing performance. 2.2 fVMc: the compiler component Our compiler converts Java bytecodes into a low-level representation suitable for generating either machine code or C code. Currently, we generate compact and portable C code, allowing us to trivially port the compiler to a variety of hardware and operating system platforms. An optimizing machine code backend is in the design stages. fVMc is designed to produce fast code; thus, heavy emphasis is placed on eliminating dead or redundant code, and devirtualizing and inlining select method calls. These optimizations allow the generation of code that performas at levels close to those achieved by production non-real-time Java virtual machines. 3 S TATUS OF F VM The fVM is already capable of running large Java applications, including half of the SPECjvm98 benchmark suite. Programs which R EFERENCES [1] A. A RMBUSTER , J. B AKER , A. C UNEI , D. H OLMES , C. F LACK , F. P IZLO , E. P LA , M. P ROCHAZKA , AND J. V ITEK, A Real-time Java virtual machine with applications in avionics, ACM Transactions in Embedded Computing Systems, 2007. [2] J. A UERBACH , D. F. B ACON , B. B LAINEY, P. C HENG , M. D AWSON , M. F ULTON , D. G ROVE , D. H ART, AND M. S TOODLEY, Design and implementation of a comprehensive real-time Java virtual machine, in Conference on Embedded software (EMSOFT), 2007. [3] G. B OLLELLA , J. G OSLING , B. B ROSGOL , P. D IBBLE , S. F URR , AND M. T URNBULL, The Real-Time Specification for Java, Addison-Wesley, 2000. [4] JSR 302, Safety critical Java technology, 2007. [5] F. P IZLO AND J. V ITEK, An empirical evalutation of memory management alternatives for Real-time Java, in Real-Time Systems Symposium (RTSS), Dec. 2006. [6] P URDUE, The Ovm virtual machine, www.ovmj.org. [7] P URDUE, Purdue Researchers Participate in Development of ScanEagle UAV, cs.purdue.edu/news/1-12-06scaneagle.htm [8] F. S IEBERT, Real-time garbage collection in multi-threaded systems on a single processor, in Real-Time Systems Symposium (RTSS), 1999. [9] S UN M ICROSYSTEMS, Sun java real-time system, java.sun.com/javase/technologies/realtime/, 2008.