« On Writing Well | Main | The Wicklow Way »

June 01, 2005

Virtual machines

I have been working writing PHP code, in work, for the past few months. This has been quite interesting and I have learned a heap load of new things. However, I am starting to miss Java. It is not the language that I miss most or the class libraries, though I do miss them. What I miss most is the virtual machine (VM).

Aside from security and portability, which are taken for granted, there are a few cool things that the Java VM enables. For example, the code it runs is byte code, an intermediate form between high level computer languages and machine instructions. This byte code is normally compiled from the Java high level language. It doesn't have to be, though. Other languages can be compiled to Java VM byte code. There are two active projects doing just that: Groovy and Jython. Jython is especially interesting, as it is a compiler/interpreter that brings python to the Java VM. People I know have been ranting about python for years. There is also NetBeans support via Coyote.

The other cool thing that the Java VM allows is for instrumentation. The virtual machine provides a layer of indirection where instrumentation can go, for example to allow profilers and debugging tools to plug in. Java has really good interfaces for this sort of thing. The Java Platform Debugging Architecture (JPDA) is really powerful. There is a C interface for writing debugger modules (JVMDI), a protocol which allows a debugger to connect to a Java VM over the network (JDWP), and a Java class library for debugging events (JDI). I have used the Java Debugging Wire Protocol (JDWP) a lot via the NetBeans debugger and it is really useful. I plan on using the other two interfaces in the near future too, especially JDI. When I do, I will post here with my experiences. Debugging support isn't the only thing that can be added in the Java VM layer: profiling support can be added too. The Java VM Profiler Interface (JVMPI) allows profiling modules to be created and this is the interface that the DTrace VM agent uses. I haven't used this yet but I know it will be really handy some day.

Virtual machines seem to be fashionable at the moment. IEEE Computer magazine for May 2005 has a number of feature articles on virtual machines and virtualization. The articles are online, but only the editors' introduction can be downloaded without an IEEE membership. They are very informative articles, which give a broad introduction to what virtual machines are and the types of virtual machine available. The articles pointed to numerous examples including open source system VMs like XEN, User Mode Linux, and VServer. Add in Solaris Zones and I guess that means I have loads more reading to do on virtual machines.

Posted by JohnC at June 1, 2005 12:45 AM

Comments