• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How does a Java Virtual machine talk to underlying hardware?

 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!