Mrunali Zode
Mrunali Zode

Reputation: 11

In a multiprocessor system, will each processor have an independent JVM?

Suppose we are having a system with multiple processors. Will each of these processor have their individual JVM? If no, then another question is that in a computer which has two different OS (say Windows and RedHat) partitioned and we have to run a java application on any of them. JVM will be different for both platforms, then how this will work?

Upvotes: 0

Views: 91

Answers (1)

Thomas Timbul
Thomas Timbul

Reputation: 1733

Suppose we are having a system with multiple processors. Will each of these processor have their individual JVM?

No, there will be one JVM instance launched for each program execution, but that JVM may (depending on implementation) use multiple processes and most certainly run with multiple threads, both of which would be capable of making use of the multi-processor facilities of the system.

If no, then another question is that in a computer which has two different OS (say Windows and RedHat) partitioned and we have to run a java application on any of them. JVM will be different for both platforms, then how this will work?

You install a separate JVM to each OS. Again, within each OS one would expect a single JVM instance to be launched per program execution, and the above applies again.

Java is "compile once, run anywhere", so as long as the JVM versions are compatible with what you've compiled, it doesn't matter which OS and corresponding JVM you execute it on, it will work exactly the same.

This is because Java bytecode is platform/OS agnostic (it is interpreted by the JVM), while the JVM itself is platform/OS specific.

Upvotes: 2

Related Questions