Can you run multiple Java applications in one virtual machine to boost speed and reduce memory requirements? Apparently, engineers at Sun are trying to find a way to do this. And from this first JavaOne session I attended this morning, it sounds like this could happen in the next year or so.

This research effort at Sun is called Project Barcelona, being led by Grzegorz Czajkowski, a senior staff engineer at Sun. Sun wants a JVM to run multiple applications in order to:

  • Improve application startup time
    • Boost performance
      • Lower the memory footprint for Java apps. </ul> Some fruits of Barcelona will be available in the new HotSpot JVM in J2SE 1.5. Those improvements will allow classes running in different JVMs to share some read-only data. But Grzegorz Czajkowski stressed that Barcelona still is a project, not a product. The first real product to allow multiple Java applications to run in the same JVM should come this fall in the Connected Limited Device Configuration of J2ME, he said.

        The Barcelona project has created a Multitasking Virtual Machine. MVM works using a daemon process on Solaris, called the mserver, and acts as a central point of contact for all Java applications that want to run. The Java startup command becomes a short-running application to contact the mserver daemon, which starts the Java app within its single JVM. Pretty neat.

        The current MVM shares common classes, bytecodes and some of the runtime system, Grzegorz Czajkowski said. The MVM is in charge of isolating the different applications to ensure they don’t collide with each other, and that security constraints are still handled on an application level and don’t run with the security permissions of the MVM. Here’s the great news:

        • Application startup time is reduced by about 96% for non-GUI applications, 33% for GUIs.</p>
          • Memory requirements shrink 30% to 50% for each application.
            • Runtime performance suffers only slightly. I think he said the MVM creates a performance overhead of only about 1%. </ul> If Sun can make the MVM part of Java, our Java applications should become less of the memory hogs they are, and start up much faster. Can you imagine the day when Eclipse launches in a few seconds rather than after you’ve returned from your coffee break?