With the release of Google's Android SDK earlier this week, there was much discussion of the APIs and the expected impact in the mobile space. However, one particular area which generated significant debate in the Java community was the Dalvik virtual machine which is the basis of the Android platform.
One of the first differences which is noted between Dalvik and a standard Java virtual machine (JVM) is that Dalvik is register-based, whereas JVMs are stack-based. There has been speculation that the register-based approach was chosen because it allows for greater ahead-of-time optimization, which is beneficial in constrained environments like mobile phones. A more in-depth analysis of register-based versus stack-based virtual machines concluded that register-based VMs allow for faster execution times at the expense of programs which are larger when compiled.
Another difference between Dalvik and Java is the execution environment - Dalvik is optimized to allow multiple instances of the virtual machine to run at the same time in limited memory, and each Dalvik application runs as a separate Linux process. Neil Bartlett points out that giving each application it's own process allows dynamic installation, activation and deactivation, however he questions why Dalvik would choose that instead of using OSGi to enable this within a single process - Radoslav Gerganov replied that separate process prevent all applications from being closed if the VM crashes. Carl Rosenberger also pointed out that OSGi could also probably be ported to the Android platform, while Jilles van Gurp wondered why Google was choosing to reimplement several components such as inter-process communication.
Java is also no longer the only language which one can target Dalvik with - there has been some success in running Scala on Dalvik, and Hecl has also been ported. There has also been an attempt to get Groovy running, however it has not been as successful to date. Miguel De Icaza, Mono project founder, has also expressed interest in integrating Mono with Dalvik once the Dalvik source code becomes available, and there has been speculation about several ways that this could be achieved including a CIL-to-Dalvik recompiler similar to the Java-to-Dalvik recompiler provided with the Android SDK.
The creation of Dalvik has also raised concerns that the first major fracturing of the Java platform may be in progress - some have related Dalvik to Microsoft's JVM and the lawsuit that Sun filed against Microsoft, wondering if a similar thing might happen with Google, while others have pointed out that Google is not claiming that Dalvik is a Java implementation, whereas Microsoft was. Sun has expressed concern over this potential fracture, and has offered to work with Google to ensure compatibility between Dalvik and the JVM - Google replied that Dalvik was an attempt to solve the existing fragmentation in the Java ME platform, and to provide a platform which had a less restrictive license. Some have even wondered whether this might be a sign of a larger power struggle between Sun and Google over the future of Java. Ian Skerrett saw the creation of Dalvik as a reaction to Sun's attempts to control and protect the revenue stream from Java ME, as well as a reaction to the lack of progress in establishing a governance board for OpenJDK. This caused Dalibor Topic to wonder if Google might follow Sun's path:
The interesting question is, of course, why doesn’t anyone have the courage to ask the same questions of Google, that they ask about OpenJDK? :)
Android is proprietary, despite being marketed as open source. Android has a compatibility pledge, signed and kept behind closed doors. Android has no governance model, nor any indication there will be one. Android has no spec, and the license prohibits alternative implementations, as that’s not a use licensed by Google in the SDK license. Android is completely controlled by Google, and Google reserves the right to kill off competitors applications if they hurt Google financially, etc. It’s only as open as it is in Google’s financial interest to allow openness, by design. Same old proprietary Java wine, in a different bottle.
It’s as if we’re witnessing the rebirth of the JCP, with folks lined up to lend open source community ’street credibility’ to another closed off vendor cartel around a single, proprietary implementation, this time with Google instead of Sun.
Stefano Mazzocchi posted an in-depth analysis of the license issues surrounding Java ME and Dalvik, and concludes that Dalvik is well positioned to make an imapct in the mobile market. Although Google has been careful to avoid several potential points of litigation, Mazzocchi believes that intellectual property lawsuits will be filed by Sun (and possibly by IBM). He also notes that, by operating outside of the JCP, Google is able to modify Android much more rapidly and is able to avoid Sun's ability to veto any JCP change - they can also add interfaces for components such as USB and Bluetooth which are not available in the base Java ME implementation. Finally, by licensing Dalvik's source code under the Apache license, mobile phone carriers are more likely to adopt it since they can use and modify it without paying licensing fees.
Dalvik appears to be causing quite a stir in the Java community - what are your thoughts?