views:

486

answers:

4

if we implement java interpreter in hardware then how we can achieve architecture neutrality of java bytecode... does java uses JIT(just in time interpreter) ? and how all this is related to Virtual Machine concept of operating system and java virtual machine(JVM)

+1  A: 
  • Implementing the JVM in hardware ignores the advantage of running managed code. What different would it then be from any other native code. And yes, the platform neutrality is also hindered. Regardless, there are such implementations, check out the aJile series of processors and ARM's Jazelle. These are targeted at embedded platforms though.
  • Sun's compiler, HotSpot uses JIT. I personally haven't used others but it should be a highly used technology.
  • JVM can be thought of as a limited resource VM, targeted at only one specific platform (the Java bytecode).
Chintan
that means virtualization of java(or can we call it jre?) is different from virtualization of operating system ...am i right?
paragjain
Virtualization, as I've understood is the simulation of hardware using software. The guest application (java apps or operating systems) see the VM as just another computer and use native code to interact with it. The VM on other hand, understands the native machine code, interprets what the app is requesting and then carries out the actions itself, provided there are necessary authorisations and permissions in place.So by this definition, virtualization of java apps or OS is similar, its the range of operations provided to the guest and power of the VM that differs.
Chintan
virtualization refers to changing a complete physical machine into a program running on another physical machine
Thorbjørn Ravn Andersen
+2  A: 

Yes, you can. Although this looks like it is stuck in the specification stage (or was abandoned), picoJava allows for native execution of Java bytecode. picoJava has a port available on a FPGA. There is Jazelle, as well for ARM processors.

Given that hardware would directly execute bytecode, all optimizations would also have to be done in hardware. JIT would not be required, since the processor will execute bytecode directly. After all any hardware implementation would involve implement the JVM model as defined in the Java Virtual Machine Specification. Optimizations that can be performed, will be on the lines of hardware optimizations - instruction pipelining, use of caches etc.

Hardware neutrality is not lost, since the bytecode executing on a hardware implementation would continue to work on a software implementation as well. It is the bytecode standard that allows Java to be hardware neutral.

Vineet Reynolds
+4  A: 

There has already been several hardware implementations of the Java system (i.e. a CPU that can execute bytecodes) but they have not become mainstream. This is most likely because that software implementations perform as well or even better as CPU's have become faster and faster.

As you will find when investigating more thouroughly, the details of the JVM implementations are not that important (and vary quite a bit) but they all execute the machine language of the JVM - java byte code. If you stay within the Java world and do not link in "native" stuff, you should be fine with whatever implementation you choose.

This company makes a living of providing server systems tuned for Java programs, they might interest you: http://www.azulsystems.com/

Thorbjørn Ravn Andersen
+2  A: 

Yes, there are several hardware Java implementations. However, they don't always perform better than software running on more general-purpose silicon.

The java.net site is currently screwed up due to a new, extremely buggy content management system, but Mark Lam has written several interesting blogs entries on this subject. You might be able to email him and get the full text of his articles.

erickson
One of the underlying issues would be that software optimizations can be 'patched' in. Hardware can't.
Vineet Reynolds
Even if the execution happens in hardware there is nothing hindering the hardware JVM to do whatever optimizations it want to. The machine has RAM and everything :)
Thorbjørn Ravn Andersen
Actually, it's literally impossible for software to be faster than hardware. If the hardware is slower, it means it's underdeveloped. For example, if Hotspot JIT is faster than some hardware implementation of Java, you can just move the Hotspot JIT to hardware, which will surely be faster than the existing one. But in any case, I doubt JIT is the fastest way to implement JVM in hardware. @Vineet: 1. Anything that can be done in software can be done in hardware. 2. x86 does rigorous optimizations at hardware level.
Longpoke