Saturday, January 06, 2007

JVM Internals - Part I

Beginning of New Year seems to be challenging for me. I am not getting enough time to recollect my ideas and write a blog on that. But in the end of last year, I decided to write blogs on JVM internals from very basic, so that a person who knows Hello World in Java can understand it. And here it goes:

Everything is sequential in this story and the most difficult is to find the entry point. Most of us are taking VM as a black box but looking inside this black box in not a tough job (neither an easy job).

VM is a machine dependent code that sacrifices itself to make java application machine independent. Lets first see the Hotspot into programmers perspective than latter we will analyze it on designer/architect perspective. Around 160 MB of this code written in C++ has 3 major parts:
~ Runtime Compilers
~ Garbage collectors
~ Everything else (JNI code, assembler code, oop (ordinary object pointer) code)

I will talk about all these later in my blog. So the folder structure goes something like this:
- vm
---- gc
---- runtime
---- compiler (communicates with other code of VM)
---- code (for Justin Time Compiler)
---- optimization
---- JNI (Java Native Interface to interact Java with c, c++ and vice-versa)
---- asm (assembler generated by VM)
---- oop (ordinary object pointers are java objects written in C++)
---- ...
---- ...

Understanding VM means understanding these parts. I will try to cover all of them in my upcoming blogs. In Sun, teams are dedicated for all these and believe me runtime people even don’t talk with gc people.

3 comments:

Waterfox said...

Nice beginning..but would have liked if some more stuff was covered in this issue.
Anyways, waiting for more :)

Vaibhav Choudhary said...

yes abhishek its Part I :), I will try to cover each thing in detail. Thats for the comment !

Unknown said...

Hi Vaibhav..Its really a nice tutorial but small in content..hope u will soon post some more stuff thx ayways for the brave effort