This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes How does a Java Virtual machine talk to underlying hardware? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How does a Java Virtual machine talk to underlying hardware?" Watch "How does a Java Virtual machine talk to underlying hardware?" New topic
Author

How does a Java Virtual machine talk to underlying hardware?

Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1365

There was a casual question raised while we were having tea this morning, which in essence was: how does a VM talk to the hardware?
For e.g: A phone(say, HTC Hero running Android OS) has lots of extras built-in such as Camera, Orientation sensors, Magnetic sensors etc. We write applications that run on a Virtual machine implementation(Dalvik for Android) and our apps use these hardware. How does a Virtual machine talk to the hardware?

What I think:

- Every Hardware has drivers(software that invoke/send signals to the hardware)
- There is a standard interface that both the writers of the driver software and JVM implementors know.
- Whenever there is a need to read/talk to hardware(we express this by making API calls in our apps), JVM converts them into calls defined in the interface. This then using callbacks/delegates invokes functions implemented in Driver program which then talks to the device.

Need advice, answers and links that can help me understand such s/w - h/w communication.

Please excuse me being naive and abstract;

Thank you.


[List of FAQs] | [Android FAQ] | [My Blog] | [Samuh Varta]
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Well the JVM serves as a layer between the OS and you, to abstract you away from OS specifics.

There is not one JVM for all OSs out there. For linux, mac, windows and whatever else is out there, there is a JVM compiled to run on that OS, so that it can translate your Java binary code into the commands the underlying OS would understand.


JDBCSupport - An easy to use, light-weight JDBC framework -
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1365

Ah! Forgot to add OS in the list.

So, now the sequence according to my understanding is this:

- Every Hardware has drivers(software that invoke/send signals to the hardware)
- There is a standard interface that both the writers of the driver software and OS implementors know.
- Whenever there is a need to read/talk to hardware(we express this by making API calls in our apps), JVM converts them into calls defined in the interface(system calls: between the OS and JVM). The OS kernel then using callbacks/delegates invokes functions implemented in Driver program which then talks to the device.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How does a Java Virtual machine talk to underlying hardware?
 
Similar Threads
Android Questions
Does Android only work in Google devices?
Advantage of DVM over JVM
Does Java supports Low level programming(Urgent basis)
Java support assembly Lang?