Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do we explain this in simple words - Why is the JVM dependent on each OS ?  RSS feed

 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JVM is dependent on the OS it is meant for. What are the reasons for that ? I feel that we need to know what makes an OS different from the other, besides the GUI.
I don't know anything about OSes (have an orcale cert, but almost no CS knowledge), but i heard a word called architecture of an OS. Is that one of the reasons why the JVM is platform dependent ?

 
Suresh Sajja
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java compiler is platform independent. Compiler just convert java code into byte code.

JVM is platform dependent because
1. it must convert the byte code into machine language.
2. executes the corresponding machine-language instructions as well.

Machine instructions are different for different platforms. So different platforms need different JVM. So JVM is platform dependent
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh Sajja wrote:Java compiler is platform independent. Compiler just convert java code into byte code.

JVM is platform dependent because
1. it must convert the byte code into machine language.
2. executes the corresponding machine-language instructions as well.

Machine instructions are different for different platforms. So different platforms need different JVM. So JVM is platform dependent


Can you also give me the source of this information - like maybe a book or a well known website ?
 
Paul Clapham
Sheriff
Posts: 22472
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you're asking for an explanation of why you can't run a Windows executable on a Mac.

Most people realize that is the case, even though they don't have any Computer Science background either. But most people don't require an explanation, they accept it as a fact.
 
Paul Witten
Ranch Hand
Posts: 86
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy Jack wrote:Can you also give me the source of this information - like maybe a book or a well known website ?

You're poking into the architecture of the machine/processor now. Of course there are many differences between various platforms. To wit:

Every processor or processor family has its own machine code instruction set. Instructions are patterns of bits that by physical design correspond to different commands to the machine. The instruction set is thus specific to a class of processors using (much) the same architecture. Successor or derivative processor designs often include all the instructions of a predecessor and may add additional instructions.


From http://en.wikipedia.org/wiki/Machine_code

Just google "machine code platform" and you will get all the hits you need, but it will be very arcane and not at all related to the high level languages we use. So it's not so much OS dependent as platform architecture dependent (which registers are at which addresses and how to talk to them, etc.)

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!